You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "William A. Rowe, Jr." <wr...@rowe-clan.net> on 2005/06/27 21:00:01 UTC

Re: svn commit: r202027 - in /httpd/httpd/trunk: CHANGES server/mpm_common.c

Do we need an entire request?  Wouldn't a 'null request' be faster?

At 01:40 PM 6/27/2005, pquerna@apache.org wrote:
>Author: pquerna
>Date: Mon Jun 27 11:40:56 2005
>New Revision: 202027
>
>URL: http://svn.apache.org/viewcvs?rev=202027&view=rev
>Log:
>*) server/mpm_common.c: Send a simple HTTP 1.0 request to every listener socket, instead of just closing the socket.  This fixes shutdown of the Worker MPM on FreeBSD, when Accept Filters are enabled.
>
>In the future, we need a method to send a simple request for all protocols.  Currently this is very specific to HTTP and FreeBSD's Accept Filter.
>
>Modified:
>    httpd/httpd/trunk/CHANGES
>    httpd/httpd/trunk/server/mpm_common.c
>
>Modified: httpd/httpd/trunk/CHANGES
>URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/CHANGES?rev=202027&r1=202026&r2=202027&view=diff
>==============================================================================
>--- httpd/httpd/trunk/CHANGES (original)
>+++ httpd/httpd/trunk/CHANGES Mon Jun 27 11:40:56 2005
>@@ -1,6 +1,10 @@
> Changes with Apache 2.1.7
>   [Remove entries to the current 2.0 section below, when backported]
> 
>+  *) Fix shutdown for the Worker MPM when an Accept Filter is used. Instead of 
>+     just closing the socket, a HTTP request is made, to make sure the child is 
>+     always awakened. [Paul Querna]
>+
> Changes with Apache 2.1.6
> 
>   *) Fix htdbm password validation for records which included comments.
>
>Modified: httpd/httpd/trunk/server/mpm_common.c
>URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/server/mpm_common.c?rev=202027&r1=202026&r2=202027&view=diff
>==============================================================================
>--- httpd/httpd/trunk/server/mpm_common.c (original)
>+++ httpd/httpd/trunk/server/mpm_common.c Mon Jun 27 11:40:56 2005
>@@ -546,6 +546,7 @@
>  */
> static apr_status_t dummy_connection(ap_pod_t *pod)
> {
>+    const char* srequest = "GET / HTTP/1.0\r\n\r\n";
>     apr_status_t rv;
>     apr_socket_t *sock;
>     apr_pool_t *p;
>@@ -596,6 +597,16 @@
>                      "connect to listener on %pI", ap_listeners->bind_addr);
>     }
> 
>+    /* Since some operating systems support buffering of data or entire 
>+     * requests in the kernel, we send a simple request, to make sure 
>+     * the server pops out of a blocking accept(). 
>+     */
>+    /* XXX: This is HTTP specific. We should look at the Protocol for each 
>+     * listener, and send the correct type of request to trigger any Accept
>+     * Filters.
>+     */
>+    apr_socket_send(sock, srequest, strlen(srequest));
>+    apr_socket_shutdown(sock, APR_SHUTDOWN_WRITE);
>     apr_socket_close(sock);
>     apr_pool_destroy(p);
> 



Re: svn commit: r202027 - in /httpd/httpd/trunk: CHANGES server/mpm_common.c

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
At 02:26 PM 6/27/2005, Paul Querna wrote:

>It would work, but it doesn't make any difference.  The request is not
>actually served.  The child pops out of accept(), and notices that it
>needs to die.

HUH?  Perhaps true of shutdown, but if graceful works that
way, we are screwed.  Graceful expects all requests to serve
without taking a hiccup.  Once accept()ed, another listening
child doesn't get a chance to play catch.

Bill 


Re: svn commit: r202027 - in /httpd/httpd/trunk: CHANGES server/mpm_common.c

Posted by Paul Querna <ch...@force-elite.com>.
William A. Rowe, Jr. wrote:
> At 02:10 PM 6/27/2005, Paul Querna wrote:
> 
>>William A. Rowe, Jr. wrote:
>>
>>>Do we need an entire request?  Wouldn't a 'null request' be faster?
>>>
>>
>>Define 'null request'.
> 
> 
> Would OPTIONS * HTTP/1.[0|1] be more efficient than an actual
> request?
> 

It would work, but it doesn't make any difference.  The request is not
actually served.  The child pops out of accept(), and notices that it
needs to die.



Re: svn commit: r202027 - in /httpd/httpd/trunk: CHANGES server/mpm_common.c

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
At 02:10 PM 6/27/2005, Paul Querna wrote:
>William A. Rowe, Jr. wrote:
>> Do we need an entire request?  Wouldn't a 'null request' be faster?
>> 
>
>Define 'null request'.

Would OPTIONS * HTTP/1.[0|1] be more efficient than an actual
request?

Bill



Re: svn commit: r202027 - in /httpd/httpd/trunk: CHANGES server/mpm_common.c

Posted by Paul Querna <ch...@force-elite.com>.
William A. Rowe, Jr. wrote:
> Do we need an entire request?  Wouldn't a 'null request' be faster?
> 

Define 'null request'.

We need an entire request to trigger the Accept Filter.

Just opening and closing the socket (old behavior) will not pop a child
out of the Accept() when Accept Filters or TCP_DEFER_ACCEPT are active.

-Paul


> At 01:40 PM 6/27/2005, pquerna@apache.org wrote:
> 
>>Author: pquerna
>>Date: Mon Jun 27 11:40:56 2005
>>New Revision: 202027
>>
>>URL: http://svn.apache.org/viewcvs?rev=202027&view=rev
>>Log:
>>*) server/mpm_common.c: Send a simple HTTP 1.0 request to every listener socket, instead of just closing the socket.  This fixes shutdown of the Worker MPM on FreeBSD, when Accept Filters are enabled.
>>
>>In the future, we need a method to send a simple request for all protocols.  Currently this is very specific to HTTP and FreeBSD's Accept Filter.
>>
>>Modified:
>>   httpd/httpd/trunk/CHANGES
>>   httpd/httpd/trunk/server/mpm_common.c
>>
>>Modified: httpd/httpd/trunk/CHANGES
>>URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/CHANGES?rev=202027&r1=202026&r2=202027&view=diff
>>==============================================================================
>>--- httpd/httpd/trunk/CHANGES (original)
>>+++ httpd/httpd/trunk/CHANGES Mon Jun 27 11:40:56 2005
>>@@ -1,6 +1,10 @@
>>Changes with Apache 2.1.7
>>  [Remove entries to the current 2.0 section below, when backported]
>>
>>+  *) Fix shutdown for the Worker MPM when an Accept Filter is used. Instead of 
>>+     just closing the socket, a HTTP request is made, to make sure the child is 
>>+     always awakened. [Paul Querna]
>>+
>>Changes with Apache 2.1.6
>>
>>  *) Fix htdbm password validation for records which included comments.
>>
>>Modified: httpd/httpd/trunk/server/mpm_common.c
>>URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/server/mpm_common.c?rev=202027&r1=202026&r2=202027&view=diff
>>==============================================================================
>>--- httpd/httpd/trunk/server/mpm_common.c (original)
>>+++ httpd/httpd/trunk/server/mpm_common.c Mon Jun 27 11:40:56 2005
>>@@ -546,6 +546,7 @@
>> */
>>static apr_status_t dummy_connection(ap_pod_t *pod)
>>{
>>+    const char* srequest = "GET / HTTP/1.0\r\n\r\n";
>>    apr_status_t rv;
>>    apr_socket_t *sock;
>>    apr_pool_t *p;
>>@@ -596,6 +597,16 @@
>>                     "connect to listener on %pI", ap_listeners->bind_addr);
>>    }
>>
>>+    /* Since some operating systems support buffering of data or entire 
>>+     * requests in the kernel, we send a simple request, to make sure 
>>+     * the server pops out of a blocking accept(). 
>>+     */
>>+    /* XXX: This is HTTP specific. We should look at the Protocol for each 
>>+     * listener, and send the correct type of request to trigger any Accept
>>+     * Filters.
>>+     */
>>+    apr_socket_send(sock, srequest, strlen(srequest));
>>+    apr_socket_shutdown(sock, APR_SHUTDOWN_WRITE);
>>    apr_socket_close(sock);
>>    apr_pool_destroy(p);
>>
> 
>