Memory leak (Re: some linux tuning)

From: Stephen R. van den Berg <[email protected]>
Date: Wed, 30 Jun 1999 09:50:29 +0200

Jeff Barrow wrote:
>I'm not sure that's much better... now the process dies when it gets
>invalid requests. (Or is it a memory problem on our system? signal 11...)

>Jun 30 06:22:54 wwwcache squid[3733]: parseHttpRequest: Unsupported method
>'duh^M ^M '
>Jun 30 06:22:54 wwwcache squid[3733]: clientReadRequest: FD 16 Invalid
>Request
>Jun 30 06:22:54 wwwcache squid[3733]: ctx: enter level 0:
>'error:unsupported-request-method'
>Jun 30 06:22:54 wwwcache squid[3713]: Squid Parent: child process 3733
>exited due to signal 11

That's after applying the patch I supplied?
Hmmm..., it seems I was a bit too eager to patch it there. Closer
investigation reveals that inbuf *is* being released most of the
time by the calling routine. As far as I can tell, there are still
two leaks left, but they only occur if you have IPF_TRANSPARENT turned
on.

Try reversing the previous patch, and applying the following:

diff -U 2 -b -B -p -r -d --horizon-lines=2 -X /usr/local/etc/xdiff squid-2.2.STABLE3/src/client_side.c squid-B2/src/client_side.c
--- squid-2.2.STABLE3/src/client_side.c Mon May 10 18:00:40 1999
+++ squid-B2/src/client_side.c Wed Jun 30 09:39:19 1999
@@ -2073,5 +2123,6 @@ parseHttpRequest(ConnStateData * conn, m
                 debug(50, 1) ("parseHttpRequest: NAT open failed: %s\n",
                     xstrerror());
- return parseHttpRequestAbort(conn, "error:nat-open-failed");
+ http = parseHttpRequestAbort(conn, "error:nat-open-failed");
+ goto ret;
             }
             if (ioctl(natfd, SIOCGNATL, &natLookup) < 0) {
@@ -2080,5 +2131,6 @@ parseHttpRequest(ConnStateData * conn, m
                     close(natfd);
                     natfd = -1;
- return parseHttpRequestAbort(conn, "error:nat-lookup-failed");
+ http = parseHttpRequestAbort(conn, "error:nat-lookup-failed");
+ goto ret;
                 } else
                     snprintf(http->uri, url_sz, "http://%s:%d%s",
@@ -2119,6 +2171,7 @@ parseHttpRequest(ConnStateData * conn, m
     if (free_request)
         safe_free(url);
- xfree(inbuf);
     *status = 1;
+ret:
+ xfree(inbuf);
     return http;
 }

-- 
Sincerely,                                                          srb@cuci.nl
           Stephen R. van den Berg (AKA BuGless).
"My name is Smith, the P is not pronounced."
Received on Wed Jun 30 1999 - 01:42:55 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:47:03 MST