0

We have a webserver where besides normal requests large files are being uploaded.

Some requests (such as 1/10) are dropped. We than see following errors in the error log.

==> /var/log/apache2/web_error_ssl.log <==
[Fri Dec 07 15:38:24.154218 2018] [php7:error] [pid 8333] [client ****:****:****:****:216:3eff:fe0b:bb4f:55760] PHP Fatal error:  Cannot redeclare composerRequire2f3df4313599c81c8cd86cade0406e0b() (previously declared in /var/www/releases/test/vendor/composer/autoload_real.php:54) in /var/www/releases/test/vendor/composer/autoload_real.php on line 61

==> /var/log/apache2/error.log <==
[Fri Dec 07 15:38:24.385423 2018] [core:notice] [pid 18418] AH00052: child pid 8333 exit signal Segmentation fault (11)

==> /var/log/apache2/web_error_ssl.log <==
[Fri Dec 07 15:38:27.243422 2018] [php7:error] [pid 8318] [client ****:****:****:****:216:3eff:fe0b:bb4f:56308] PHP Fatal error:  Cannot redeclare composerRequire2f3df4313599c81c8cd86cade0406e0b() (previously declared in /var/www/releases/test/vendor/composer/autoload_real.php:54) in /var/www/releases/test/vendor/composer/autoload_real.php on line 61

==> /var/log/apache2/error.log <==
zend_mm_heap corrupted

Environment:

Updated debian stretch

Apache version: 2.4.25-3+deb9u6 with prefork mpm.

PHP Version: 7.1.24-1+0~20181112093455.10+stretch~1.gbp09a4fd (from sury repository)

PHP loaded as apache2 module.

What we have tested so far:

  • opcache.enable = 0 / 1
  • opcache.enable_cli = 0 / 1
  • output_buffering = Off / 4096 / 16777216
  • realpath_cache_size = 0 / 4096k
  • Replace several versions of PHP7.0 and PHP7.1 (from debian repo and from sury repo)
  • index.php: define('HHVM_VERSION', ?); ? = true/false
  • /etc/apache2/envvars: export USE_ZEND_ALLOC = 0 / 1
  • switch over to backport kernel

What helps us is webserver reload - it fixes the problem for several minutes, then it starts again.

When we catch strace of failing process, we get:

open("/var/www/releases/test/vendor/composer/autoload_real.php", O_RDONLY) = 17
fstat(17, {st_mode=S_IFREG|0644, st_size=2103, ...}) = 0
fstat(17, {st_mode=S_IFREG|0644, st_size=2103, ...}) = 0
fstat(17, {st_mode=S_IFREG|0644, st_size=2103, ...}) = 0
fstat(17, {st_mode=S_IFREG|0644, st_size=2103, ...}) = 0
mmap(NULL, 2103, PROT_READ, MAP_SHARED, 17, 0) = 0x7f61c3186000
getpid()                                = 21075
getpid()                                = 21075
getpid()                                = 21075
write(12, "[Thu Dec 06 23:58:59.246179 2018] [php7:error] [pid 21075] [client ****:****:****:****::aaaa:1:31248] PHP Fatal error:  Cannot redeclare composerRequire2f3df4313599c81c8cd86cade0406e0b() (previously declared in /var/www/releases/test/vendor/composer/autoload_real.php:54) in /var/www/releases/test/vendor/composer/autoload_real.php on line 61\n", 348) = 348
chdir("/")                              = 0
munmap(0x7f61ab800000, 16781312)        = 0
setitimer(ITIMER_PROF, {it_interval={tv_sec=0, tv_usec=0}, it_value={tv_sec=0, tv_usec=0}}, NULL) = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x7f61adfbae68} ---

autoload_real.php contains is a file generated by

composer install --no-progress --prefer-dist --no-dev --classmap-authoritative

and on lines 54 - 61 is following:

function composerRequire2f3df4313599c81c8cd86cade0406e0b($fileIdentifier, $file)
{
    if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
        require $file;

        $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
    }
}

List of PHP modules:

root@server:~# dpkg -l | grep php7.1
ii  libapache2-mod-php7.1             7.1.24-1+0~20181112093455.10+stretch~1.gbp09a4fd      amd64        server-side, HTML-embedded scripting language (Apache 2 module)
ii  php7.1-bcmath                     7.1.24-1+0~20181112093455.10+stretch~1.gbp09a4fd      amd64        Bcmath module for PHP
ii  php7.1-cli                        7.1.24-1+0~20181112093455.10+stretch~1.gbp09a4fd      amd64        command-line interpreter for the PHP scripting language
ii  php7.1-common                     7.1.24-1+0~20181112093455.10+stretch~1.gbp09a4fd      amd64        documentation, examples and common module for PHP
ii  php7.1-curl                       7.1.24-1+0~20181112093455.10+stretch~1.gbp09a4fd      amd64        CURL module for PHP
ii  php7.1-gd                         7.1.24-1+0~20181112093455.10+stretch~1.gbp09a4fd      amd64        GD module for PHP
ii  php7.1-json                       7.1.24-1+0~20181112093455.10+stretch~1.gbp09a4fd      amd64        JSON module for PHP
ii  php7.1-mbstring                   7.1.24-1+0~20181112093455.10+stretch~1.gbp09a4fd      amd64        MBSTRING module for PHP
ii  php7.1-mysql                      7.1.24-1+0~20181112093455.10+stretch~1.gbp09a4fd      amd64        MySQL module for PHP
ii  php7.1-opcache                    7.1.24-1+0~20181112093455.10+stretch~1.gbp09a4fd      amd64        Zend OpCache module for PHP
ii  php7.1-readline                   7.1.24-1+0~20181112093455.10+stretch~1.gbp09a4fd      amd64        readline module for PHP
ii  php7.1-sqlite3                    7.1.24-1+0~20181112093455.10+stretch~1.gbp09a4fd      amd64        SQLite3 module for PHP
ii  php7.1-xml                        7.1.24-1+0~20181112093455.10+stretch~1.gbp09a4fd      amd64        DOM, SimpleXML, WDDX, XML, and XSL module for PHP
3
  • 1
    First update to the current supported point release, 7.3.0 or 7.2.13. If you still have the problem, file a bug report. 7.1 is no longer in support and receives security fixes only. Dec 7, 2018 at 15:41
  • That is currently not so easy as several composer dependencies do not support php 7.2. So until we update them, we are forced to stay with 7.1 ... which support has ended just a week ago.
    – Yarik Dot
    Dec 7, 2018 at 17:13
  • Yeah, it does suck when you're relying on dependencies that their developers have apparently abandoned. Just more work for your developers. Dec 7, 2018 at 18:45

1 Answer 1

0

So after days of testing we found that upgrading to PHP 7.2 solves our problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .