Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ntherning
Copy link
Contributor

On Windows poll_event_wait() in threadpool-ms-io-poll.c checks
WSAGetLastError() when mono_poll() fails. However, mono_poll() sets errno
after converting the WSAXXX error code (e.g. WSAEFAULT->EFAULT). Occasionally
(maybe 1 in 100) the System test suite fails due to mono_poll() returning an
error and poll_event_wait() not handling the error code correctly on Windows.

This patch changes poll_event_wait() to use the same code path which checks
errno on all platforms including Windows. It also fixes a few other places
which used to check WSAGetLastError() rather than errno after a call to
mono_poll(). Also, the Socket.Poll_internal() and Socket.Select_internal()
icalls had to be patched to convert back the errno value to a corresponding
WSAXXX error code by adding WSABASEERR on Windows.

@ntherning
Copy link
Contributor Author

build

@ntherning
Copy link
Contributor Author

@monojenkins build

On Windows poll_event_wait() in threadpool-ms-io-poll.c checks
WSAGetLastError() when mono_poll() fails. However, mono_poll() sets errno
after converting the WSAXXX error code (e.g. WSAEFAULT->EFAULT). Occasionally
(maybe 1 in 100) the System test suite fails due to mono_poll() returning an
error and poll_event_wait() not handling the error code correctly on Windows.

This patch changes poll_event_wait() to use the same code path which checks
errno on all platforms including Windows. It also fixes a few other places
which used to check WSAGetLastError() rather than errno after a call to
mono_poll(). Also, the Socket.Poll_internal() and Socket.Select_internal()
icalls had to be patched to convert back the errno value to a corresponding
WSAXXX error code by adding WSABASEERR on Windows.
@ntherning ntherning force-pushed the fix-assert-in-poll_event_wait-on-WSAENOTSOCK-on-windows branch from 8d54a60 to 266345b Compare November 21, 2016 14:01
@ntherning
Copy link
Contributor Author

This patch only affects Windows. No builds look broken. I'm gonna merge it.

@ntherning ntherning merged commit 3592a79 into mono:master Nov 22, 2016
ntherning added a commit to ntherning/mono that referenced this pull request Nov 23, 2016
PR mono#3998 fixes an error handling issue in poll_event_wait(). This new change
fixes a minor code style problem in that PR, the condition in a ternary wasn't
enclosed in parentheses.
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…vent_wait-on-WSAENOTSOCK-on-windows

Fix assert in poll_event_wait() on WSAENOTSOCK on Windows

Commit migrated from mono/mono@3592a79
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
PR mono/mono#3998 fixes an error handling issue in poll_event_wait(). This new change
fixes a minor code style problem in that PR, the condition in a ternary wasn't
enclosed in parentheses.


Commit migrated from mono/mono@abc6614
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants