On 01/04/2018 04:10 PM, cove...@apache.org wrote:
> Author: covener
> Date: Thu Jan  4 15:10:45 2018
> New Revision: 1820098
> 
> URL: http://svn.apache.org/viewvc?rev=1820098&view=rev
> Log:
> Add "AcceptErrorsNonFatal" directive
> 
> This tweaks accept() failure processing by having ap_unixd_accept
> pass more errors up, and having the MPM's check against a macro
> to see if they are in a whitelist of non ENETDOWN/EMFILE kind 
> of potential process-wide errors.
> 
> Default behavior is still to exit.
> 
> 
> Modified:
>     httpd/httpd/trunk/CHANGES
>     httpd/httpd/trunk/docs/manual/mod/mpm_common.xml
>     httpd/httpd/trunk/include/ap_listen.h
>     httpd/httpd/trunk/os/unix/unixd.c
>     httpd/httpd/trunk/server/listen.c
>     httpd/httpd/trunk/server/mpm/event/event.c
>     httpd/httpd/trunk/server/mpm/motorz/motorz.c
>     httpd/httpd/trunk/server/mpm/prefork/prefork.c
>     httpd/httpd/trunk/server/mpm/worker/worker.c
> 

> Modified: httpd/httpd/trunk/server/listen.c
> URL: 
> http://svn.apache.org/viewvc/httpd/httpd/trunk/server/listen.c?rev=1820098&r1=1820097&r2=1820098&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/server/listen.c (original)
> +++ httpd/httpd/trunk/server/listen.c Thu Jan  4 15:10:45 2018

> @@ -1128,6 +1140,14 @@ AP_DECLARE_NONSTD(const char *) ap_set_s
>      return NULL;
>  }
>  
> +AP_DECLARE_NONSTD(const char *) ap_set_accept_errors_nonfatal(cmd_parms *cmd,
> +                                                           void *dummy,
> +                                                           int flag)
> +{
> +   ap_accept_errors_nonfatal = flag;
> +   return NULL;

Shouldn't we check that this is used GLOBAL_ONLY?

ap_check_cmd_context(cmd, GLOBAL_ONLY);


> +}
> +
>  AP_DECLARE_NONSTD(const char *) ap_set_receive_buffer_size(cmd_parms *cmd,
>                                                             void *dummy,
>                                                             const char *arg)
> 

> Modified: httpd/httpd/trunk/server/mpm/prefork/prefork.c
> URL: 
> http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/prefork/prefork.c?rev=1820098&r1=1820097&r2=1820098&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/server/mpm/prefork/prefork.c (original)
> +++ httpd/httpd/trunk/server/mpm/prefork/prefork.c Thu Jan  4 15:10:45 2018
> @@ -600,7 +600,12 @@ static void child_main(int child_num_arg
>              /* resource shortage or should-not-occur occurred */
>              clean_child_exit(APEXIT_CHILDSICK);
>          }
> -        else if (status != APR_SUCCESS) {
> +        else if (ap_accept_error_is_nonfatal(rc)) {

I guess else if is not needed and if is sufficient as clean_child_exit never 
returns.

> +            ap_log_error(APLOG_MARK, APLOG_DEBUG, rc, ap_server_conf,

I guess status should be used instead of rc in the two lines above.

> +                    "accept() on client socket failed");
> +        }
> +
> +        if (status != APR_SUCCESS) {
>              continue;
>          }
>  
> 

Regards

RĂ¼diger

Reply via email to