NetBSD Problem Report #46458

From www@NetBSD.org  Thu May 17 10:05:02 2012
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 7102363B89C
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 17 May 2012 10:05:02 +0000 (UTC)
Message-Id: <20120517100501.C509763B882@www.NetBSD.org>
Date: Thu, 17 May 2012 10:05:01 +0000 (UTC)
From: ftigeot@wolfpond.org
Reply-To: ftigeot@wolfpond.org
To: gnats-bugs@NetBSD.org
Subject: Apache 2.4 uses TCP_NOPUSH with sendfile(2), breaking it
X-Send-Pr-Version: www-1.0

>Number:         46458
>Category:       pkg
>Synopsis:       Apache 2.4 uses TCP_NOPUSH with sendfile(2), breaking it
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    ryoon
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 17 10:10:00 +0000 2012
>Closed-Date:    Fri May 18 21:05:12 +0000 2012
>Last-Modified:  Fri May 18 21:05:12 +0000 2012
>Originator:     Francois Tigeot
>Release:        DragonFly
>Organization:
>Environment:
DragonFly serenity.zefyris.com 3.1-DEVELOPMENT DragonFly v3.1.0.624.g178907-DEVELOPMENT #6: Thu May  3 15:28:20 CEST 2012     ftigeot@serenity.zefyris.com:/usr/obj/usr/src/sys/X86_64_GENERIC  x86_64
>Description:
Having updated a web server to apache-2.4 (sendfile enabled), I noticed
static images stopped downloading mid-way for a few seconds.

After some investigations, apache was found to use APR_TCP_NOPUSH with
sendfile. This flag prevents the last part of the file to be sent until
after the associated socket has been closed.

The visible result is a 5-second delay between reception of the first
and last parts of static files.
>How-To-Repeat:
Install www/apache24
Use it to download a static file. A 10KB pictures gives very visible results.
>Fix:
Add this patch to the patches/ directory:
http://dl.wolfpond.org/patch-server_core_filters.c.txt

>Release-Note:

>Audit-Trail:
From: Francois Tigeot <ftigeot@wolfpond.org>
To: gnats-bugs@NetBSD.org
Cc: ftigeot@wolfpond.org
Subject: Re: pkg/46458: Apache 2.4 uses TCP_NOPUSH with sendfile(2), breaking
 it
Date: Thu, 17 May 2012 12:14:54 +0200

 --Q68bSM7Ycu6FN28Q
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline

 On Thu, May 17, 2012 at 10:10:01AM +0000, gnats-admin@NetBSD.org wrote:
 > Thank you very much for your problem report.
 > It has the internal identification `pkg/46458'.
 > The individual assigned to look at your
 > report is: pkg-manager. 
 > 
 > >Category:       pkg
 > >Responsible:    pkg-manager
 > >Synopsis:       Apache 2.4 uses TCP_NOPUSH with sendfile(2), breaking it
 > >Arrival-Date:   Thu May 17 10:10:00 +0000 2012

 Same patch, attached for reference.

 -- 
 Francois Tigeot

 --Q68bSM7Ycu6FN28Q
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="patch-server_core_filters.c"

 $NetBSD$

 Remove the use of TCP_NOPUSH with sendfile(2).
 This option prevents the last parts of target files to be sent until
 the associated socket has been closed, making downloads seem to hang
 for a few seconds.

 DragonFly bug report #2368
 http://bugs.dragonflybsd.org/issues/2368

 --- server/core_filters.c.orig	2012-02-04 10:04:59.000000000 +0000
 +++ server/core_filters.c
 @@ -640,18 +640,13 @@ static apr_status_t send_brigade_nonbloc
              if ((apr_file_flags_get(fd) & APR_SENDFILE_ENABLED) &&
                  (bucket->length >= AP_MIN_SENDFILE_BYTES)) {
                  if (nvec > 0) {
 -                    (void)apr_socket_opt_set(s, APR_TCP_NOPUSH, 1);
                      rv = writev_nonblocking(s, vec, nvec, bb, bytes_written, c);
                      nvec = 0;
                      if (rv != APR_SUCCESS) {
 -                        (void)apr_socket_opt_set(s, APR_TCP_NOPUSH, 0);
                          return rv;
                      }
                  }
                  rv = sendfile_nonblocking(s, bucket, bytes_written, c);
 -                if (nvec > 0) {
 -                    (void)apr_socket_opt_set(s, APR_TCP_NOPUSH, 0);
 -                }
                  if (rv != APR_SUCCESS) {
                      return rv;
                  }

 --Q68bSM7Ycu6FN28Q--

From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/46458: Apache 2.4 uses TCP_NOPUSH with sendfile(2), breaking
 it
Date: Thu, 17 May 2012 14:49:00 +0000

 On Thu, May 17, 2012 at 10:10:01AM +0000, ftigeot@wolfpond.org wrote:
  > After some investigations, apache was found to use APR_TCP_NOPUSH with
  > sendfile. This flag prevents the last part of the file to be sent until
  > after the associated socket has been closed.
  > 
  > The visible result is a 5-second delay between reception of the first
  > and last parts of static files.

 Please also report this upstream if you haven't...

 -- 
 David A. Holland
 dholland@netbsd.org

From: Francois Tigeot <ftigeot@wolfpond.org>
To: gnats-bugs@NetBSD.org
Cc: pkg-manager@NetBSD.org, gnats-admin@NetBSD.org, pkgsrc-bugs@NetBSD.org,
        ftigeot@wolfpond.org
Subject: Re: pkg/46458: Apache 2.4 uses TCP_NOPUSH with sendfile(2), breaking
 it
Date: Thu, 17 May 2012 16:55:16 +0200

 On Thu, May 17, 2012 at 02:50:04PM +0000, David Holland wrote:
 > The following reply was made to PR pkg/46458; it has been noted by GNATS.
 > 
 > From: David Holland <dholland-pbugs@netbsd.org>
 > To: gnats-bugs@NetBSD.org
 > Cc: 
 > Subject: Re: pkg/46458: Apache 2.4 uses TCP_NOPUSH with sendfile(2), breaking
 >  it
 > Date: Thu, 17 May 2012 14:49:00 +0000
 > 
 >  On Thu, May 17, 2012 at 10:10:01AM +0000, ftigeot@wolfpond.org wrote:
 >   > After some investigations, apache was found to use APR_TCP_NOPUSH with
 >   > sendfile. This flag prevents the last part of the file to be sent until
 >   > after the associated socket has been closed.
 >   > 
 >   > The visible result is a 5-second delay between reception of the first
 >   > and last parts of static files.
 >  
 >  Please also report this upstream if you haven't...

 I forgot to report it. Bug id is #53253.
 https://issues.apache.org/bugzilla/show_bug.cgi?id=53253

 -- 
 Francois Tigeot

Responsible-Changed-From-To: pkg-manager->ryoon
Responsible-Changed-By: hauke@NetBSD.org
Responsible-Changed-When: Thu, 17 May 2012 16:49:32 +0000
Responsible-Changed-Why:
Over to maintainer.


From: "Ryo ONODERA" <ryoon@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/46458 CVS commit: pkgsrc/www/apache24
Date: Fri, 18 May 2012 20:56:29 +0000

 Module Name:	pkgsrc
 Committed By:	ryoon
 Date:		Fri May 18 20:56:29 UTC 2012

 Modified Files:
 	pkgsrc/www/apache24: Makefile distinfo
 Added Files:
 	pkgsrc/www/apache24/patches: patch-server_core__filters.c

 Log Message:
 Bump PKGREVISION.

 Fix PR pkg/46458

 * Fix download delay problem
   https://issues.apache.org/bugzilla/show_bug.cgi?id=53253


 To generate a diff of this commit:
 cvs rdiff -u -r1.6 -r1.7 pkgsrc/www/apache24/Makefile
 cvs rdiff -u -r1.2 -r1.3 pkgsrc/www/apache24/distinfo
 cvs rdiff -u -r0 -r1.1 \
     pkgsrc/www/apache24/patches/patch-server_core__filters.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: ryoon@NetBSD.org
State-Changed-When: Fri, 18 May 2012 21:05:12 +0000
State-Changed-Why:
Patch committed. Thank you.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.