-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Assertion fails in http2.c #2800
Comments
Any chance you can retry this with curl from git? We've fixed a few http2 related issues recently so chances are this doesn't trigger anymore. |
I tried it but the crash still occurs.
|
Thanks for testing that. I'll try with your test app within a few days and see what I can do! |
I can reproduce the issue using your code. It just takes a while and quite a lot of transfers until it happens, so not exactly quick to figure out. But it's a start! |
Reported-by: Andrei Virtosu Fixes #2800
With the fix in #2809, the problem no longer reproduces for me! |
Excellent, thanks @bagder! |
I can't reproduce. Here's the single-file version of your recipe that I'm using: issue-2800.cpp Can you post a fresh stack trace of this with the current git version of curl? |
I get the assert again, using the single file issue-2800.cpp
without it, the assert won't occur. This is the back-trace:
curl/libcurl version curl 7.61.1-DEV (x86_64-pc-linux-gnu) libcurl/7.61.1-DEV OpenSSL/1.0.2g zlib/1.2.8 c-ares/1.14.0 nghttp2/1.32.0 |
That's not the assert though. This is a signal that originates from OpenSSL on close, and you sort of asked for this when you disabled libcurl's use of signals. You can avoid this "crash" by making sure you don't set:
|
Hey @bagder. We had problems/ crashes in our application. I don't remember exactly but we had crashes that had callstacks ending up in CurlSpay() and similar methods. Based on this information from the docu
We decided to set And then the problems where gone. |
The CURLOPT_NOSIGNAL man page is pretty detailed. If you want to
... then you set NOSIGNAL to |
Just a quick test with CURLOPT_NOSIGNAL set to 0L, I get similar crash:
|
Ok. If I remember correctly we also based our decision on https://stackoverflow.com/questions/21887264/why-libcurl-needs-curlopt-nosignal-option-and-what-are-side-effects-when-it-is. But if I understand correctly, then curl throws only signals if no async nameresolver (like c-ares) is used, right? |
Then what is that crash? That happens within OpenSSL... |
Correct. With c-ares or the threaded resolver, curl will not use signals for anything. |
@bagder Ok, thanks for explaining. What do you suggest we do to fix it, is it a problem in openssl ? |
@yandreiy what's the reason for the crash? |
|
See, that's a signal. It should've been ignored by libcurl: See frame #13-14 in your stack trace:
If you look in the Lines 2167 to 2169 in ba58ce6
Can you figure out why it doesn't do that for you? By observation, it looks like you still set |
On further thoughts: the assert that was the reason for this issue is fixed and does not seem to appear again. The later SIGPIPE issue is different. If you still experience this without asking for it by telling libcurl to disable its signal handler, please submit a new issue. I consider this assert bug fixed and this issue closed. |
Multi-threaded applictions basically MUST set CURLOPT_NO_SIGNAL to 1L to avoid the risk of getting a SIGPIPE. Either way, a multi-threaded application that uses libcurl/openssl needs to have a signhandler for or ignore SIGPIPE on its own. Based on discussions in #2800
I created a small reproducible sample to help with debugging, that gives a crash after around 1 minute of running.
The app is here: https://github.com/yandreiy/curl-crash-reproduction
The error and stack trace:
I did this
Add the line to /etc/hosts, so the request resolves to an error.
Run the sample application, which sends requests to "my-url".
I expected the following
No assert occuring
curl/libcurl version
curl 7.61.0 (x86_64-pc-linux-gnu) libcurl/7.61.0 OpenSSL/1.0.2g zlib/1.2.8 c-ares/1.14.0 nghttp2/1.32.0
Release-Date: 2018-07-11
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS Debug TrackMemory IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy
operating system
Ubuntu 16.04.4 LTS
The text was updated successfully, but these errors were encountered: