-
Notifications
You must be signed in to change notification settings - Fork 8k
Alternative check for sockets in win32/select.c, fixes #19722 #19725
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
Conversation
Can you please resolve the merge conflict? Thanks! |
Sorry, it's because the branch is based on PHP-8.4, I don't know why it conflicts with master. I'll resolve it later :) |
I have verified this fixes the assert issue locally, but I'm not sure if it may have side effects. Hopefully the build will tell.
0641281
to
fabe490
Compare
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.
I think this is right. Probably this should also be applied to 8.3, but no need to retarget as we can pick this up into the right branch.
cc @cmb69 maybe you want to have a look as well?
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.
Thanks for the PR! Looks reasonable to me, except for the issue mentioned below.
sock_max_fd = i; | ||
} | ||
} else { | ||
handles[n_handles] = (HANDLE)(uintptr_t)_get_osfhandle(i); |
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.
I wonder wether an INVALID_HANDLE_VALUE
can be returned here, and what to do in this case. Previously, that would have been treated as socket. Maybe we should stick with this; otherwise, it might be prudent to ignore such invalid handles.
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.
Good catch, I hadn't considered that. I'm doubtful assuming it's a socket is a good idea since that might cause issues with socket-specific parts of the code. Probably best to just skip them.
WaitForMultipleObjects is told how many elements to read, and it'll never read the element pointed to by n_handles, so we don't need to initialize this.
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.
Looks good to me now.
Not quite sure about which branch to target; the bug only affects debug builds (and we don't ship those), and I'm always a bit uncomfortable changing some parts of the code base (like this one). I'm okay with targeting 8.3, though.
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.
We can merge into master, since the assertion only affects debug builds. The fix for handling INVALID_HANDLE_VALUE may be valuable on lower branches too though. Perhaps we can merge first into master and if no problems arise merge it later into lower branches?
I've merged this now and will keep an eye on this. Thanks! |
I have verified this fixes the assert issue locally, but I'm not sure if it may have side effects. Hopefully the build will tell.