Mailing List Archive

[Bug 65686] New: sendfile() doesn't work
https://bz.apache.org/bugzilla/show_bug.cgi?id=65686

Bug ID: 65686
Summary: sendfile() doesn't work
Product: Apache httpd-2
Version: 2.4.51
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Core
Assignee: bugs@httpd.apache.org
Reporter: gary@cpanel.net
Target Milestone: ---

I'm not sure this is a regression, as I haven't had time to dig into it. On
Apache 2.4.51 linked against APR-1.7.0 (CentOS8, 64bit), sendfile() is not used
even though the following is set in httpd.conf;

EnableSendfile on
EnableMMAP on

Using this shows sendfile() is not used at all on a moderately busy server with
mixed traffic (PHP and html files, gzip/zip/etc)

strace -e sendfile,sendfile64 -f $(ps auxfww | egrep [h]ttpd | awk '{print $2}'
| sed 's/^/-p/g') 2>&1 ^C

I attached gdb to httpd and set a breakpoint on sendfile and sendfile64 and the
breakpoints were not triggered. I also hacked in some code into core.c to show
sendfile support is enabled:

[Wed Nov 17 01:10:52.550460 2021] [core:info] [pid 12459:tid 140518256277632]
EnableSendfile: on

Loglevel trace8 shows writev_nonblocking() is being used all the time, ie:

[Wed Nov 17 01:14:46.774434 2021] [core:trace6] [pid 12496:tid 139630070900480]
core_filters.c(806): [client 10.3.9.151:54629] writev_nonblocking: 8022/8022

Apache is compiled with -D APR_HAS_SENDFILE (according to httpd -V)

I've seen this behavior on CentOS7, CentOS8, and Ubuntu 20.x so far with stock
kernels et al.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org