- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 6.9k
select: fix poll-based check not detecting connect failure #5509
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
| I still need to investigate the exact circumstances of the underlying issue a little bit more first, therefore this PR is back to Draft state and put on hold. | 
The select-based socket check correctly checks for connect failures by adding the write socket also to fds_err. The poll-based implementation (which internally can itself fallback to select again) did not previously check for connect failure by using POLLPRI with the write socket. This commit makes sure connect failures can be detected and handled if HAVE_POLL_FINE is defined, eg. on msys2-devel. Therefore the related disabled tests can be enabled again. Related to curl#5492
d7edc80    to
    7767bc4      
    Compare
  
    | Note to myself: May also be related to #5542. | 
| A note on the commit message. It just says what doesn't work (and sounds like a bug report), it doesn't really explain what change this commit brings... | 
| 
 It doesn't? I think this does: 
 It basically adds checking for POLLPRI which can be inferred from this statement. But anyway, I am still investigating this for the next feature window. This fix is required with #5492, but still does not make curl on msys2-runtime detect connect timeouts properly. But I guess this is more like a msys2-runtime issue which I am trying to confirm. | 
| 
 I finally found the root cause of the issue that curl is not able to detect connection reset/timeout on msys2-runtime/Cygwin-fork. The problem also exist in original Cygwin and can easily reproduced with a simple  Curl calls  Per wait-loop iteration the first call to  I guess msys2-runtime/Cygwin could be changed to internally keep track of having seen the  So I will now continue with this PR and #5492 soon and also report this runtime issue upstream to Cygwin and msys2. | 
| 
 Patch posted to Cygwin mailing list: https://cygwin.com/pipermail/cygwin/2020-July/245528.html | 
This commit changes Curl_socket_check to use POLLPRI to check for connect failure on the write socket, because POLLPRI maps to fds_err. This is in line with select(2). The select-based socket check correctly checks for connect failures by adding the write socket also to fds_err. The poll-based implementation (which internally can itself fallback to select again) did not previously check for connect failure by using POLLPRI with the write socket. See the follow up commit to this for more information. This commit makes sure connect failures can be detected and handled if HAVE_POLL_FINE is defined, eg. on msys2-devel. Replaces curl#5509 Related to curl#5492 Part of curl#5707
This commit changes Curl_socket_check to use POLLPRI to check for connect failure on the write socket, because POLLPRI maps to fds_err. This is in line with select(2). The select-based socket check correctly checks for connect failures by adding the write socket also to fds_err. The poll-based implementation (which internally can itself fallback to select again) did not previously check for connect failure by using POLLPRI with the write socket. See the follow up commit to this for more information. This commit makes sure connect failures can be detected and handled if HAVE_POLL_FINE is defined, eg. on msys2-devel. Reviewed-by: Daniel Stenberg Reviewed-by: Jay Satiro Replaces #5509 Prepares #5707
| The patch for Cygwin has now made it into a new release: https://www.mail-archive.com/[email protected]/msg09303.html | 
The select-based socket check correctly checks for connect
failures by adding the write socket also to fds_err.
The poll-based implementation (which internally can itself
fallback to select again) did not previously check for
connect failure by using POLLPRI with the write socket.
This commit makes sure connect failures can be detected
and handled if HAVE_POLL_FINE is defined, eg. on msys2-devel.
Therefore the related disabled tests can be enabled again.
Related to #5492