cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Getting Segmentation Fault from curl_multi_perform() when I add data

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Thu, 17 Dec 2015 00:01:30 +0100

On Wed, Dec 16, 2015 at 02:04:59PM -0600, heath.schaefer_at_parker.com wrote:
> I am getting a segmentation fault from curl_multi_perform() when I try to add
> data.
>
> My do {} while loop looks like the one on http://curl.haxx.se/libcurl/c/
> multi-post.html. While my program is waiting for data the curl_multi_perform()
> is running and returning normally, as far as I can tell. When data becomes
> available I set it in the easy handle using curl_easy_setopt() with the
> CURLOPT_POSTFIELDS and CURLOPT_POSTFIELDSIZE enumerations. I then add that
> easy handle to my multi handle with curl_multi_add_handle().

Are you changing and adding the first handle or a second handle? You can't
change a handle in mid-transfer.

> From what I can tell with my COUTs, it called the curl_multi_perform() two more
> times and then seg faults on the third call. What could be happening?

Run it under a debugger to see the exact line number of the code that's
segfaulting. If you still can't figure it out, please post code that
demonstrates the problem.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-12-17