cURL / Mailing Lists / curl-library / Single Mail


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

From: <>
Date: Wed, 7 Apr 2010 10:48:52 -0700 (PDT)

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.
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
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.

List admin:
Received on 2010-04-07