You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Shail Bhatnagar <sh...@cisco.com> on 2001/08/10 21:39:34 UTC

File descriptor loss on graceful restart

I put the following code fragment in 
server/main.c :

(added code is preceeded by '+' sign)

     ap_run_optional_fn_retrieve();
+    {
+       #include <fcntl.h>
+
+       int fd = open("/tmp", O_RDONLY);
+
+       ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
+                    "Master httpd before ap_mpm_run() : "
+                    "sbrk(0) = %x, fd count = %d\n",
+                    (unsigned int)sbrk(0), fd);
+       close(fd);
+    }
     if (ap_mpm_run(pconf, plog, server_conf)) break;


When I do a graceful restart in a loop, say every 20
seconds (without http traffic), I see that the master 
httpd looses one file descriptor per graceful restart.
I say this on the basis of the ap_log_error() output - 
the fd count just keeps going up.

Is there a  known bug ? This only happens when rotation
of error and/or access log is enabled.

This is httpd-2.0.16 beta code.

Thanks for your time,
Shail

Re: File descriptor loss on graceful restart

Posted by Ryan Bloom <rb...@covalent.net>.
The fix is simple in theory, but it touches a couple of files.  Just look at the
CVS diff's from last night for srclib/apr/memory/unix/apr_pools.c and 
server/listen.c.  This patch will be included in 2.0.24, and I really don't
know when that will roll, but I would like it to be this week sometime.

Ryan


On Monday 13 August 2001 13:35, Shail Bhatnagar wrote:
> Ryan, Since you have already fixed this bug, can you post
> the patch on this email thread. How far are we from 2.0.24
> and would it include this patch ?
>
> Thanks,
> Shail
>
> Ryan Bloom wrote:
> > You are likely to be losing one for each socket.  I keep meaning
> > to fix this bug.
> >
> > Ryan
> >
> > On Friday 10 August 2001 12:39, Shail Bhatnagar wrote:
> > > I put the following code fragment in
> > > server/main.c :
> > >
> > > (added code is preceeded by '+' sign)
> > >
> > >      ap_run_optional_fn_retrieve();
> > > +    {
> > > +       #include <fcntl.h>
> > > +
> > > +       int fd = open("/tmp", O_RDONLY);
> > > +
> > > +       ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0,
> > > NULL, +                    "Master httpd before ap_mpm_run() : "
> > > +                    "sbrk(0) = %x, fd count = %d\n",
> > > +                    (unsigned int)sbrk(0), fd);
> > > +       close(fd);
> > > +    }
> > >      if (ap_mpm_run(pconf, plog, server_conf)) break;
> > >
> > >
> > > When I do a graceful restart in a loop, say every 20
> > > seconds (without http traffic), I see that the master
> > > httpd looses one file descriptor per graceful restart.
> > > I say this on the basis of the ap_log_error() output -
> > > the fd count just keeps going up.
> > >
> > > Is there a  known bug ? This only happens when rotation
> > > of error and/or access log is enabled.
> > >
> > > This is httpd-2.0.16 beta code.
> > >
> > > Thanks for your time,
> > > Shail
> >
> > --
> >
> > ______________________________________________________________
> > Ryan Bloom                              rbb@apache.org
> > Covalent Technologies                   rbb@covalent.net
> > --------------------------------------------------------------

-- 

______________________________________________________________
Ryan Bloom                        	rbb@apache.org
Covalent Technologies			rbb@covalent.net
--------------------------------------------------------------

Re: File descriptor loss on graceful restart

Posted by Shail Bhatnagar <sh...@cisco.com>.
Ryan, Since you have already fixed this bug, can you post
the patch on this email thread. How far are we from 2.0.24
and would it include this patch ?

Thanks,
Shail

Ryan Bloom wrote:
> 
> You are likely to be losing one for each socket.  I keep meaning
> to fix this bug.
> 
> Ryan
> 
> On Friday 10 August 2001 12:39, Shail Bhatnagar wrote:
> > I put the following code fragment in
> > server/main.c :
> >
> > (added code is preceeded by '+' sign)
> >
> >      ap_run_optional_fn_retrieve();
> > +    {
> > +       #include <fcntl.h>
> > +
> > +       int fd = open("/tmp", O_RDONLY);
> > +
> > +       ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
> > +                    "Master httpd before ap_mpm_run() : "
> > +                    "sbrk(0) = %x, fd count = %d\n",
> > +                    (unsigned int)sbrk(0), fd);
> > +       close(fd);
> > +    }
> >      if (ap_mpm_run(pconf, plog, server_conf)) break;
> >
> >
> > When I do a graceful restart in a loop, say every 20
> > seconds (without http traffic), I see that the master
> > httpd looses one file descriptor per graceful restart.
> > I say this on the basis of the ap_log_error() output -
> > the fd count just keeps going up.
> >
> > Is there a  known bug ? This only happens when rotation
> > of error and/or access log is enabled.
> >
> > This is httpd-2.0.16 beta code.
> >
> > Thanks for your time,
> > Shail
> 
> --
> 
> ______________________________________________________________
> Ryan Bloom                              rbb@apache.org
> Covalent Technologies                   rbb@covalent.net
> --------------------------------------------------------------

Re: File descriptor loss on graceful restart

Posted by Ryan Bloom <rb...@covalent.net>.
You are likely to be losing one for each socket.  I keep meaning
to fix this bug.

Ryan

On Friday 10 August 2001 12:39, Shail Bhatnagar wrote:
> I put the following code fragment in
> server/main.c :
>
> (added code is preceeded by '+' sign)
>
>      ap_run_optional_fn_retrieve();
> +    {
> +       #include <fcntl.h>
> +
> +       int fd = open("/tmp", O_RDONLY);
> +
> +       ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
> +                    "Master httpd before ap_mpm_run() : "
> +                    "sbrk(0) = %x, fd count = %d\n",
> +                    (unsigned int)sbrk(0), fd);
> +       close(fd);
> +    }
>      if (ap_mpm_run(pconf, plog, server_conf)) break;
>
>
> When I do a graceful restart in a loop, say every 20
> seconds (without http traffic), I see that the master
> httpd looses one file descriptor per graceful restart.
> I say this on the basis of the ap_log_error() output -
> the fd count just keeps going up.
>
> Is there a  known bug ? This only happens when rotation
> of error and/or access log is enabled.
>
> This is httpd-2.0.16 beta code.
>
> Thanks for your time,
> Shail

-- 

______________________________________________________________
Ryan Bloom                        	rbb@apache.org
Covalent Technologies			rbb@covalent.net
--------------------------------------------------------------

Re: File descriptor loss on graceful restart

Posted by Shail Bhatnagar <sh...@cisco.com>.
Justin, Can you tell me how stable or how good is
httpd 2.0.16 - the one announced in httpd.apache.org.
I know it is a hard question, but do you have some feel
for it.

Thanks,
Shail

Justin Erenkrantz wrote:
> 
> On Fri, Aug 10, 2001 at 09:25:43PM -0400, Shail Bhatnagar wrote:
> > Justin, Thanks for your response. I have'nt checked the latest
> > code yet, but do you remember where the file descriptor loss
> > was ?
> 
> No, but we've changed so much code that we're either bound to have
> fixed it or made it worse.  =)  It's unlikely that the code has
> remained the same.  -- justin

Re: File descriptor loss on graceful restart

Posted by Justin Erenkrantz <je...@ebuilt.com>.
On Fri, Aug 10, 2001 at 09:25:43PM -0400, Shail Bhatnagar wrote:
> Justin, Thanks for your response. I have'nt checked the latest
> code yet, but do you remember where the file descriptor loss
> was ? 

No, but we've changed so much code that we're either bound to have 
fixed it or made it worse.  =)  It's unlikely that the code has
remained the same.  -- justin


Re: File descriptor loss on graceful restart

Posted by Shail Bhatnagar <sh...@cisco.com>.
Justin, Thanks for your response. I have'nt checked the latest
code yet, but do you remember where the file descriptor loss
was ? 
By the way, I misstated in my last email that the descriptor
loss happens only with log rotation. It happens regardless of
log rotation.


Thanks,
Shail


Justin Erenkrantz wrote:
> 
> On Fri, Aug 10, 2001 at 03:39:34PM -0400, Shail Bhatnagar wrote:
> > When I do a graceful restart in a loop, say every 20
> > seconds (without http traffic), I see that the master
> > httpd looses one file descriptor per graceful restart.
> > I say this on the basis of the ap_log_error() output -
> > the fd count just keeps going up.
> >
> > Is there a  known bug ? This only happens when rotation
> > of error and/or access log is enabled.
> >
> > This is httpd-2.0.16 beta code.
> 
> Can you please try the latest CVS or the 2.0.23 alpha (soon to be
> beta?):
> 
> http://dev.apache.org/dist/httpd-2_0_23-alpha.tar.gz
> 
> Lightyears different in terms of the code and bugs fixed.
> -- justin

Re: File descriptor loss on graceful restart

Posted by Justin Erenkrantz <je...@ebuilt.com>.
On Fri, Aug 10, 2001 at 03:39:34PM -0400, Shail Bhatnagar wrote:
> When I do a graceful restart in a loop, say every 20
> seconds (without http traffic), I see that the master 
> httpd looses one file descriptor per graceful restart.
> I say this on the basis of the ap_log_error() output - 
> the fd count just keeps going up.
> 
> Is there a  known bug ? This only happens when rotation
> of error and/or access log is enabled.
> 
> This is httpd-2.0.16 beta code.

Can you please try the latest CVS or the 2.0.23 alpha (soon to be 
beta?):

http://dev.apache.org/dist/httpd-2_0_23-alpha.tar.gz

Lightyears different in terms of the code and bugs fixed.  
-- justin