Blocking accept in socketpair implementation may cause permanent hang after system resume from sleep #3144
Labels
Component: libmosquitto
Status: Available
No one has claimed responsibility for resolving this issue.
Description:
On Windows platform, mosquitto may permanently hang when the system resumes from sleep state. After analysis, this issue occurs in the net__socketpair implementation.
Details:
In the current implementation, while the connect socket is set to non-blocking mode, the accept remains blocking
During system resume from sleep, when the network stack might not be fully initialized, the non-blocking connect may return EINPROGRESS or EWOULDBLOCK
The code proceeds to the blocking accept call, but since the connection might never complete, the accept call may block indefinitely
Affected Versions:
2.0.18 and later version
My Reproduce Experience:
After I wake up my Windows system, sometimes my program call "ondisconnect" callback. Then my program called "mosquitto_new" function and stuck in "net__socketpair function in lib/net_mosq.c" forever.
Related Code:
The text was updated successfully, but these errors were encountered: