-
-
Notifications
You must be signed in to change notification settings - Fork 418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix incorrect Windows process waiting #3559
Conversation
I think there are a couple of problems with recent changes to `ponyint_win_process_wait`. Changing the timeout value to 0 means that `WaitForSingleObject` won't block, so we can't close the handle in that case. Also 0x80 is the return code `WAIT_ABANDONED` which doesn't apply to processes. We should be checking for `WAIT_TIMEOUT` (0x102) which means the process hasn't exited yet. Also we need to make sure that retval is not 0 or 1 in an error case where `GetLastError()` returns 0 for some reason.
@kulibali did you verify that this fixes the corral issue: |
src/libponyrt/lang/process.c
Outdated
if (retval == 0) retval = -1; | ||
} | ||
break; | ||
case WAIT_ABANDONED: // shouldn't happen to a process |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this shouldn't happen, i feel like we should be erroring out or something here so that it straight up dies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I have moved this so it fails.
Yes, from initial testing this seems to fix the Corral issue. |
@kulibali I'm wary of that "this can't happen" fall through. I'd prefer to not have that. Better to have it complain, die or something. Other than that, I think this is good. |
My bad! :( Me trying windows things... |
I think there are a couple of problems with recent changes to
ponyint_win_process_wait
. I should have caught them in review.Changing the timeout value to 0 means that
WaitForSingleObject
won't block, so we can't close the handle in that case. Also 0x80 is the return codeWAIT_ABANDONED
which doesn't apply to processes. We should be checking forWAIT_TIMEOUT
(0x102) which means the process hasn't exited yet. Also we need to make sure that retval is not 0 or 1 in an error case whereGetLastError()
returns 0 for some reason.