[Bug 21387] NetTerm locks up

wine-bugs at winehq.org wine-bugs at winehq.org
Tue Aug 2 23:45:57 CDT 2011


http://bugs.winehq.org/show_bug.cgi?id=21387

Bruno Jesus <00cpxxx at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |00cpxxx at gmail.com

--- Comment #10 from Bruno Jesus <00cpxxx at gmail.com> 2011-08-02 23:45:56 CDT ---
Select indeed returns 1 because poll() returns 1, the main problem is that poll
returned an error event for the descriptor but Wine didn't check it. As the FD
is being checked for write Wine tests only for POLLOUT. This is a piece of the
log generated by strace:

...
poll([{fd=21, events=POLLOUT}], 1, 100) = 0 (Timeout)
poll([{fd=21, events=POLLOUT}], 1, 100) = 0 (Timeout)
poll([{fd=21, events=POLLOUT}], 1, 100) = 0 (Timeout)
poll([{fd=21, events=POLLOUT}], 1, 100) = 1 ([{fd=21,
revents=POLLOUT|POLLERR|POLLHUP}])
...

On socket.c, on function get_poll_results the revents variable is not checked
properly for read and write fds. The attached patch fix this but although it's
simple it contains critical changes. Netterm is not giving false connections
anymore, I also tested utorrent because it does thousands of socket operations
and it still runs fine after the patch.

The make test for the sockets says there are 2 failures, both of them are
success inside todo blocks, I'm not sure what that means but I guess they are
not real errors.

sock.c:4979:  **** TEST 4 COMPLETE ****
sock.c:2314: Test succeeded inside todo block: expected 0 (timeout), got: 0
sock.c:2353: Test marked todo: select should not return any socket handles
sock.c:2354: Test marked todo: FD should not be set
sock.c:2355: Test succeeded inside todo block: FD should not be set

The tests create sockets and pass them to select without binding, this makes
poll returns POLLHUP for every socket. But POLLHUP is also a message telling us
that a socket is being disconnected (if TCP connection was previously
established), so in order to fix the errors from lines 2353 and 2354 Wine would
need to check if the socket was connected; and if it was treat POLLHUP as a
successful reading. Read remarks from
http://msdn.microsoft.com/en-us/library/ms740141%28v=vs.85%29.aspx for a much
better explanation.

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
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