You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2001/07/11 16:48:30 UTC

cvs commit: httpd-2.0/server mpm_common.c

trawick     01/07/11 07:48:28

  Modified:    .        CHANGES
               server   mpm_common.c
  Log:
  Fix an issue with the pod and prefork:
  
  when the parent process wakes up a server process via connect(), use
  an APR timeout on the connect() so that we don't hang for a long time
  if there aren't server processes around to do accept()
  
  Revision  Changes    Path
  1.245     +9 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.244
  retrieving revision 1.245
  diff -u -r1.244 -r1.245
  --- CHANGES	2001/07/11 04:46:59	1.244
  +++ CHANGES	2001/07/11 14:48:08	1.245
  @@ -1,4 +1,13 @@
   Changes with Apache 2.0.21-dev
  +
  +  *) Fix some issues with the pod and prefork: check the pod *after*
  +     processing a connection so that a server processing a time-
  +     consuming request bails out as soon as practical; when the
  +     parent process wakes up a server process via connect(), use an
  +     APR timeout on the connect() so that we don't hang for a long
  +     time if there aren't server processes around to do accept().
  +     [Jeff Trawick, Greg Ames]
  +
     *) Performance improvement to mod_mime.c. find_ct() in mod_mime, 
        spends a lot of time in apr_table_get calls.  Using the default 
        httpd.conf, the tables for languages and charsets are somewhat
  
  
  
  1.55      +27 -3     httpd-2.0/server/mpm_common.c
  
  Index: mpm_common.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm_common.c,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- mpm_common.c	2001/06/11 18:23:21	1.54
  +++ mpm_common.c	2001/07/11 14:48:23	1.55
  @@ -409,9 +409,31 @@
                        "get socket to connect to listener");
           return rv;
       }
  -    rv = apr_connect(sock, sa);    
  +    /* on some platforms (e.g., FreeBSD), the kernel won't accept many
  +     * queued connections before it starts blocking local connects...
  +     * we need to keep from blocking too long and instead return an error,
  +     * because the MPM won't want to hold up a graceful restart for a
  +     * long time
  +     */
  +    rv = apr_setsocketopt(sock, APR_SO_TIMEOUT, 3 * APR_USEC_PER_SEC);
       if (rv != APR_SUCCESS) {
           ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf,
  +                     "set timeout on socket to connect to listener");
  +        return rv;
  +    }
  +    rv = apr_connect(sock, sa);    
  +    if (rv != APR_SUCCESS) {
  +        int log_level = APLOG_WARNING;
  +
  +        if (APR_STATUS_IS_TIMEUP(rv)) {
  +            /* probably some server processes bailed out already and there 
  +             * is nobody around to call accept and clear out the kernel 
  +             * connection queue; usually this is not worth logging
  +             */
  +            log_level = APLOG_DEBUG;
  +        }
  +	
  +        ap_log_error(APLOG_MARK, log_level, rv, ap_server_conf,
                        "connect to listener");
           return rv;
       }
  @@ -423,8 +445,10 @@
   AP_DECLARE(void) ap_mpm_pod_killpg(ap_pod_t *pod, int num)
   {
       int i;
  -    for (i = 0; i < num; i++) {
  -        ap_mpm_pod_signal(pod);
  +    apr_status_t rv = APR_SUCCESS;
  +
  +    for (i = 0; i < num && rv == APR_SUCCESS; i++) {
  +        rv = ap_mpm_pod_signal(pod);
       }
   }
   #endif
  
  
  

Re: cvs commit: httpd-2.0/server mpm_common.c

Posted by rb...@covalent.net.
> >   Modified:    .        CHANGES
> >                server   mpm_common.c
> >   Log:
> >   Fix an issue with the pod and prefork:
> >
> >   when the parent process wakes up a server process via connect(), use
> >   an APR timeout on the connect() so that we don't hang for a long time
> >   if there aren't server processes around to do accept()
>
> At this point, the problem preventing 2_0_20 (prefork) from being used
> on apache.org should be resolved.
>
> I think that prefork should tell ap_mpm_pod_killpg() to kill off
> approx* the right number of servers instead of telling it to kill off
> ap_daemons_limit servers.  When we tell it to kill off too many
> servers,
>
> 1) new generation servers can wake up unnecessarily
> 2) parent may have to wait for the connect timeout in
>    ap_mpm_pod_signal()
>
> Neither of these is a serious problem AFAIK but both are a sort of
> uncleanliness which causes confusion during debugging and/or reviewing
> a syscall trace.
>
> I suspect that Greg Ames will play with this.  I'll be out of contact
> for a week or so and won't be actively contemplated MPM issues :)
>
> *it can never be perfect, as we can have server processes realize they
> need to go away and exit after the parent process decides how many to
> kill...

Great news.  Let's see if we can't get a tag/roll going on Friday then.  I
am NOT saying don't develop and commit from now through Friday.  I am
suggesting that we test this code, and try to tag/roll on Friday.  :-)

Ryan

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


Re: cvs commit: httpd-2.0/server mpm_common.c

Posted by Jeff Trawick <tr...@attglobal.net>.
trawick@apache.org writes:

> trawick     01/07/11 07:48:28
> 
>   Modified:    .        CHANGES
>                server   mpm_common.c
>   Log:
>   Fix an issue with the pod and prefork:
>   
>   when the parent process wakes up a server process via connect(), use
>   an APR timeout on the connect() so that we don't hang for a long time
>   if there aren't server processes around to do accept()

At this point, the problem preventing 2_0_20 (prefork) from being used
on apache.org should be resolved.

I think that prefork should tell ap_mpm_pod_killpg() to kill off
approx* the right number of servers instead of telling it to kill off
ap_daemons_limit servers.  When we tell it to kill off too many
servers,

1) new generation servers can wake up unnecessarily
2) parent may have to wait for the connect timeout in
   ap_mpm_pod_signal()

Neither of these is a serious problem AFAIK but both are a sort of
uncleanliness which causes confusion during debugging and/or reviewing
a syscall trace.

I suspect that Greg Ames will play with this.  I'll be out of contact
for a week or so and won't be actively contemplated MPM issues :)

*it can never be perfect, as we can have server processes realize they
need to go away and exit after the parent process decides how many to
kill...
-- 
Jeff Trawick | trawick@attglobal.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...