cURL / Mailing Lists / curl-library / Single Mail

curl-library

Apache Segmentation Fault when Ending curl_multi FTP Transfers

From: Ben Thomas <benmailinglists_at_gmail.com>
Date: Thu, 2 May 2013 11:38:21 +0100

I'm trying to use PHP to transfer files via FTP, using curl_multi...
I've got the majority working fine but have come across a problem I
can't figure out.

If any of the "multi" transfers fail, I want to be able to immediately
stop the rest of the transfers, so if I'm transferring 5 files, and
the first one fails (for whatever reason), I don't want to bother
wasting bandwidth sending the rest. I just want to stop all the
transfers, but when I try and do this, I get a segmentation fault in
Apache: "[notice] child pid 9945 exit signal Segmentation fault (11)"

Here's a section of the code I'm trying to use, so when any fail, I'm
trying to just break out of the loop. I've also tried closing the
multi handle completely (curl_multi_close($mh);) instead of just
breaking out of the loop, but I still get the segfault.

do {

    $n = curl_multi_exec($mh, $active);
    curl_multi_select($mh, 1);

    $info = curl_multi_info_read($mh);

    if ($info !== false) {

        $individual_info = curl_getinfo($info['handle']);

        if($individual_info){

            if($info['result'] != 0){
                $failed_transfers[] = basename($individual_info['url']);
                curl_multi_remove_handle($mh, $info['handle']);
                curl_close($info['handle']);
                break;
            }else{
                $successful_transfers[] = basename($individual_info['url']);
                curl_multi_remove_handle($mh, $info['handle']);
                curl_close($info['handle']);
            }

        }

    }

} while ($active);

Anyone come across this before?

Thanks
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-05-02