You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Yann Ylavic <yl...@gmail.com> on 2014/04/30 12:54:27 UTC

Fwd: apr_socket_opt_set always sets TCP_DEFER_ACCEPT to 1 (was @apr)

---------- Forwarded message ----------
From: Yann Ylavic <yl...@gmail.com>
Date: Wed, Apr 30, 2014 at 11:59 AM
Subject: Re: apr_socket_opt_set always sets TCP_DEFER_ACCEPT to 1
To: APR Developer List <de...@apr.apache.org>

On Tue, Apr 29, 2014 at 5:41 PM, Jim Jagielski <ji...@jagunet.com> wrote:
>
> On Apr 22, 2014, at 9:43 AM, Brian J. France <br...@brianfrance.com> wrote:
>>
>> For some reason I completely missed that.  APR is fine, but httpd needs updated as it is hard coded to 1:
>>
>>  rv = apr_socket_opt_set(s, APR_TCP_DEFER_ACCEPT, 1);
>>
>> Will move to the httpd list.
>
>
> Did I miss this on dev@httpd?

I seems that httpd trunk and 2.4.x use "apr_socket_opt_set(s,
APR_TCP_DEFER_ACCEPT, 30);" whereas 2.2.x uses a value of 1.

This come from PR
http://issues.apache.org/bugzilla/show_bug.cgi?id=41270, commit
http://svn.apache.org/viewvc?view=revision&revision=501364, which
since then has been forked to 2.4.x, and never merged in 2.2.x.

Linux (code and mostly comment) is quite clear on the setsockopt() value.
In master/net/ipv4/tcp.c::do_tcp_setsockopt() :
    case TCP_DEFER_ACCEPT:
    /* Translate value in seconds to number of retransmits */
    icsk->icsk_accept_queue.rskq_defer_accept =
        secs_to_retrans(val, TCP_TIMEOUT_INIT / HZ,
                        TCP_RTO_MAX / HZ);
    break;

One second is too low imo (cf. PR above).

Re: apr_socket_opt_set always sets TCP_DEFER_ACCEPT to 1 (was @apr)

Posted by Yann Ylavic <yl...@gmail.com>.
On Wed, Apr 30, 2014 at 3:16 PM, Brian J. France <br...@brianfrance.com> wrote:
>
> On Apr 30, 2014, at 6:54 AM, Yann Ylavic <yl...@gmail.com> wrote:
>
>> One second is too low imo (cf. PR above).
>
> Yes, 1 is way to low, even 60 doesn't help us with the RHEL 6 kernel bug.
>
> I am trying to get time to work on a patch that would allow something like this:
>
>   AcceptFilter data:60
>
> for 2.2.x.  That is the only way I can see to allow tweaking the time and staying binary compatible with 2.2.x.

Good idea, that could be so in trunk/2.4.x too (2.4.x has the same
constraints), no?

I'd suggest the name "defer" rather than "data" though.

Thanks,
Yann.

Re: apr_socket_opt_set always sets TCP_DEFER_ACCEPT to 1 (was @apr)

Posted by "Brian J. France" <br...@brianfrance.com>.
On Apr 30, 2014, at 6:54 AM, Yann Ylavic <yl...@gmail.com> wrote:

> ---------- Forwarded message ----------
> From: Yann Ylavic <yl...@gmail.com>
> Date: Wed, Apr 30, 2014 at 11:59 AM
> Subject: Re: apr_socket_opt_set always sets TCP_DEFER_ACCEPT to 1
> To: APR Developer List <de...@apr.apache.org>
> 
> On Tue, Apr 29, 2014 at 5:41 PM, Jim Jagielski <ji...@jagunet.com> wrote:
>> 
>> On Apr 22, 2014, at 9:43 AM, Brian J. France <br...@brianfrance.com> wrote:
>>> 
>>> For some reason I completely missed that.  APR is fine, but httpd needs updated as it is hard coded to 1:
>>> 
>>> rv = apr_socket_opt_set(s, APR_TCP_DEFER_ACCEPT, 1);
>>> 
>>> Will move to the httpd list.
>> 
>> 
>> Did I miss this on dev@httpd?
> 
> I seems that httpd trunk and 2.4.x use "apr_socket_opt_set(s,
> APR_TCP_DEFER_ACCEPT, 30);" whereas 2.2.x uses a value of 1.
> 
> This come from PR
> http://issues.apache.org/bugzilla/show_bug.cgi?id=41270, commit
> http://svn.apache.org/viewvc?view=revision&revision=501364, which
> since then has been forked to 2.4.x, and never merged in 2.2.x.
> 
> Linux (code and mostly comment) is quite clear on the setsockopt() value.
> In master/net/ipv4/tcp.c::do_tcp_setsockopt() :
>    case TCP_DEFER_ACCEPT:
>    /* Translate value in seconds to number of retransmits */
>    icsk->icsk_accept_queue.rskq_defer_accept =
>        secs_to_retrans(val, TCP_TIMEOUT_INIT / HZ,
>                        TCP_RTO_MAX / HZ);
>    break;
> 
> One second is too low imo (cf. PR above).


Yes, 1 is way to low, even 60 doesn't help us with the RHEL 6 kernel bug.

I am trying to get time to work on a patch that would allow something like this:

  AcceptFilter data:60

for 2.2.x.  That is the only way I can see to allow tweaking the time and staying binary compatible with 2.2.x.

Original thought was to change AcceptFilter to a AP_INIT_TAKE23 and add a accf_opt_map table, but that would change the conf struct size and break binary compatibility for 2.2.x.

Brian


Re: apr_socket_opt_set always sets TCP_DEFER_ACCEPT to 1 (was @apr)

Posted by Yann Ylavic <yl...@gmail.com>.
On Wed, Apr 30, 2014 at 12:54 PM, Yann Ylavic <yl...@gmail.com> wrote:
> One second is too low imo (cf. PR above).

Backport proposed in 2.2.x/STATUS (r1591248).