You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DynMessenger::DynMessenger uses timed_connect which calls connect once, assuming it will either get
0 - the connection succeeded
EINPROGRESS - the connection is pending, so we call select and assume that when that returns writability, we are connected
any other error - the connection failed
However, connect(2) (from Linux man-pages 6.03) notes:
EINPROGRESS
The socket is nonblocking and the connection cannot be completed immediately. (UNIX domain sockets failed with EAGAIN instead.)
The control socket is a UNIX socket, so this code is wrong. Usually, the control socket has room in the accept backlog, so connections do succeed. But if the control thread is tied up (which might be a bug in itself), the backlog may fill, and non blocking connections will not succeed immediately.
In that situation, we get EAGAIN instead of EINPROGRESS, and return error. If I change the code to handle EAGAIN in the same way as EINPROGRESS, the connection still fails, because apparently select considers the socket writable even when it is not yet connected.
The text was updated successfully, but these errors were encountered:
DynMessenger::DynMessenger
usestimed_connect
which callsconnect
once, assuming it will either get0
- the connection succeededEINPROGRESS
- the connection is pending, so we callselect
and assume that when that returns writability, we are connectedHowever,
connect(2)
(from Linux man-pages 6.03) notes:The control socket is a UNIX socket, so this code is wrong. Usually, the control socket has room in the accept backlog, so connections do succeed. But if the control thread is tied up (which might be a bug in itself), the backlog may fill, and non blocking connections will not succeed immediately.
In that situation, we get
EAGAIN
instead ofEINPROGRESS
, and return error. If I change the code to handleEAGAIN
in the same way asEINPROGRESS
, the connection still fails, because apparentlyselect
considers the socket writable even when it is not yet connected.The text was updated successfully, but these errors were encountered: