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_easy_duphandle() bug after 7.69.1 #5097

Closed
kn007 opened this issue Mar 13, 2020 · 11 comments
Closed

curl_easy_duphandle() bug after 7.69.1 #5097

kn007 opened this issue Mar 13, 2020 · 11 comments

Comments

@kn007
Copy link

kn007 commented Mar 13, 2020

I try it on 7.69.1 and 7.69.2-dev, same problem. 7.69.0 working well.

  OS               Linux CentOS Linux release 8.1.1911 (Core)
  Kernel           5.5.5-1.el8.elrepo.x86_64
--disable-static --enable-threaded-resolver --with-gssapi --with-nghttp2 --enable-ares
curl 7.69.2-DEV (x86_64-pc-linux-gnu) libcurl/7.69.2-DEV OpenSSL/1.1.1c-fips zlib/1.2.11 c-ares/1.16.0 libidn2/2.2.0 nghttp2/1.40.0
Release-Date: [unreleased]
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS GSS-API HTTP2 HTTPS-proxy IDN Kerberos Largefile libz NTLM NTLM_WB SPNEGO SSL TLS-SRP UnixSockets

dnf:

CentOS-8 - AppStream                                                                                             0.0  B/s |   0  B     00:00
Error: Failed to download metadata for repo 'AppStream': Cannot prepare internal mirrorlist: curl_easy_duphandle() call failed

git:

Cloning into 'curl'...
warning: curl_multi_add_handle failed: Invalid easy handle
fatal: unable to access 'https://github.com/curl/curl/': failed to start HTTP request
@bagder
Copy link
Member

bagder commented Mar 13, 2020

Can you provide a simple stand-alone example code showing this problem? Both the tools you refer to above are huge and complex applications that make things really hard to debug or even understand what they're doing.

@kn007
Copy link
Author

kn007 commented Mar 13, 2020

Sorry, I'm afraid that I can't.
I guess it happened after commit: c8f086b
let me try it.

@kn007
Copy link
Author

kn007 commented Mar 13, 2020

My guess is correct.
After run
git reset --hard e364546fb3371ac27f59f897e4c55acce7fc824e
make curl and it working fine.

but reset to c8f086b , it's broken..

Sorry that I could not get more information.

@bagder
Copy link
Member

bagder commented Mar 13, 2020

I still can't see what's wrong in there...

kn007 added a commit to kn007/patch that referenced this issue Mar 13, 2020
cure the symptoms, not the disease -- temporary fix

More infomation visit: curl/curl#5097
jay added a commit to jay/curl that referenced this issue Mar 14, 2020
- Ignore CURLE_NOT_BUILT_IN errors returned by c-ares functions in
  curl_easy_duphandle.

Prior to this change if c-ares was used as the resolver backend and
either it was too old or libcurl was built without IPv6 support then
some of our resolver functions could return CURLE_NOT_BUILT_IN to
curl_easy_duphandle causing it to fail.

Caused by c8f086b which shipped in 7.69.1.

Reported-by: Karl Chen

Fixes curl#5097
Closes #xxxx
@jay
Copy link
Member

jay commented Mar 14, 2020

If c-ares is too old or IPv6 support is disabled (like is the case here) those functions could return CURLE_NOT_BUILT_IN:

curl/lib/asyn-ares.c

Lines 788 to 812 in b81e0b0

CURLcode Curl_set_dns_local_ip6(struct Curl_easy *data,
const char *local_ip6)
{
#if (ARES_VERSION >= 0x010704) && defined(ENABLE_IPV6)
unsigned char a6[INET6_ADDRSTRLEN];
if((!local_ip6) || (local_ip6[0] == 0)) {
/* disabled: do not bind to a specific address */
memset(a6, 0, sizeof(a6));
}
else {
if(Curl_inet_pton(AF_INET6, local_ip6, a6) != 1) {
return CURLE_BAD_FUNCTION_ARGUMENT;
}
}
ares_set_local_ip6((ares_channel)data->state.resolver, a6);
return CURLE_OK;
#else /* c-ares version too old! */
(void)data;
(void)local_ip6;
return CURLE_NOT_BUILT_IN;
#endif
}

I don't know for sure this is the problem but I don't see what else it could be. #5100 should fix this, @kn007 can you please try it?

@kn007
Copy link
Author

kn007 commented Mar 14, 2020

Ok, let me try it, wait a minute.

my c-ares is 1.16.0, IPv6 is disabled.

@kn007
Copy link
Author

kn007 commented Mar 14, 2020

@jay Yes, it's working fine after patch #5100 .
Thanks for your work.

@bagder
Copy link
Member

bagder commented Mar 14, 2020

But why is the build IPv6-disabled, no such configure option was shown?

@bagder bagder changed the title curl easy handle bug after 7.69.1 curl_easy_duphandle() bug after 7.69.1 Mar 14, 2020
@kn007
Copy link
Author

kn007 commented Mar 14, 2020

I don't know.
My OS disabled the ipv6 on grub.

GRUB_CMDLINE_LINUX = ... ipv6.disable=1

Some people like me, will change it on the sysctl.conf file.

@jay jay closed this as completed in 3bfda07 Mar 14, 2020
@jay
Copy link
Member

jay commented Mar 14, 2020

Thanks

@michael-o
Copy link
Contributor

To whom it may concern, the one off patch has already been applied to the FreeBSD Ports system: https://svnweb.freebsd.org/changeset/ports/530365

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

Successfully merging a pull request may close this issue.

4 participants