curl-library
Re[4]: gethostbyname_thread: Access Violation
Date: Mon, 22 Aug 2005 21:06:31 +0700
Hello, Gisle,
Monday, August 22, 2005, 7:00:15 PM, you wrote:
> I build your program as:
> cl -I../include -Zi -GZ -Yd -MDd -D_DEBUG -DCURL_STATICLIB
> thread-crash.cpp libcurld.lib wsock32.lib winmm.lib
I build using following command:
cl test_curl.cpp libcurl.lib
where libcurl.lib is compiled in debug configuration as DLL.
> I ran it on cmdline and in VS debugger. No problem on cmdline. But
> debugging it shows that the resolver thread isn't started until you call
> Sleep() !. Note that GetCurrentProcess() returns -1, which I assume
> means the parent app. or main thread is gone.
You mean that when main thread enters Sleep, there is additional
thread (proces has two threads). I think, it is a problem (isn't it).
I called all _cleanup_ functions of libcurl, but there exist remaining
of libcurl - the second thread. All memory of libcurl is deallocated
at this moment, but thread can try to access it and ause access
violation or UB. In my case it is access violation.
> Try with the following patch:
I did not tried this patch according your next message.
-- Best regards, Igor Polyakov mailto:ipolyakov_at_issart.comReceived on 2005-08-22