Bug 53253 - TCP_NOPUSH used with sendfile(2), cause transfers to freeze for a few seconds
Summary: TCP_NOPUSH used with sendfile(2), cause transfers to freeze for a few seconds
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Core (show other bugs)
Version: 2.4-HEAD
Hardware: PC other
: P2 major (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
Keywords: PatchAvailable
Depends on:
Reported: 2012-05-17 11:15 UTC by François Tigeot
Modified: 2018-06-13 18:14 UTC (History)
1 user (show)

Remove the use of TCP_NOPUSH with sendfile(2) (1.24 KB, text/plain)
2012-05-17 11:15 UTC, François Tigeot
possible fix for TCP_NOPUSH usage (879 bytes, patch)
2012-07-02 09:08 UTC, Joe Orton
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description François Tigeot 2012-05-17 11:15:55 UTC
Created attachment 28797 [details]
Remove the use of TCP_NOPUSH with sendfile(2)

Having updated a web server to apache-2.4 (sendfile enabled), I noticed
some static images didn't load in one go:

- top parts were displayed instantly
- image downloads were frozen for a few seconds
- missing bottom parts were then downloaded and displayed instantly

Switching EnableSendfile between on/off in httpd.conf enables or disables
this behavior 100% of the time

After some investigation, it was found this behavior was caused by the use
of APR_TCP_NOPUSH in the code path using sendfile(2).

Once patch-server_core_filters.c.txt is applied, Apache-2.4 works perfectly
fine with sendfile.

DragonFly BSD bug report:

pkgsrc problem report:
Comment 1 Joe Orton 2012-07-02 09:08:47 UTC
Created attachment 29020 [details]
possible fix for TCP_NOPUSH usage

Can you try this patch instead?

Coverity's static analysis noticed a bug in this code which could well explain the symptoms you're seeing here.
Comment 2 François Tigeot 2014-10-04 15:08:24 UTC
I'm sadly unable to reproduce the original issue with Apache 2.4.10.

The last patch doesn't have any visible effect.
Comment 3 Christophe JAILLET 2015-04-04 21:53:06 UTC
The patch proposed by Joe Orton has been merged into 2.4.x branch in r1670328
Comment 4 Christophe JAILLET 2018-06-13 18:14:11 UTC
Fixed in 2.4.x, so closing.
(reference to this PR has also been added in CHANGES)