cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_multi_cleanup simetimes causes crash in NT.DLL (access violation)

From: Alan <jkabeal-curl_at_yahoo.com>
Date: Thu, 8 Apr 2010 07:22:06 -0700 (PDT)

Looks like the crash in NT.DLL after curl_multi_cleanup is a corrupt heap.
I am seeing Heap corruption detected at: xxxx
Also, I have seen the crash during curl_easy_cleanup.
Message is: Invalid address sent to RtlHeapFree
This one is very strange since I cleanup each easy handle only once and after
I remove from the multi_stack.
Alan

--- On Wed, 4/7/10, jkabeal-curl_at_yahoo.com <jkabeal-curl_at_yahoo.com> wrote:

From: jkabeal-curl_at_yahoo.com <jkabeal-curl_at_yahoo.com>
Subject: curl_multi_cleanup simetimes causes crash in NT.DLL (access violation)
To: curl-library_at_cool.haxx.se
Date: Wednesday, April 7, 2010, 1:48 PM

I have been using the easy interface for a while with no issues. But the easy interface
is synchronous and my QT app is event driven. So I switched over to the multi interface.
Since my program is used in the real world and FTP is unpredictable, I needed to make
sure the multi interface is solid.
Here is the original flow:
Create all easy interfaces and add to multi_stack. Total=49
Used the sample program: multi_post.c  as a template.
Loop in multi_perform checking for finished handles.
As each handle finishes, remove from multi_stack.
If there was a timeout, add back to multi_stack.
When all transfers are done, there should be no easy_handles on multi_stack.
So cleanup all easy handles
and cleanup multi handle.
Most of the time this works fine. But If there are transfer errors, I sometimes see
an access violation in NT.DLL. The last curl command was curl_multi_cleanup.
I have not been able to really figure out what is happening using the debugger. (gdb)
I found this: Re: curl_multi_remove_handle closes easy handle, causes crash
in the curl-library archive. So I updated multi.c. This did not solve the issue.
I thought maybe multi_interface did not like removing all the easy_handles and
adding all the "timeouts" back and trying again.
So I modified my code to only remove the easy handles at the end and to only have a
max of 2 active handles on the multi_stack. Only having 2 active handles on the
multi_stack limits the number of open FTP connections to 2.
Flow:
1. remove all easy handles from multi_stack
2. cleanup easy handles
3. cleanup multi handle
This also has not solved the issue.
When I am able to catch this in gdb, I see about 8 threads and non of the stacks
show my main program.
I have a lot of qDebug() output during the FTP transfers and have not found any issues
there.
Compile info:
Win XP
mingw gcc 3.4.5
QT 4.5.3
lib-curl 7.20.0 compiled with: mingw32-make -f Makefile.m32
Unfortunately I do not have a small test case that shows the issue.
Please respond if you have seen this before.
Thanks,
Alan

-----Inline Attachment Follows-----

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

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-04-08