Skip to content
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

curl -m not working due to connect call hangs #2198

Closed
tg123 opened this issue Jun 8, 2017 · 2 comments
Closed

curl -m not working due to connect call hangs #2198

tg123 opened this issue Jun 8, 2017 · 2 comments

Comments

@tg123
Copy link
Member

tg123 commented Jun 8, 2017

  • Your Windows build number: (Type ver at a Windows Command Prompt)

Microsoft Windows [Version 10.0.15063]

  • What you're doing and what's happening: (Copy&paste specific commands and their output, or include screen shots)

curl -m 1 did not end in 1s, but a long time

  • What's wrong / what should be happening instead:

seems connect call takes a long time (see strace log)

  • Strace of the failing command, if applicable: (If <cmd> is failing, then run strace -o strace.txt -ff <cmd>, and post the strace.txt output here)

strace -T curl 1.2.3.4:5678 -m 1

shows connect cost 21s

socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 4 <0.000104>
setsockopt(4, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0 <0.000028>
setsockopt(4, SOL_TCP, TCP_KEEPIDLE, [60], 4) = 0 <0.000019>
setsockopt(4, SOL_TCP, TCP_KEEPINTVL, [60], 4) = 0 <0.000047>
fcntl(4, F_GETFL)                       = 0x2 (flags O_RDWR) <0.000025>
fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK)    = 0 <0.000032>
clock_gettime(CLOCK_MONOTONIC, {166492, 668494000}) = 0 <0.000045>
connect(4, {sa_family=AF_INET, sin_port=htons(5678), sin_addr=inet_addr("1.2.3.4")}, 16) = -1 EAGAIN (Resource temporarily unavailable) <21.002000>
clock_gettime(CLOCK_MONOTONIC, {166513, 672789000}) = 0 <0.000054>

vs strace on Ubuntu 16.04.2

socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 4 <0.000024>
setsockopt(4, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0 <0.000018>
setsockopt(4, SOL_TCP, TCP_KEEPIDLE, [60], 4) = 0 <0.000012>
setsockopt(4, SOL_TCP, TCP_KEEPINTVL, [60], 4) = 0 <0.000017>
fcntl(4, F_GETFL)                       = 0x2 (flags O_RDWR) <0.000010>
fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK)    = 0 <0.000018>
clock_gettime(CLOCK_MONOTONIC, {1282779, 886594029}) = 0 <0.000010>
connect(4, {sa_family=AF_INET, sin_port=htons(5678), sin_addr=inet_addr("1.2.3.4")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000048>

See our contributing instructions for assistance.

@therealkenc
Copy link
Collaborator

therealkenc commented Jun 8, 2017

shows connect cost 21s

21 seconds. Surely the same as #1829 (message) #1584. Non-blocking connect getting popular as a feature request lately (#903).

@sunilmut
Copy link
Member

sunilmut commented Jun 9, 2017

@tg123 - Thanks for your post and the trace. Very helpful.

Yes, non-blocking connect seems to be coming up more frequently now. Note taken. Marking this one as dupe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants