cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: [PATCH] Re: libcurl memleak

From: Avery Fay <avery_fay_at_symantec.com>
Date: Fri, 1 Nov 2002 14:20:38 -0500

#if 0'ing out that bit of code seems to break something else. When I set
CURLOPT_INTERFACE to another IP, all connections fail whereas before when
the leaking code was there they all succeeded. Below is a sample backtrace
(note that a low number of threads just cause all connections to fail and a
high number of threads cause all connections to fail + crash):

Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/local/lib/libcurl.so.2...done.
Loaded symbols for /usr/local/lib/libcurl.so.2
Reading symbols from /lib/libpthread.so.0...done.
Loaded symbols for /lib/libpthread.so.0
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /usr/lib/i686/libssl.so.0.9.6...done.
Loaded symbols for /usr/lib/i686/libssl.so.0.9.6
Reading symbols from /usr/lib/i686/libcrypto.so.0.9.6...done.
Loaded symbols for /usr/lib/i686/libcrypto.so.0.9.6
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
#0 0x4003103d in Curl_connecthost (conn=0x8096788, remotehost=0x84b7180,
    port=80, sockconn=0x8096a24, addr=0xb71ff664, connected=0xb71ff717 "")
    at connect.c:600
600 for(rc=-1, aliasindex=0;
(gdb) bt
#0 0x4003103d in Curl_connecthost (conn=0x8096788, remotehost=0x84b7180,
    port=80, sockconn=0x8096a24, addr=0xb71ff664, connected=0xb71ff717 "")
    at connect.c:600
#1 0x400247c8 in ConnectPlease (conn=0x8096788, hostaddr=0x84b7180,
    connected=0x312e3532 <Address 0x312e3532 out of bounds>) at url.c:1560
#2 0x4002538a in CreateConnection (data=0x84a2298, in_connect=0xb71ff974)
    at url.c:2761
#3 0x4002664a in Curl_connect (data=0x312e3532, in_connect=0xb71ff974)
    at url.c:2800
#4 0x4002ffcf in Curl_perform (data=0x84a2298) at transfer.c:1520
#5 0x4003039c in curl_easy_perform (curl=0x84a2298) at easy.c:245
#6 0x08049f81 in worker_main (nothing=0x0) at worker_thread.c:98
#7 0x40040048 in pthread_start_thread () from /lib/libpthread.so.0
(gdb) quit

Avery Fay

                                                                                                                                                
                      Daniel Stenberg
                      <daniel_at_haxx.se> To: Avery Fay <avery_fay_at_symantec.com>
                      Sent by: cc: libcurl Mailing list <curl-library_at_lists.sourceforge.net>
                      curl-library-admin_at_lists.sour Subject: Re: [PATCH] Re: libcurl memleak
                      ceforge.net
                                                                                                                                                
                                                                                                                                                
                      10/31/2002 08:12 AM
                      Please respond to
                      curl-library
                                                                                                                                                
                                                                                                                                                

On Wed, 30 Oct 2002, Avery Fay wrote:

> This solves the leak in my program. I'm going to go back and try without
> setting CURLOPT_DNS_CACHE_TIMEOUT to 0 to see if I can reproduce the
> crashes.

Goodie. Of course I hope you can't make it appear ever again, but if
there's
still something bad lurking in there we should nail it.

> Also, what is the default for CURLOPT_DNS_USE_GLOBAL_CACHE? I was under
the
> assumption that setting this to 0 would make a separate cache for each
> curl_easy instance. So, I should be safe setting it to 0 in a
multithreaded
> environment.

That is correct. The default is zero and it should be perfectly safe to use
multi-threaded.

--
 Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.
-------------------------------------------------------
This sf.net email is sponsored by: Influence the future
of Java(TM) technology. Join the Java Community
Process(SM) (JCP(SM)) program now.
http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0004en
-------------------------------------------------------
This sf.net email is sponsored by: See the NEW Palm 
Tungsten T handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0001en
Received on 2002-11-01