You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ian Holsman <ia...@cnet.com> on 2001/11/28 22:16:26 UTC

[PATCH] listen.c -- fix restart SEGV --please comment/commit

I don't know why this is happening now.

but when I do a restart (with a standard config) it core dumps
here is my proposed fix.. it appears to work for me.
but this is not my area so I'm posting rather than patching.

..Ian

Index: server/listen.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/listen.c,v
retrieving revision 1.64
diff -u -r1.64 listen.c
--- server/listen.c     2001/11/13 22:42:38     1.64
+++ server/listen.c     2001/11/28 20:31:02
@@ -237,16 +237,18 @@
      /* see if we've got an old listener for this address:port */
      for (walk = &old_listeners; *walk; walk = &(*walk)->next) {
          sa = (*walk)->bind_addr;
-        apr_sockaddr_port_get(&oldport, sa);
-       apr_sockaddr_ip_get(&oldaddr, sa);
-       if (!strcmp(oldaddr, addr) && port == oldport) {
-           /* re-use existing record */
-           new = *walk;
-           *walk = new->next;
-           new->next = ap_listeners;
-           ap_listeners = new;
-           return;
-       }
+        if (sa) {
+            apr_sockaddr_port_get(&oldport, sa);
+            apr_sockaddr_ip_get(&oldaddr, sa);
+            if (!strcmp(oldaddr, addr) && port == oldport) {
+                /* re-use existing record */
+                new = *walk;
+                *walk = new->next;
+                new->next = ap_listeners;
+                ap_listeners = new;
+                return;
+            }
+        }
      }

      /* this has to survive restarts */



Re: [PATCH] listen.c -- fix restart SEGV --please comment/commit

Posted by Aaron Bannert <aa...@clove.org>.
On Wed, Nov 28, 2001 at 01:16:26PM -0800, Ian Holsman wrote:
> I don't know why this is happening now.
> 
> but when I do a restart (with a standard config) it core dumps
> here is my proposed fix.. it appears to work for me.
> but this is not my area so I'm posting rather than patching.

I'm still seeing the SEGV after applying this patch, although it does
not happen as often. Another clue is that it only happens for me
under worker and not prefork. Here's a stack trace:

#0  0xdfb5564d in apr_sockaddr_port_get (port=0x8047a6a, sockaddr=0x63617061)
    at ../unix/sa_common.c:132
#1  0x80bba15 in alloc_listener (process=0x8106a9c, addr=0x80e80c3 "::", 
    port=80) at listen.c:241
#2  0x80bbdba in ap_set_listener (cmd=0x8047b90, dummy=0x0, ips=0x8158f1c "80")
    at listen.c:365
#3  0x80b0637 in invoke_cmd (cmd=0x80e587c, parms=0x8047b90, mconfig=0x0, 
    args=0x8155526 "") at config.c:660
#4  0x80b14b9 in ap_walk_config_sub (current=0x8155504, parms=0x8047b90, 
    section_vector=0x810c724) at config.c:1006
#5  0x80b1551 in ap_walk_config (current=0x8155504, parms=0x8047b90, 
    section_vector=0x810c724) at config.c:1043
#6  0x80b2082 in ap_process_config_tree (s=0x810b6dc, conftree=0x81509bc, 
    p=0x8108a3c, ptemp=0x814cd6c) at config.c:1457
#7  0x80b48f0 in main (argc=1, argv=0x8047c58) at main.c:426

-aaron

Re: [PATCH] listen.c -- fix restart SEGV --please comment/commit

Posted by Ian Holsman <ia...@cnet.com>.
Aaron Bannert wrote:

> Subject:
> 
> Re: [PATCH] listen.c -- fix restart SEGV --please comment/commit
> From:
> 
> Aaron Bannert <aa...@clove.org>
> Date:
> 
> Wed, 28 Nov 2001 13:28:33 -0800
> 
> To:
> 
> dev@httpd.apache.org

> p.s. for some reason I can never cleanly apply patches that are sent
> through your mailer. Is it somehow munging the tabs? Can someone enlighten
> me on this? (I'm just doing `patch -p0 < ~/ian.segv.patch` and it rejects
> the whole thing.)
> 
> -aaron
> 


I'ts the latest mozilla nightly build ;(
but sometimes I use evolution ..
the patch was cut/pasted from VNC so it could be that
(I attached it this time)

Re: [PATCH] listen.c -- fix restart SEGV --please comment/commit

Posted by Aaron Bannert <aa...@clove.org>.
On Wed, Nov 28, 2001 at 01:16:26PM -0800, Ian Holsman wrote:
> I don't know why this is happening now.
> 
> but when I do a restart (with a standard config) it core dumps
> here is my proposed fix.. it appears to work for me.
> but this is not my area so I'm posting rather than patching.

I don't recall if I ever reported this to the list, but at one point I
remember seeing the same thing under very specific circumstances: It
would only happen when I was running as root on solaris, and like you
said, during a restart.

I'm rebuilding with this patch and I'll report back here shortly.

-aaron

> Index: server/listen.c
> ===================================================================
> RCS file: /home/cvs/httpd-2.0/server/listen.c,v
> retrieving revision 1.64
> diff -u -r1.64 listen.c
> --- server/listen.c     2001/11/13 22:42:38     1.64
> +++ server/listen.c     2001/11/28 20:31:02
...

p.s. for some reason I can never cleanly apply patches that are sent
through your mailer. Is it somehow munging the tabs? Can someone enlighten
me on this? (I'm just doing `patch -p0 < ~/ian.segv.patch` and it rejects
the whole thing.)

-aaron