You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Devi Krishna <de...@gmail.com> on 2007/02/05 21:44:26 UTC

Regarding graceful restart

Hi Apache Gurus,

 I am seeing the following issue when I sent a graceful restart signal to
httpd [run with proxy enabled]

 Processes on receiving SIGUSR1 seems to send a GET / HTTP/1.0 to the httpd
itself.
 This seems to be a dummy request that each process is trying to send

127.0.0.1 [05/Feb/2007:13:35:25 +0000] "GET / HTTP/1.0" 400 284
127.0.0.1 [05/Feb/2007:13:35:25 +0000] "GET / HTTP/1.0" 400 284
127.0.0.1 [05/Feb/2007:13:35:25 +0000] "GET / HTTP/1.0" 400 284
127.0.0.1 [05/Feb/2007:13:35:25 +0000] "GET / HTTP/1.0" 400 284
127.0.0.1 [05/Feb/2007:13:35:25 +0000] "GET / HTTP/1.0" 400 284


Wondering if this is a known issue, and if there is any solution for it.

I saw recent bug report regarding strange behaviour of mod_ssl on graceful
restart, but in my case, I dont have mod_ssl enabled.

Initially I saw this issue even when processes are in LISTEN state and
sigusr1 is sent.
I put in the following fix and that worked.

File : httpd/server/mpm/prefork/prefork.c
Function :child_main

    +   if (ap_mpm_pod_check(pod) == APR_SUCCESS) { /* selected as idle? */
    +      ap_log_error(APLOG_MARK, APLOG_ERR, status, ap_server_conf,
    +          "Dont process connection as graceful restart received from
pod");
    +     break;
    +  }
    +   if (die_now)  {
    +       ap_log_error(APLOG_MARK, APLOG_ERR, status, ap_server_conf,
    +            "Dont process connection as graceful restart received");
    +       break;
     + }

       current_conn = ap_run_create_connection(ptrans, ap_server_conf, csd,
my_child_num, sbh, bucket_alloc);
       if (current_conn) {
           ap_process_connection(current_conn, csd);
           ap_lingering_close(current_conn);
       }


However, for connections in ESTABLISHED state and other TCP states,  I still
see this issue.

Your inputs would be of great help!

Thanks & Regards
Devi

Re: Regarding graceful restart

Posted by Devi Krishna <de...@gmail.com>.
Hi Ruediger,

Thats exactly what I was looking for ! Thanks so much!!!

Thanks & Regards
Devi

On 2/10/07, Ruediger Pluem <rp...@apache.org> wrote:
>
> Please have a look at
>
> dummy_connection in mpm_common.c
>
> Regards
>
> Rüdiger
>
>
> On 02/10/2007 05:15 AM, Devi Krishna wrote:
> > Hi Folks,   Thanks for the replies.
> > What seems to be happening in my case , is when I send a graceful
> > restart to
> > apache, I get the following messages in the access log
> >
> >
> > 127.0.0.1 [05/Feb/2007:13:35:25 +0000] "GET / HTTP/1.0" 400 284
> > 127.0.0.1 [05/Feb/2007:13:35:25 +0000] "GET / HTTP/1.0" 400 284
> > 127.0.0.1 [05/Feb/2007:13:35:25 +0000] "GET / HTTP/1.0" 400 284
> > 127.0.0.1 [05/Feb/2007:13:35:25 +0000] "GET / HTTP/1.0" 400 284
> > 127.0.0.1 [05/Feb/2007:13:35:25 +0000] "GET / HTTP/1.0" 400 284
> >
> > I am trying to find the root cause of what cause this request when we do
> > graceful restart.
> >
> > I have been digging around for some days but not able to find out which
> > code
> > is causing this.
> >
> > Any cluse ?
> >
> > Thanks & Regards
> > Devi
> >
> >
> >
> > On 2/9/07, Plüm, Rüdiger, VF EITO <ru...@vodafone.com> wrote:
> >
> >>
> >>
> >>
> >> > -----Ursprüngliche Nachricht-----
> >> > Von: Henrik Nordstrom
> >> > Gesendet: Freitag, 9. Februar 2007 16:33
> >> > An: dev@httpd.apache.org
> >> > Betreff: Re: Regarding graceful restart
> >> >
> >> >
> >> > tor 2007-02-08 klockan 17:15 -0800 skrev Devi Krishna:
> >> > > Hi,
> >> > >
> >> > >  Resending this mail, just in case anyone would have
> >> > > suggestions/inputs as how to fix this for connections that
> >> > are in the
> >> > > ESTABLISHED state or FIN state or any other TCP state other than
> >> > > LISTEN
> >> >
> >> > Maybe change the "wake up call" to just connect briefly
> >> > without actually
> >> > sending a full HTTP request? This should be sufficient to wake up any
> >> > processes sleeping in accept() and will not cause anything to get
> >> > processed..
> >>
> >> Not if BSD accept filters are in place. In this case the kernel waits
> >> until it
> >> sees a HTTP request until it wakes up the process.
> >> And on Linux with TCP_DEFER_ACCEPT enabled you need to sent a least one
> >> byte of data.
> >>
> >> Regards
> >>
> >> Rüdiger
> >>
> >>
> >
> >
>

Re: Regarding graceful restart

Posted by Ruediger Pluem <rp...@apache.org>.
Please have a look at

dummy_connection in mpm_common.c

Regards

Rüdiger


On 02/10/2007 05:15 AM, Devi Krishna wrote:
> Hi Folks,   Thanks for the replies.
> What seems to be happening in my case , is when I send a graceful
> restart to
> apache, I get the following messages in the access log
> 
> 
> 127.0.0.1 [05/Feb/2007:13:35:25 +0000] "GET / HTTP/1.0" 400 284
> 127.0.0.1 [05/Feb/2007:13:35:25 +0000] "GET / HTTP/1.0" 400 284
> 127.0.0.1 [05/Feb/2007:13:35:25 +0000] "GET / HTTP/1.0" 400 284
> 127.0.0.1 [05/Feb/2007:13:35:25 +0000] "GET / HTTP/1.0" 400 284
> 127.0.0.1 [05/Feb/2007:13:35:25 +0000] "GET / HTTP/1.0" 400 284
> 
> I am trying to find the root cause of what cause this request when we do
> graceful restart.
> 
> I have been digging around for some days but not able to find out which
> code
> is causing this.
> 
> Any cluse ?
> 
> Thanks & Regards
> Devi
> 
> 
> 
> On 2/9/07, Plüm, Rüdiger, VF EITO <ru...@vodafone.com> wrote:
> 
>>
>>
>>
>> > -----Ursprüngliche Nachricht-----
>> > Von: Henrik Nordstrom
>> > Gesendet: Freitag, 9. Februar 2007 16:33
>> > An: dev@httpd.apache.org
>> > Betreff: Re: Regarding graceful restart
>> >
>> >
>> > tor 2007-02-08 klockan 17:15 -0800 skrev Devi Krishna:
>> > > Hi,
>> > >
>> > >  Resending this mail, just in case anyone would have
>> > > suggestions/inputs as how to fix this for connections that
>> > are in the
>> > > ESTABLISHED state or FIN state or any other TCP state other than
>> > > LISTEN
>> >
>> > Maybe change the "wake up call" to just connect briefly
>> > without actually
>> > sending a full HTTP request? This should be sufficient to wake up any
>> > processes sleeping in accept() and will not cause anything to get
>> > processed..
>>
>> Not if BSD accept filters are in place. In this case the kernel waits
>> until it
>> sees a HTTP request until it wakes up the process.
>> And on Linux with TCP_DEFER_ACCEPT enabled you need to sent a least one
>> byte of data.
>>
>> Regards
>>
>> Rüdiger
>>
>>
> 
> 

Re: Regarding graceful restart

Posted by Devi Krishna <de...@gmail.com>.
Hi Folks,   Thanks for the replies.
What seems to be happening in my case , is when I send a graceful restart to
apache, I get the following messages in the access log


127.0.0.1 [05/Feb/2007:13:35:25 +0000] "GET / HTTP/1.0" 400 284
127.0.0.1 [05/Feb/2007:13:35:25 +0000] "GET / HTTP/1.0" 400 284
127.0.0.1 [05/Feb/2007:13:35:25 +0000] "GET / HTTP/1.0" 400 284
127.0.0.1 [05/Feb/2007:13:35:25 +0000] "GET / HTTP/1.0" 400 284
127.0.0.1 [05/Feb/2007:13:35:25 +0000] "GET / HTTP/1.0" 400 284

I am trying to find the root cause of what cause this request when we do
graceful restart.

I have been digging around for some days but not able to find out which code
is causing this.

Any cluse ?

Thanks & Regards
Devi



On 2/9/07, Plüm, Rüdiger, VF EITO <ru...@vodafone.com> wrote:
>
>
>
> > -----Ursprüngliche Nachricht-----
> > Von: Henrik Nordstrom
> > Gesendet: Freitag, 9. Februar 2007 16:33
> > An: dev@httpd.apache.org
> > Betreff: Re: Regarding graceful restart
> >
> >
> > tor 2007-02-08 klockan 17:15 -0800 skrev Devi Krishna:
> > > Hi,
> > >
> > >  Resending this mail, just in case anyone would have
> > > suggestions/inputs as how to fix this for connections that
> > are in the
> > > ESTABLISHED state or FIN state or any other TCP state other than
> > > LISTEN
> >
> > Maybe change the "wake up call" to just connect briefly
> > without actually
> > sending a full HTTP request? This should be sufficient to wake up any
> > processes sleeping in accept() and will not cause anything to get
> > processed..
>
> Not if BSD accept filters are in place. In this case the kernel waits
> until it
> sees a HTTP request until it wakes up the process.
> And on Linux with TCP_DEFER_ACCEPT enabled you need to sent a least one
> byte of data.
>
> Regards
>
> Rüdiger
>
>

Re: Regarding graceful restart

Posted by Henrik Nordstrom <he...@henriknordstrom.net>.
fre 2007-02-09 klockan 18:34 +0100 skrev Plüm, Rüdiger, VF EITO:

> Not if BSD accept filters are in place. In this case the kernel waits until it
> sees a HTTP request until it wakes up the process.
> And on Linux with TCP_DEFER_ACCEPT enabled you need to sent a least one byte of data.

So send two blank lines. Should satisfy both..

Regards
Henrik

Re: Regarding graceful restart

Posted by Plüm, Rüdiger, VF EITO <ru...@vodafone.com>.

> -----Ursprüngliche Nachricht-----
> Von: Henrik Nordstrom 
> Gesendet: Freitag, 9. Februar 2007 16:33
> An: dev@httpd.apache.org
> Betreff: Re: Regarding graceful restart
> 
> 
> tor 2007-02-08 klockan 17:15 -0800 skrev Devi Krishna:
> > Hi, 
> > 
> >  Resending this mail, just in case anyone would have
> > suggestions/inputs as how to fix this for connections that 
> are in the
> > ESTABLISHED state or FIN state or any other TCP state other than
> > LISTEN
> 
> Maybe change the "wake up call" to just connect briefly 
> without actually
> sending a full HTTP request? This should be sufficient to wake up any
> processes sleeping in accept() and will not cause anything to get
> processed..

Not if BSD accept filters are in place. In this case the kernel waits until it
sees a HTTP request until it wakes up the process.
And on Linux with TCP_DEFER_ACCEPT enabled you need to sent a least one byte of data.

Regards

Rüdiger


Re: Regarding graceful restart

Posted by Henrik Nordstrom <he...@henriknordstrom.net>.
tor 2007-02-08 klockan 17:15 -0800 skrev Devi Krishna:
> Hi, 
> 
>  Resending this mail, just in case anyone would have
> suggestions/inputs as how to fix this for connections that are in the
> ESTABLISHED state or FIN state or any other TCP state other than
> LISTEN

Maybe change the "wake up call" to just connect briefly without actually
sending a full HTTP request? This should be sufficient to wake up any
processes sleeping in accept() and will not cause anything to get
processed..

But I am not sure I understand the original problem so I may be
completely off here..

Regards
Henrik

Re: Regarding graceful restart

Posted by Devi Krishna <de...@gmail.com>.
Hi,

 Resending this mail, just in case anyone would have suggestions/inputs as
how to fix this for connections that are in the ESTABLISHED state or FIN
state or any other TCP state other than LISTEN

Thanks & Regards
Devi

On 2/5/07, Devi Krishna <de...@gmail.com> wrote:
>
> Hi Apache Gurus,
>
>  I am seeing the following issue when I sent a graceful restart signal to
> httpd [run with proxy enabled]
>
>  Processes on receiving SIGUSR1 seems to send a GET / HTTP/1.0 to the
> httpd
> itself.
>  This seems to be a dummy request that each process is trying to send
>
> 127.0.0.1 [05/Feb/2007:13:35:25 +0000] "GET / HTTP/1.0" 400 284
> 127.0.0.1 [05/Feb/2007:13:35:25 +0000] "GET / HTTP/1.0" 400 284
> 127.0.0.1 [05/Feb/2007:13:35:25 +0000] "GET / HTTP/1.0" 400 284
> 127.0.0.1 [05/Feb/2007:13:35:25 +0000] "GET / HTTP/1.0" 400 284
> 127.0.0.1 [05/Feb/2007:13:35:25 +0000] "GET / HTTP/1.0" 400 284
>
>
> Wondering if this is a known issue, and if there is any solution for it.
>
> I saw recent bug report regarding strange behaviour of mod_ssl on graceful
> restart, but in my case, I dont have mod_ssl enabled.
>
> Initially I saw this issue even when processes are in LISTEN state and
> sigusr1 is sent.
> I put in the following fix and that worked.
>
> File : httpd/server/mpm/prefork/prefork.c
> Function :child_main
>
>     +   if (ap_mpm_pod_check(pod) == APR_SUCCESS) { /* selected as idle?
> */
>     +      ap_log_error(APLOG_MARK, APLOG_ERR, status, ap_server_conf,
>     +          "Dont process connection as graceful restart received from
> pod");
>     +     break;
>     +  }
>     +   if (die_now)  {
>     +       ap_log_error(APLOG_MARK, APLOG_ERR, status, ap_server_conf,
>     +            "Dont process connection as graceful restart received");
>     +       break;
>      + }
>
>        current_conn = ap_run_create_connection(ptrans, ap_server_conf,
> csd,
> my_child_num, sbh, bucket_alloc);
>        if (current_conn) {
>            ap_process_connection(current_conn, csd);
>            ap_lingering_close(current_conn);
>        }
>
>
> However, for connections in ESTABLISHED state and other TCP states,  I
> still
> see this issue.
>
> Your inputs would be of great help!
>
> Thanks & Regards
> Devi
>

Re: Regarding graceful restart

Posted by Devi Krishna <de...@gmail.com>.
Hi Sander

 Thanks for the quick response !  However, I am surprised that when it
returns from accept, why would accept return a valid socket id and not -1 ?

Thanks & Regards
Devi

On 2/5/07, Sander Temme <sc...@apache.org> wrote:
>
>
> On Feb 5, 2007, at 12:44 PM, Devi Krishna wrote:
>
> > Wondering if this is a known issue, and if there is any solution
> > for it.
>
> Not having written the code, I think the Pipe Of Death (POD) is a
> mechanism for the server to draw the attention of workers that are
> sitting in accept().  Receiving a request causes them to return from
> accept() and become aware of the restart or shutdown signal.
>
> S.
>
> --
> sctemme@apache.org            http://www.temme.net/sander/
> PGP FP: 51B4 8727 466A 0BC3 69F4  B7B8 B2BE BC40 1529 24AF
>
>
>
>
>

Re: Regarding graceful restart

Posted by Sander Temme <sc...@apache.org>.
On Feb 5, 2007, at 12:44 PM, Devi Krishna wrote:

> Wondering if this is a known issue, and if there is any solution  
> for it.

Not having written the code, I think the Pipe Of Death (POD) is a  
mechanism for the server to draw the attention of workers that are  
sitting in accept().  Receiving a request causes them to return from  
accept() and become aware of the restart or shutdown signal.

S.

-- 
sctemme@apache.org            http://www.temme.net/sander/
PGP FP: 51B4 8727 466A 0BC3 69F4  B7B8 B2BE BC40 1529 24AF