The sync/server uses accepted fd as key to maintain the connection and
closes the fd before client_handler thread exits. It will cause the
deadlock between listen and reaper threads. The timeline is like:
The lowest fd will be returned by accepted. The listener thread will use
new connection handler to replace the existing one. Since there is
long-running connection for container lifecycle, the reaper thread holds
the lock which listener thread is acquiring. It is deadlock.
To fix this issue, we should close fd in the reaper thread to prevent
the reuse fd.
The sync/server uses accepted fd as key to maintain the connection and closes the fd before client_handler thread exits. It will cause the deadlock between listen and reaper threads. The timeline is like:
The lowest fd will be returned by accepted. The listener thread will use new connection handler to replace the existing one. Since there is long-running connection for container lifecycle, the reaper thread holds the lock which listener thread is acquiring. It is deadlock.
To fix this issue, we should close fd in the reaper thread to prevent the reuse fd.
Signed-off-by: Wei Fu fuweid89@gmail.com