cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker mailing list Archives

[ curl-Bugs-2781096 ] SIGSEGV when setting timeouts in multithreaded sample

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Sat, 25 Apr 2009 13:16:09 +0000

Bugs item #2781096, was opened at 2009-04-25 12:24
Message generated for change (Comment added) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=2781096&group_id=976

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: libcurl
Group: crash
Status: Open
>Resolution: Works For Me
Priority: 5
Private: No
Submitted By: k0l0b0k (k0l0b0k)
Assigned to: Daniel Stenberg (bagder)
Summary: SIGSEGV when setting timeouts in multithreaded sample

Initial Comment:
I have a troubles in my software, that using libcurl.
For test case I take this example from trunk http://cool.haxx.se/cvs.cgi/curl/docs/examples/multithread.c?rev=1.4&content-type=text/vnd.viewcvs-markup

and added setting options for timeout:

41a42,43
> curl_easy_setopt(curl, CURLOPT_TIMEOUT, 10L);
> curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 10L);

(result file in attachment).

just compile it (gcc multithread.c -lpthread -lcurl), and run - application will fail with SIGSEGV
valgrind tells for it:

==11051== Warning: client switching stacks? SP change: 0xBE88D03C --> 0x6A6DBE0
==11051== to suppress, use: --max-stackframe=1209928612 or greater
==11051== Invalid write of size 4
==11051== at 0x4045D4B: Curl_resolv (hostip.c:403)
==11051== Address 0x6a6dbe4 is on thread 1's stack
==11051==
==11051== Invalid read of size 4
==11051== at 0x4045D4F: Curl_resolv (hostip.c:403)
==11051== Address 0x6a6dbf8 is on thread 1's stack
==11051==
==11051== Invalid write of size 4
==11051== at 0x4045D52: Curl_resolv (hostip.c:403)
==11051== Address 0x6a6dbe0 is on thread 1's stack
==11051==
==11051== Invalid read of size 4
==11051== at 0x404F20A: Curl_failf (sendf.c:244)
==11051== Address 0x6a6dbe0 is on thread 1's stack
==11051==
==11051== Invalid read of size 4
==11051== at 0x404F211: Curl_failf (sendf.c:249)
==11051== Address 0x6a6dbe4 is on thread 1's stack
==11051==
==11051== Process terminating with default action of signal 11 (SIGSEGV)
==11051== Bad permissions for mapped region at address 0x401F214
==11051== at 0x405ED49: addbyter (mprintf.c:998)
==11051==
==11051== ERROR SUMMARY: 5 errors from 5 contexts (suppressed: 72 from 2)
==11051== malloc/free: in use at exit: 66,117 bytes in 2,045 blocks.
==11051== malloc/free: 2,258 allocs, 213 frees, 190,626 bytes allocated.
==11051== For counts of detected errors, rerun with: -v
==11051== searching for pointers to 2,045 not-freed blocks.
==11051== checked 25,470,056 bytes.
==11051==
==11051== LEAK SUMMARY:
==11051== definitely lost: 0 bytes in 0 blocks.
==11051== possibly lost: 432 bytes in 3 blocks.
==11051== still reachable: 65,685 bytes in 2,042 blocks.
==11051== suppressed: 0 bytes in 0 blocks.

Is this libcurl issue? Or I may be I should use curl multi mode? Thanks in advance.
Tested on two OS:
- Ubuntu 8.10
- Slackware 12.1 (Bluewhite x64)
with current updates.
SIGSEGV on both.

----------------------------------------------------------------------

>Comment By: Daniel Stenberg (bagder)
Date: 2009-04-25 15:16

Message:
in unix systems, CURLOPT_NOSIGNAL need to be used if you're using the
default resolver, as it will use signals to time-out otherwise and signals
and threads don't mix.

But ideally, you switch to using the c-ares resolver then to get proper
timeouts even without signals.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=2781096&group_id=976
Received on 2009-04-25

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET