Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache crashes with munmap_chunk(): invalid pointer after update to php7 on Jessie

I recently updated to php 7.0.4 on my server running a Debian 8.

here is what dpkg -l | grep php gives me:

ii  libapache2-mod-php7.0          7.0.4-1~dotdeb+8.1           amd64        server-side, HTML-embedded scripting language (Apache 2 module)
ii  php-common                     21-1~dotdeb+8.1              all          Common files for PHP packages
ii  php-readline                   21-1~dotdeb+8.1              all          readline module for PHP [default]
ii  php7.0                         7.0.4-1~dotdeb+8.1           all          server-side, HTML-embedded scripting language (metapackage)
ii  php7.0-cli                     7.0.4-1~dotdeb+8.1           amd64        command-line interpreter for the PHP scripting language
ii  php7.0-common                  7.0.4-1~dotdeb+8.1           all          Common files for packages built from the PHP source
ii  php7.0-curl                    7.0.4-1~dotdeb+8.1           amd64        CURL module for PHP
ii  php7.0-gd                      7.0.4-1~dotdeb+8.1           amd64        GD module for PHP
ii  php7.0-imap                    7.0.4-1~dotdeb+8.1           amd64        IMAP module for PHP
ii  php7.0-intl                    7.0.4-1~dotdeb+8.1           amd64        Internationalisation module for PHP
ii  php7.0-json                    7.0.4-1~dotdeb+8.1           amd64        JSON module for PHP
ii  php7.0-mcrypt                  7.0.4-1~dotdeb+8.1           amd64        libmcrypt module for PHP
ii  php7.0-mysql                   7.0.4-1~dotdeb+8.1           amd64        MySQL module for PHP
ii  php7.0-opcache                 7.0.4-1~dotdeb+8.1           amd64        Zend OpCache module for PHP
ii  php7.0-readline                7.0.4-1~dotdeb+8.1           amd64        readline module for PHP

My php applications run fine most of the time.But on some requests I just get a Page being generated for no foreseeable reason.

The /var/log/apache2/error.log states in such a case:

*** Error in `/usr/sbin/apache2': munmap_chunk(): invalid pointer: 0x00007efc6ddb4a50 ***
*** Error in `/usr/sbin/apache2': munmap_chunk(): invalid pointer: 0x00007efc6dd5cad0 ***
[Wed Mar 09 11:26:44.940931 2016] [core:notice] [pid 28486] AH00052: child pid 29338 exit signal Aborted (6)
[Wed Mar 09 11:26:44.941017 2016] [core:notice] [pid 28486] AH00052: child pid 29344 exit signal Aborted (6)
*** Error in `/usr/sbin/apache2': munmap_chunk(): invalid pointer: 0x00007efc6dd5cad0 ***
[Wed Mar 09 11:26:46.942581 2016] [core:notice] [pid 28486] AH00052: child pid 29347 exit signal Aborted (6)

I'll give some more information:

Syntax:

$ apachectl configtest
Syntax OK

Version:

apachectl -v
Server version: Apache/2.4.10 (Debian)
Server built:   Nov 28 2015 14:05:48

Before the php update I did not see those errors. What is wrong here? Or how can I better find the source? I am lost here because this error occures kind of random. Sometimes the same request succeeds that faild with this error a minute ago. I would apprechiate your help.

like image 834
Daniel Avatar asked Mar 09 '16 10:03

Daniel


3 Answers

That's now the second time we have been hit hard by the very same issue.

It happens when running PHP 7.0 on a up to date debian. This will break any type of website system which heavily uses regular expression. We have seen it iwth Neos (neos.io) or Typo3 (starting with 6.2).

In case it's not possible to use the testing version of the libpcre3. Someone can disable the just in time compiling within the php.ini

  1. Edit your php.ini add pcre.jit=0 anywhere you like
  2. Restart your apache
  3. Be happy
like image 100
Gregor Streng Avatar answered Nov 05 '22 08:11

Gregor Streng


I have the same version and solved by upgrading libpcre3 like @Kevin Fischer write.

I was upgrade libpcre3 package form 2:8.35-3.3+deb8u4 (stable) to 2:8.38-3.1 (testing) version.

Step by step:

  1. Add line deb http://ftp.us.debian.org/debian testing main contrib non-free to /etc/apt/sources.list
  2. Create file /etc/apt/apt.conf.d/99default-release with content: APT::Default-Release "stable";
  3. Run command apt-get update from root
  4. Run command apt-get -t testing install libpcre3 to install testing version of libpcre3 package
  5. Restart your server and check logs, error should be disappears.

For more info to install testing package see this question.

Warning! Testing packages can works incorrectly! Update in your own risk or wait new release.

like image 24
DARK_DIESEL Avatar answered Nov 05 '22 08:11

DARK_DIESEL


We've just had a similiar situation, where one of our framework's components would fail us with:

*** Error in `php': munmap_chunk(): invalid pointer: 0x00007fdce5550060 ***

I can't tell you anything about the bug itself, but the cause of it was a broken libpcre3 version, namely 8.35-3.3+deb8u4. We we're running a custom build, because PHP7 requires JIT support from libpcre3, which isn't included in the default one our Ubuntu version comes with (Ubuntu 14.04 LTS, 8.31-2ubuntu2.3). Upgrading the libpcre3 version solved the problem for us.

like image 1
Kevin F Avatar answered Nov 05 '22 08:11

Kevin F