cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: cURL bug -- Segmentation Fault when timeout is 1 second

From: Toby Peterson <toby_at_apple.com>
Date: Mon, 9 Feb 2009 13:37:15 -0800

On Feb 9, 2009, at 11:08 AM, Daniel Marschall wrote:

>>>>>> What do you mean with the SSL-Part? What has to be other if a
>>>>>> HTTPS-page is
>>>>> called? Will the thread-safeness disappear then or what▀
>>>>
>>>> As described in the manual: yes.
>>>>
>>>> http://curl.haxx.se/libcurl/c/libcurl-tutorial.html#Multi-threading
>>>
>>> There is written something with SSL/TLS handlers. But what has
>>> this to do with multithreading? I don't use own TLS-handlers or
>>> something in that direction. So, what do I have to change for SSL?
>>
>> Read it again. Yes, most of that section discusses SSL, but there
>> is some other relevant information there.
> I did read and understand, but the OpenSSL part is not relevant to
> me because I don't use this crypto locks provided there. I also
> followed those 2 links. I am not stupid, as you might think.

The OpenSSL part is not relevant. However, the following paragraph is
relevant:

"When using multiple threads you should set the CURLOPT_NOSIGNAL
option to 1 for all handles. Everything will or might work fine except
that timeouts are not honored during the DNS lookup - which you can
work around by building libcurl with c-ares support. c-ares is a
library that provides asynchronous name resolves. On some platforms,
libcurl simply will not function properly multi-threaded unless this
option is set."

You did actually edit your forum post to add CURLOPT_NOSIGNAL, so I
guess you got that part. Good.

>>>>>> Can you post a full stand-alone example here that crashes for
>>>>>> you and that
>>>>
>>>>> I actually did post a full, stand-alone code that can be
>>>>> directly compiled
>>>>> and runned, look at my post.
>>>>
>>>> You didn't post it here and I didn't chase around for one.
>>>
>>> If you cannot follow a link, I doubt your readiness to help. I
>>> cannot post 300 lines code unformated in this newsgroup. The link
>>> contains exactly the code and is well formated and highlighted.
>>
>> If you cannot follow a link, I doubt your readiness to learn.
> Smarty-pants, I don't need destructive backtalk.
>>
>> - Toby
>
> Ah yes, your desired code because you cannot follow links:
>
> [snip]
>
> Do you know what? Forget it...

Try an attachment next time. I did get your code from the forum post
at http://www.c-plusplus.de/forum/viewtopic-var-p-is-1660082.html#1660082
  , but that also required me to copy/paste and do some search/replace
to remove garbage characters. An attachment would've been much more
useful.

Anyway, your recently updated code is crashing for a very simple
reason: you're trying to print an unterminated buffer. Works for me if
I change 'printf(buffer)' to 'fwrite(buffer, chunk.size, 1, stdout)'

- Toby
Received on 2009-02-09