Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
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

HTTP/3: Busy loop due to IP_RECVERR #9209

Closed
tatsuhiro-t opened this issue Jul 26, 2022 · 4 comments
Closed

HTTP/3: Busy loop due to IP_RECVERR #9209

tatsuhiro-t opened this issue Jul 26, 2022 · 4 comments
Labels
HTTP/3 h3 or quic related

Comments

@tatsuhiro-t
Copy link
Contributor

I did this

Upload a large file with HTTP/3.
Lots of POLLIN event occurs but recvfrom read nothing.

It is caused by IP_RECVERR socket option [1] set for UDP socket. ngtcp2 does UDP Path MTU Discovery and it might send larger packet than the path can sustain. In this case ICMP message is received, it is resulted in POLLERR, which is translated into POLLIN by curl code. Because IP_RECVERR, the normal recvfrom call does not clear error queue, thus poll keeps returning POLLERR.
It is only cleared by recvmsg with MSG_ERRQUEUE. But it looks like there is no code in curl to do this.

[1]

curl/lib/connect.c

Lines 1670 to 1682 in e28edb6

#if defined(__linux__) && defined(IP_RECVERR)
if(addr->socktype == SOCK_DGRAM) {
int one = 1;
switch(addr->family) {
case AF_INET:
(void)setsockopt(*sockfd, SOL_IP, IP_RECVERR, &one, sizeof(one));
break;
case AF_INET6:
(void)setsockopt(*sockfd, SOL_IPV6, IPV6_RECVERR, &one, sizeof(one));
break;
}
}
#endif

I expected the following

curl/libcurl version

curl master branch with ngtcp2 QUIC backend
[curl -V output]

operating system

Linux

@tatsuhiro-t
Copy link
Contributor Author

The simple fix is not set this option for QUIC.
I'm curious that IP_RECVERR really works in libcurl as expected because I could not find recvmsg + MSG_ERRQUEUE in libcurl code.
If libcurl accepts file descriptor from an application, it can do recvmsg, but not sure it is supported and there are any indication from libcurl to show the error is enqueued.

@bagder
Copy link
Member

bagder commented Jul 26, 2022

#6341 and d13179d brought the IP_RECVERR use. Maybe we should revert that again?

/cc @crrodriguez

@bagder bagder added the HTTP/3 h3 or quic related label Jul 26, 2022
@crrodriguez
Copy link
Contributor

huh.. well..this is probably the only widespread use of UDP sockets with CURL.. I guess you can revert it safely.

@bagder
Copy link
Member

bagder commented Jul 26, 2022

Well, curl has as also done TFTP since 2005...

bagder added a commit that referenced this issue Jul 26, 2022
The options were added in #6341 and d13179d, but cause problems: Lots of
POLLIN event occurs but recvfrom read nothing.

Reported-by: Tatsuhiro Tsujikawa
Fixes #9209
bagder added a commit that referenced this issue Jul 26, 2022
The options were added in #6341 and d13179d, but cause problems: Lots of
POLLIN event occurs but recvfrom read nothing.

Reported-by: Tatsuhiro Tsujikawa
Fixes #9209
@bagder bagder closed this as completed in 3141062 Jul 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HTTP/3 h3 or quic related
Development

Successfully merging a pull request may close this issue.

3 participants