After upgrading to Apache 2.4.10, we have noticed that requests for missing files (php) are given random error message in Apache error.log. PHP and apache are linked with mod_proxy_fcgi and php-fpm. We have a varnish load-balancer and apache application servers and we use an empty test.php to test whether a server is up or down (on the varnish side). When upgrading the app server, this file is removed, thus no requests are sent to this host and we have noticed, that random messages (seems like partial responses from the servers) suddenly started to appear in the Apache error log. The same problem was reproduced with Apache prefork/event MPM. A simple configuration to reproduce the problem. Apache vhost <VirtualHost *:80> ServerName localhost Include /etc/apache2/vhosts.d/default_vhost.include ProxyPassMatch ^/(.*.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/localhost/htdocs/$1 </VirtualHost> # /etc/init.d/php-fpm start # /etc/init.d/apache2 start error.log [Fri Jul 25 10:38:38.005428 2014] [mpm_prefork:notice] [pid 6921] AH00163: Apache/2.4.10 (Unix) configured -- resuming normal operations [Fri Jul 25 10:38:38.005579 2014] [core:notice] [pid 6921] AH00094: Command line: '/usr/sbin/apache2 -D DEFAULT_VHOST -D PROXY -d /usr/lib64/apache2 -f /etc/apache2/httpd.conf' # wget http://localhost/test.php error.log [Fri Jul 25 10:39:29.884473 2014] [proxy_fcgi:error] [pid 6923] [client 127.0.0.1:36352] AH01071: Got error 'Primary script unknown\n' access.log 127.0.0.1 - - [25/Jul/2014:10:39:29 +0200] "GET /test.php HTTP/1.1" 404 16 # touch test.php # wget http://localhost/test.php 127.0.0.1 - - [25/Jul/2014:10:40:35 +0200] "GET /test.php HTTP/1.1" 200 - # rm test.php # siege http://localhost/test.php (multiple download) ==> error_log <== [Fri Jul 25 10:41:07.796028 2014] [proxy_fcgi:error] [pid 6925] [client 127.0.0.1:36358] AH01071: Got error 'Primary script unknown\n' ==> access_log <== 127.0.0.1 - - [25/Jul/2014:10:41:07 +0200] "GET /test.php HTTP/1.1" 404 16 ==> error_log <== [Fri Jul 25 10:41:09.515933 2014] [proxy_fcgi:error] [pid 6926] [client 127.0.0.1:36360] AH01071: Got error 'Primary script unknown\n' ==> access_log <== 127.0.0.1 - - [25/Jul/2014:10:41:09 +0200] "GET /test.php HTTP/1.1" 404 16 ==> error_log <== [Fri Jul 25 10:41:09.995824 2014] [proxy_fcgi:error] [pid 6927] [client 127.0.0.1:36362] AH01071: Got error 'Primary script unknown\n' ==> access_log <== 127.0.0.1 - - [25/Jul/2014:10:41:09 +0200] "GET /test.php HTTP/1.1" 404 16 ==> error_log <== [Fri Jul 25 10:41:10.435486 2014] [proxy_fcgi:error] [pid 6923] [client 127.0.0.1:36364] AH01071: Got error 'Primary script unknown\nX-Powered-By: PHP/5.5.14-pl0-gentoo\r\nContent-type: text/html\r\n\r\nFile not found.\n' ==> access_log <== 127.0.0.1 - - [25/Jul/2014:10:41:10 +0200] "GET /test.php HTTP/1.1" 404 16 # /etc/init.d/apache2 restart # wget http://localhost/test.php ==> error_log <== [Fri Jul 25 10:42:38.311301 2014] [mpm_prefork:notice] [pid 6921] AH00169: caught SIGTERM, shutting down [Fri Jul 25 10:42:41.005432 2014] [mpm_prefork:notice] [pid 7090] AH00163: Apache/2.4.10 (Unix) configured -- resuming normal operations [Fri Jul 25 10:42:41.005574 2014] [core:notice] [pid 7090] AH00094: Command line: '/usr/sbin/apache2 -D DEFAULT_VHOST -D PROXY -d /usr/lib64/apache2 -f /etc/apache2/httpd.conf' [Fri Jul 25 10:42:45.451471 2014] [proxy_fcgi:error] [pid 7093] [client 127.0.0.1:36382] AH01071: Got error 'Primary script unknown\n' ==> access_log <== 127.0.0.1 - - [25/Jul/2014:10:42:45 +0200] "GET /test.php HTTP/1.1" 404 16 Portage 2.2.10 (default/linux/amd64/13.0/desktop, gcc-4.8.3, glibc-2.19-r1, 3.14.13-gentoo x86_64) ================================================================= System Settings ================================================================= System uname: Linux-3.14.13-gentoo-x86_64-Intel-R-_Core-TM-_i5-3570_CPU_@_3.40GHz-with-gentoo-2.2 KiB Mem: 15910672 total, 13418584 free KiB Swap: 0 total, 0 free Timestamp of tree: Thu, 24 Jul 2014 05:15:02 +0000 ld GNU ld (Gentoo 2.24 p1.4) 2.24 app-shells/bash: 4.2_p47 dev-java/java-config: 2.2.0 dev-lang/python: 2.6.9, 2.7.7, 3.2.5-r4, 3.3.5, 3.4.1 dev-util/cmake: 2.8.12.2-r1 dev-util/pkgconfig: 0.28-r1 sys-apps/baselayout: 2.2 sys-apps/openrc: 0.12.4 sys-apps/sandbox: 2.6-r1 sys-devel/autoconf: 2.13, 2.69 sys-devel/automake: 1.14.1 sys-devel/binutils: 2.24-r3 sys-devel/gcc: 4.8.3 sys-devel/gcc-config: 1.8 sys-devel/libtool: 2.4.2-r1 sys-devel/make: 4.0-r1 sys-kernel/linux-headers: 3.14 (virtual/os-headers) sys-libs/glibc: 2.19-r1 ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="*" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-mtune=native -O2 -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.5/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo" CXXFLAGS="-mtune=native -O2 -pipe" DISTDIR="/usr/portage/distfiles" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="http://tux.rainside.sk/gentoo/" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j4" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" USE="X a52 aac acl acpi alsa amd64 berkdb bindist branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cups cxx dbus dri dts dvd dvdr emboss encode exif fam firefox flac fortran gdbm gif gpm gtk iconv jpeg lcms ldap libnotify mad mmx mng modules mp3 mp4 mpeg multilib ncurses nls nptl ogg opengl openmp pam pango pcre pdf png policykit ppds qt3support qt4 readline sdl session sse sse2 ssl startup-notification svg tcpd tiff truetype udev udisks unicode upower usb vorbis wxwidgets x264 xattr xcb xml xv xvid zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core authz_host dir mime unixd socache_shmcb log_config rewrite vhost_alias log_forensic proxy proxy_fcgi info status deflate filter auth_digest authn_file authz_user access_compat actions alias auth_basic authn_alias authn_anon env expires headers mime_magic negotiation reqtimeout setenvif unique_id version cgi" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64 pc" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2 python3_3" QEMU_SOFTMMU_TARGETS="x86_64 i386" QEMU_USER_TARGETS="x86_64 i386" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="intel i128" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON ================================================================= Package Settings ================================================================= dev-lang/php-5.5.14 was built with the following: USE="bcmath berkdb bzip2 calendar cli crypt ctype curl exif fileinfo filter fpm ftp gd gdbm gmp hash iconv intl json ldap mysql mysqli nls opcache pcntl pdo phar posix readline session simplexml soap sockets ssl sysvipc tidy tokenizer truetype unicode xml xmlreader xmlrpc xmlwriter zip zlib -apache2 -cdb -cgi -cjk -debug -embed -enchant (-firebird) -flatfile (-frontbase) -imap -inifile -iodbc -ipv6 -kerberos -ldap-sasl -libedit -libmysqlclient -mhash -mssql -oci8-instant-client -odbc -postgres -qdbm -recode (-selinux) -sharedmem -snmp -spell -sqlite (-sybase-ct) -systemd -threads -wddx -xpm -xslt" ABI_X86="64" www-servers/apache-2.4.10 was built with the following: USE="ldap ssl -debug -doc (-selinux) -static -suexec -threads" ABI_X86="64" APACHE2_MODULES="access_compat actions alias auth_basic auth_digest authn_alias authn_anon authn_core authn_file authz_core authz_host authz_user cgi deflate dir env expires filter headers info log_config log_forensic mime mime_magic negotiation proxy proxy_fcgi reqtimeout rewrite setenvif socache_shmcb status unique_id unixd version vhost_alias -asis -authn_dbd -authn_dbm -authz_dbd -authz_dbm -authz_groupfile -authz_owner -autoindex -cache -cache_disk -cern_meta -cgid -charset_lite -dav -dav_fs -dav_lock -dbd -dumpio -ext_filter -file_cache -ident -imagemap -include -lbmethod_bybusyness -lbmethod_byrequests -lbmethod_bytraffic -lbmethod_heartbeat -logio -proxy_ajp -proxy_balancer -proxy_connect -proxy_ftp -proxy_http -proxy_scgi -proxy_wstunnel -ratelimit -remoteip -slotmem_shm -speling -substitute -userdir -usertrack" APACHE2_MPMS="-event -peruser -prefork -worker" LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--no-as-needed"
The interesting lines: [Fri Jul 25 10:41:07.796028 2014] [proxy_fcgi:error] [pid 6925] [client 127.0.0.1:36358] AH01071: Got error 'Primary script unknown\n' vs [Fri Jul 25 10:41:10.435486 2014] [proxy_fcgi:error] [pid 6923] [client 127.0.0.1:36364] AH01071: Got error 'Primary script unknown\nX-Powered-By: PHP/5.5.14-pl0-gentoo\r\nContent-type: text/html\r\n\r\nFile not found.\n'
Bug report upstream: https://issues.apache.org/bugzilla/show_bug.cgi?id=56858 And a patch: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c?r1=1612068&r2=1618401&diff_format=h Tested to work on amd64 with the patch --- apache-2.4.10-r1.ebuild 2014-08-10 22:31:18.000000000 +0200 +++ apache-2.4.10-r2.ebuild 2014-10-23 10:54:39.708815000 +0200 @@ -133,6 +133,12 @@ apache-2_pkg_setup } +src_prepare() { + epatch "${FILESDIR}/mod_proxy_fcgi_fix.patch" + + apache-2_src_prepare +} + src_configure() { # Brain dead check. tc-is-cross-compiler && export ap_cv_void_ptr_lt_long="no" mod_proxy_fcgi_fix.patch --- modules/proxy/mod_proxy_fcgi.c.orig 2014-06-26 00:24:44.000000000 +0000 +++ modules/proxy/mod_proxy_fcgi.c 2014-10-20 12:38:20.982672886 +0000 @@ -663,7 +663,7 @@ /* TODO: Should probably clean up this logging a bit... */ if (clen) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01071) - "Got error '%s'", iobuf); + "Got error '%.*s'", (int)readbuflen, iobuf); } if (clen > readbuflen) {
Fixed in 2.14.12.
Great, thanks for keeping track of this upstream! *apache-2.4.12 (04 Feb 2015) 04 Feb 2015; Lars Wendler <polynomial-c@gentoo.org> +apache-2.4.12.ebuild: Security bump (bug #538182).