cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re[3]: gethostbyname_thread: Access Violation

From: Igor Polyakov <ipolyakov_at_issart.com>
Date: Mon, 22 Aug 2005 20:48:36 +0700

Hello, Daniel,

Monday, August 22, 2005, 6:49:08 PM, you wrote:

> I _think_ the problem is like this:

> In lib/hostthre.c:Curl_getaddrinfo() a thread is created to do the resolving.
> The thread is killed when the connection is disconnected.

No, it is not killed.

As I understand, resolver thread is created within
hosttre.c/init_resolve_thread, it is terminated in
hosttre.c/Curl_wait_for_resolv.

But in my program Curl_wait_for_resolv is not called (I checked it
using breakpoint).

I think the cause is:
My program calls curl_multi_perform only two times (first time it
return CURL_CALL_MULTI_PERFORM, second - CURLM_OK). First call initializes some curl
internal data. Second call initializes resolver thread using
init_resolve_thread. The third call to curl_multi_perform should call
Curl_wait_for_resolv, _but_ I do not call curl_multi_perform for the
third time. I delete handles using cleanup function. I think the
problem is that cleanup functions do not call Curl_wait_resolve, but
it is only place in the libcurl code (I searched) where resolver
thread is terminated using WaitForSingleObject and CloseHandle.

-- 
Best regards,
 Igor Polyakov                            mailto:ipolyakov_at_issart.com
Received on 2005-08-22