Thanks to @timegrid , I located a bug of daemon start up.
- There is a socket file remained for some reason (like forcibly kill the process, not by gpgconf --kill)
- client side: Connection with the socket file fails because no daemon is running
- client side: Spawn the daemon
- client side: loop until connection success or timeout
- server side: assuan_sock_bind fails because there is the socket file already
- server side: try to remove the socket file with gnupg_remove
- Suppose that the file is opened by client here, during the file is requested for removal
- server side: assuan_sock_bind again, but this may fail at CreateFileW (with ERROR_ACCESS_DENIED) because client side still has the valid handle to the socket file
- server side: mysterious system error code: 0 (0x0) and error binding socket to ...: Unknown error are emitted and the process vanishes (by agent_exit(2))
- client side: timeout, because the daemon vanished
See:
https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilew