cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Errors/crashes with FTP using multi interface?

From: Sam Deane <sam_at_elegantchaos.com>
Date: Fri, 29 Mar 2013 10:53:39 +0000

On 28 Mar 2013, at 22:15, Daniel Stenberg <daniel_at_haxx.se> wrote:

> 1. You didn't eliminate gcd completely. I had to remove a bunch of more uses.

I didn't claim to have eliminated GCD. I said I'd eliminated GCD dispatch sources - which had been one of the things we were wondering about, because of the way they work.

> 2. You extracted a URL with CURLINFO_EFFECTIVE_URL and then you freed the
> handle before you used the data so you deferred already freed memory.

This is true.

> 3. You freed the list you extracted with CURLINFO_PRIVATE _before_ you cleaned
> up the handle and thus caused another deferring of freed memory.

This is also true.

> See attached source that has these flaws fixed. Works fine for me.

I'm afraid that I can't accept your attached source, as it's not in the correct patch format ;)

Only kidding.

However, your attached source had the following lines in it:

#if 0
    curl_easy_setopt(handle, CURLOPT_POSTQUOTE, list);
#endif

Turning off the post quote stuff does indeed fix the crash.

Turning it back on again, however, causes it to crash, with your (non-gcd) version.

The backtrace is pretty consistent:

* thread #1: tid = 0x2503, 0x000000010006458f libcares.dylib`ares_destroy(channel=0x0000000100812a00) + 50 at ares_destroy.c:55, stop reason = EXC_BAD_ACCESS (code=13, address=0x0)
    frame #0: 0x000000010006458f libcares.dylib`ares_destroy(channel=0x0000000100812a00) + 50 at ares_destroy.c:55
    frame #1: 0x0000000100014fa2 libcurl.dylib`Curl_close(data=0x0000000100850a00) + 526 at url.c:440
    frame #2: 0x000000010000156d crashtest`curl_perform_wait + 541 at multi-nogcd-crashtest.c:82
    frame #3: 0x00000001000019e8 crashtest`main(argc=0, argv=0x00007fff5fbff328) + 184 at multi-nogcd-crashtest.c:167
    frame #4: 0x00007fff902697e1 libdyld.dylib`start + 1

It seems to happen just after the third connection has been added.

I've attached my modified source.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

Received on 2013-03-29