You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by dr...@apache.org on 2002/01/08 17:30:16 UTC

cvs commit: httpd-2.0/server main.c core.c

dreid       02/01/08 08:30:16

  Modified:    server   main.c core.c
  Log:
  This small patch modifies the log's to use plog instead of pconf.
  Basically pconf is cleared at different times from plog, and this
  has the effect of leaving stderr closed when going into the next
  stage of the config. This also had the effect of allowing FreeBSD
  with threads to create a pipe with stderr's fd at one end, and this
  resulted in problems with the signal polling and high cpu usage.
  
  In addition, move the clearing of plog from main.c to core.c where
  it seems more appropriate.
  
  This solves the first and main problem that FreeBSD has with the
  threaded MPM's.
  
  Revision  Changes    Path
  1.112     +0 -2      httpd-2.0/server/main.c
  
  Index: main.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/main.c,v
  retrieving revision 1.111
  retrieving revision 1.112
  diff -u -r1.111 -r1.112
  --- main.c	18 Dec 2001 20:26:15 -0000	1.111
  +++ main.c	8 Jan 2002 16:30:16 -0000	1.112
  @@ -411,7 +411,6 @@
   	ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Syntax OK\n");
   	destroy_and_exit_process(process, 0);
       }
  -    apr_pool_clear(plog);
       if ( ap_run_open_logs(pconf, plog, ptemp, server_conf) != OK) {
           ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR| APLOG_NOERRNO, 0, NULL, "Unable to open logs\n");
           destroy_and_exit_process(process, 1);
  @@ -443,7 +442,6 @@
           ap_fixup_virtual_hosts(pconf, server_conf);
           ap_fini_vhost_config(pconf, server_conf);
           apr_sort_hooks();
  -	apr_pool_clear(plog);
           if ( ap_run_open_logs(pconf, plog, ptemp, server_conf) != OK) {
               ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR| APLOG_NOERRNO, 0, NULL, "Unable to open logs\n");
               destroy_and_exit_process(process, 1);
  
  
  
  1.127     +2 -1      httpd-2.0/server/core.c
  
  Index: core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/core.c,v
  retrieving revision 1.126
  retrieving revision 1.127
  diff -u -r1.126 -r1.127
  --- core.c	2 Jan 2002 07:56:25 -0000	1.126
  +++ core.c	8 Jan 2002 16:30:16 -0000	1.127
  @@ -3361,7 +3361,8 @@
   
   static int core_open_logs(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
   {
  -    ap_open_logs(s, pconf);
  +    apr_pool_clear(plog);
  +    ap_open_logs(s, plog);
       return OK;  
   }
   
  
  
  

Re: cvs commit: httpd-2.0/server main.c core.c

Posted by David Reid <dr...@jetnet.co.uk>.
> On Tue, Jan 08, 2002 at 04:30:16PM -0000, dreid@apache.org wrote:
> > dreid       02/01/08 08:30:16
> > 
> >   Modified:    server   main.c core.c
> >   Log:
> >   This small patch modifies the log's to use plog instead of pconf.
> >   Basically pconf is cleared at different times from plog, and this
> >   has the effect of leaving stderr closed when going into the next
> >   stage of the config. This also had the effect of allowing FreeBSD
> >   with threads to create a pipe with stderr's fd at one end, and this
> >   resulted in problems with the signal polling and high cpu usage.
> >   
> >   In addition, move the clearing of plog from main.c to core.c where
> >   it seems more appropriate.
> 
> I don't think that moving the clear call is appropriate.  Consider
> that ap_run_open_logs is a hook.  I bet certain third-parties
> (*ahem* Covalent *ahem*) have their own hook into this function to
> override the logs.  So, core_open_logs isn't guaranteed to be the 
> only caller.  I would suggest reverting this section.  As long as the 
> pool is cleared *right* before the hook is called, we should be okay.

Ah, good point.  Shame, it seemed like a neater way of doing it :(

david



Re: cvs commit: httpd-2.0/server main.c core.c

Posted by David Reid <dr...@jetnet.co.uk>.
So, why were we using pconf???

:)

Seems like we've fixed a bug anyways.

david

> On Tuesday 08 January 2002 08:49 am, Justin Erenkrantz wrote:
> > On Tue, Jan 08, 2002 at 04:30:16PM -0000, dreid@apache.org wrote:
> > > dreid       02/01/08 08:30:16
> > >
> > >   Modified:    server   main.c core.c
> > >   Log:
> > >   This small patch modifies the log's to use plog instead of pconf.
> > >   Basically pconf is cleared at different times from plog, and this
> > >   has the effect of leaving stderr closed when going into the next
> > >   stage of the config. This also had the effect of allowing FreeBSD
> > >   with threads to create a pipe with stderr's fd at one end, and this
> > >   resulted in problems with the signal polling and high cpu usage.
> > >
> > >   In addition, move the clearing of plog from main.c to core.c where
> > >   it seems more appropriate.
> >
> > I don't think that moving the clear call is appropriate.  Consider
> > that ap_run_open_logs is a hook.  I bet certain third-parties
> > (*ahem* Covalent *ahem*) have their own hook into this function to
> > override the logs.  So, core_open_logs isn't guaranteed to be the
> > only caller.  I would suggest reverting this section.  As long as the
> > pool is cleared *right* before the hook is called, we should be okay.
> >
> > As for changing core_open_logs to use plog, I think it is the correct
> > change though upon further review.  In fact, if we aren't using plog,
> > I think that is a bug.  =)  (Because then, it isn't the pool where
> > the logs are from!)  -- justin
>
> See:
>
http://www.apachelabs.org/apache-mbox/200010.mbox/<Pine.LNX.4.21.00101405484
30.31875-100000@twinlark.arctic.org>
>
> Just change the ap_run_open_logs call to use plog instead of pconf, and
> that should solve this problem.
>
> Ryan
>
> ______________________________________________________________
> Ryan Bloom rbb@apache.org
> Covalent Technologies rbb@covalent.net
> --------------------------------------------------------------
>


Re: cvs commit: httpd-2.0/server main.c core.c

Posted by Ryan Bloom <rb...@covalent.net>.
On Tuesday 08 January 2002 08:49 am, Justin Erenkrantz wrote:
> On Tue, Jan 08, 2002 at 04:30:16PM -0000, dreid@apache.org wrote:
> > dreid       02/01/08 08:30:16
> > 
> >   Modified:    server   main.c core.c
> >   Log:
> >   This small patch modifies the log's to use plog instead of pconf.
> >   Basically pconf is cleared at different times from plog, and this
> >   has the effect of leaving stderr closed when going into the next
> >   stage of the config. This also had the effect of allowing FreeBSD
> >   with threads to create a pipe with stderr's fd at one end, and this
> >   resulted in problems with the signal polling and high cpu usage.
> >   
> >   In addition, move the clearing of plog from main.c to core.c where
> >   it seems more appropriate.
> 
> I don't think that moving the clear call is appropriate.  Consider
> that ap_run_open_logs is a hook.  I bet certain third-parties
> (*ahem* Covalent *ahem*) have their own hook into this function to
> override the logs.  So, core_open_logs isn't guaranteed to be the 
> only caller.  I would suggest reverting this section.  As long as the 
> pool is cleared *right* before the hook is called, we should be okay.
> 
> As for changing core_open_logs to use plog, I think it is the correct 
> change though upon further review.  In fact, if we aren't using plog,
> I think that is a bug.  =)  (Because then, it isn't the pool where
> the logs are from!)  -- justin

See:
http://www.apachelabs.org/apache-mbox/200010.mbox/<Pi...@twinlark.arctic.org>

Just change the ap_run_open_logs call to use plog instead of pconf, and
that should solve this problem.

Ryan

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

Re: cvs commit: httpd-2.0/server main.c core.c

Posted by Justin Erenkrantz <je...@ebuilt.com>.
On Tue, Jan 08, 2002 at 04:30:16PM -0000, dreid@apache.org wrote:
> dreid       02/01/08 08:30:16
> 
>   Modified:    server   main.c core.c
>   Log:
>   This small patch modifies the log's to use plog instead of pconf.
>   Basically pconf is cleared at different times from plog, and this
>   has the effect of leaving stderr closed when going into the next
>   stage of the config. This also had the effect of allowing FreeBSD
>   with threads to create a pipe with stderr's fd at one end, and this
>   resulted in problems with the signal polling and high cpu usage.
>   
>   In addition, move the clearing of plog from main.c to core.c where
>   it seems more appropriate.

I don't think that moving the clear call is appropriate.  Consider
that ap_run_open_logs is a hook.  I bet certain third-parties
(*ahem* Covalent *ahem*) have their own hook into this function to
override the logs.  So, core_open_logs isn't guaranteed to be the 
only caller.  I would suggest reverting this section.  As long as the 
pool is cleared *right* before the hook is called, we should be okay.

As for changing core_open_logs to use plog, I think it is the correct 
change though upon further review.  In fact, if we aren't using plog,
I think that is a bug.  =)  (Because then, it isn't the pool where
the logs are from!)  -- justin


Re: cvs commit: httpd-2.0/server main.c core.c

Posted by "William A. Rowe, Jr." <wr...@covalent.net>.
From: <dr...@apache.org>
Sent: Tuesday, January 08, 2002 10:30 AM


>   1.127     +2 -1      httpd-2.0/server/core.c
>   
>   Index: core.c
>   ===================================================================
>   RCS file: /home/cvs/httpd-2.0/server/core.c,v
>   retrieving revision 1.126
>   retrieving revision 1.127
>   diff -u -r1.126 -r1.127
>   --- core.c 2 Jan 2002 07:56:25 -0000 1.126
>   +++ core.c 8 Jan 2002 16:30:16 -0000 1.127
>   @@ -3361,7 +3361,8 @@
>    
>    static int core_open_logs(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
>    {
>   -    ap_open_logs(s, pconf);
>   +    apr_pool_clear(plog);
>   +    ap_open_logs(s, plog);
>        return OK;  
>    }

If anyone really objects to this change, it seems like ap_open_logs could accept
both pconf, and plog.  But plog is required to assure they have the correct lifetime,
and the 'pconf only' pool was a bug, IMHO.


Re: cvs commit: httpd-2.0/server main.c core.c

Posted by "William A. Rowe, Jr." <wr...@covalent.net>.
From: <dr...@apache.org>
Sent: Tuesday, January 08, 2002 10:30 AM


>   1.127     +2 -1      httpd-2.0/server/core.c
>   
>   Index: core.c
>   ===================================================================
>   RCS file: /home/cvs/httpd-2.0/server/core.c,v
>   retrieving revision 1.126
>   retrieving revision 1.127
>   diff -u -r1.126 -r1.127
>   --- core.c 2 Jan 2002 07:56:25 -0000 1.126
>   +++ core.c 8 Jan 2002 16:30:16 -0000 1.127
>   @@ -3361,7 +3361,8 @@
>    
>    static int core_open_logs(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
>    {
>   -    ap_open_logs(s, pconf);
>   +    apr_pool_clear(plog);
>   +    ap_open_logs(s, plog);
>        return OK;  
>    }

If anyone really objects to this change, it seems like ap_open_logs could accept
both pconf, and plog.  But plog is required to assure they have the correct lifetime,
and the 'pconf only' pool was a bug, IMHO.