-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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 network connect poll interuption handling #16606
Conversation
When connecting to socket, it is possible to get EINTR. In such case, there should be an another attempt to connect if we are not over the timeout. The timeout should be adjusted accordingly in that case. Closes phpGH-16606
104773e
to
f0c72c4
Compare
This should be now ready for review. I will see if there is anyway how I could create an EINTR at least manually and test it a bit but code wise, it should be ready. |
Note that gettimeofday() may not be the appropriate method here because that is not a monotonic clock. I.e. your time difference may become negative |
Isn't that covered by |
It's indeed covered by
I don't think so. |
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 fine, just one silly nit
When connecting to socket, it is possible to get EINTR. In such case, there should be an another attempt to connect if we are not over the timeout. The timeout should be adjusted accordingly in that case. Closes phpGH-16606
f65bff1
to
319fc93
Compare
319fc93
to
687b335
Compare
@nielsdos Just a note that I struggled a bit to find some good way how to test those paths reliably. So I decided to introduce unit testing setup using cmocka to mock the libc functions and be able to cover those paths. I will ping other devs for feedback as well. |
I merged just the code change without the tests - the tests are now in #16987 |
Thanks, I'll have a look tonight. Lines 1499 to 1514 in 284c4e3
|
When connecting to socket, it is possible to get EINTR. In such case, there should be an another attempt to connect if we are not over the timeout. The timeout should be adjusted accordingly in that case.
This should fix phpredis/phpredis#1881 . It is inspired by redis/hiredis#1213 that had a similar issue.