Closed DymOK93 closed 1 year ago
The problem arises from a race condition between the creation of two named pipe instances in SeafileRpcClient::connectDaemon() and the creation of the daemon thread.
SeafileRpcClient::connectDaemon()
kSeafileRpcService
kSeafileThreadedRpcService
ERROR_PIPE_BUSY
CreateFile()
pipe_read_n()
ERROR_BROKEN_PIPE
The bug was already mentioned (but not actually fixed) in https://github.com/haiwen/seafile-client/issues/1284.
My solution is similar to the Named Pipe Client example on the Microsoft website: using WaitNamedPipe() if CreateFile() fails with ERROR_PIPE_BUSY.
WaitNamedPipe()
Thank you for the nice patch! It's been merged.
The problem arises from a race condition between the creation of two named pipe instances in
SeafileRpcClient::connectDaemon()
and the creation of the daemon thread.kSeafileRpcService
.kSeafileThreadedRpcService
.ERROR_PIPE_BUSY
fromCreateFile()
.pipe_read_n()
returns 0 forERROR_BROKEN_PIPE
so the daemon thread silently terminates. Then the situation repeats up to 20 * 16 times in total, after which the client exits with an error.The bug was already mentioned (but not actually fixed) in https://github.com/haiwen/seafile-client/issues/1284.
My solution is similar to the Named Pipe Client example on the Microsoft website: using
WaitNamedPipe()
ifCreateFile()
fails withERROR_PIPE_BUSY
.