[Bug 51442] Socket connection is not established properly

WineHQ Bugzilla wine-bugs at winehq.org
Wed Jan 5 09:18:00 CST 2022


https://bugs.winehq.org/show_bug.cgi?id=51442

--- Comment #20 from Roman Pišl <rpisl at seznam.cz> ---
What the occasionally failing program does:

1. Spawns other process (that takes some time to initialize and finally listens
on local TCP socket)
2. Makes the socket non-blocking - ioctlsocket(fd, FIONBIO, 1)
3. Connects to #1, tests result, ok or error -> done, if WSAEWOULDBLOCK:
4. select(.., NULL, wfdset, timeout)
5. getsockopt(fd, SOL_SOCKET, SO_ERROR, ..)
6. SO_ERROR!=0 && SO_ERROR!=WSAEWOULDBLOCK -> error
7. fd ready for write -> #7 else -> #4
8. Makes the socket blocking - ioctlsocket(fd, FIONBIO, 0)
9. select(.., NULL, wfdset, ..)
10. send()

This sometimes runs to 9 but loops there forever, the socket is never marked as
ready for write again.

Performing #5+#6 also before #4 fixes this. Either it really fixes the problem
or changes the timing and hides the real problem.

Since the fix exists and it is hard to reproduce it is not critical. I will
test again once in a while.

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.


More information about the wine-bugs mailing list