# Apache 2.2 mpm-worker segfault  in libphp5.so

## mmenphis

Hi,

at first i have to apologize for my terrible English.  

I  manage heavy load cluster of Apache servers with Drupal framework. After upgrade php from  version 5.2 on 5.3.9 is in message log  many  segfault errors, like this:

```
apache2[29793]: segfault at 18 ip 00007f2a922dfbc5 sp 00007f2a875aeb00 error 4 in libphp5.so[7f2a91eec000+907000]
```

Here is my apache and php compilation options:

```

[ebuild   R    ] dev-lang/php-5.3.9  USE="apache2 bcmath berkdb bzip2 calendar cgi cli crypt ctype curl curlwrappers exif fileinfo filter firebird flatfile ftp gd gdbm gmp hash iconv imap inifile ipv6 json mhash mysql mysqli nls pcntl phar posix readline session simplexml snmp soap sockets spell ssl threads tidy tokenizer truetype unicode wddx xml xmlreader xmlrpc xmlwriter xpm xsl zip zlib -cdb -cjk -debug* -doc -embed -enchant -fpm (-frontbase) -intl -iodbc -kerberos -kolab -ldap -ldap-sasl -libedit -mssql -mysqlnd -oci8-instant-client -odbc -pdo -pic -postgres -qdbm -recode -sharedmem -sqlite -sqlite3 -suhosin (-sybase-ct) -sysvipc" 0 kB

[ebuild   R    ] www-servers/apache-2.2.21-r1  USE="ssl suexec threads -debug* -doc -ldap (-selinux) -static" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias -asis -authn_alias -cern_meta -cgi -cgid -charset_lite -dav -dav_fs -dav_lock -dumpio -log_forensic -proxy -proxy_ajp -proxy_balancer -proxy_connect -proxy_ftp -proxy_http -proxy_scgi -reqtimeout -substitute -version" APACHE2_MPMS="worker -event -itk -peruser -prefork" 0 kB

```

Only PHP extension which I use is pecl-memcache ( i had version 3.0.5  then  upgrage on unstable 3.0.6-r1 )

Here is back trace of apache core-log:

```

snek1 tmp-apache # gdb /usr/sbin/apache2 --core core-2

GNU gdb (Gentoo 7.3.1 p2) 7.3.1

Copyright (C) 2011 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.  Type "show copying"

and "show warranty" for details.

This GDB was configured as "x86_64-pc-linux-gnu".

For bug reporting instructions, please see:

<http://bugs.gentoo.org/>...

Reading symbols from /usr/sbin/apache2...(no debugging symbols found)...done.

[New LWP 25883]

[New LWP 25884]

[New LWP 25877]

[New LWP 25865]

[New LWP 25868]

[New LWP 25869]

[New LWP 25885]

[New LWP 25886]

[New LWP 25887]

[New LWP 25867]

[New LWP 25870]

[New LWP 25871]

[New LWP 25872]

[New LWP 25873]

[New LWP 25874]

[New LWP 25875]

[New LWP 25876]

[New LWP 25878]

[New LWP 25879]

[New LWP 25880]

[New LWP 25881]

[New LWP 25882]

warning: Can't read pathname for load map: Input/output error.

[Thread debugging using libthread_db enabled]

Core was generated by `/usr/sbin/apache2 -D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D SUEXE'.

Program terminated with signal 11, Segmentation fault.

#0  0x00007fa7d489464c in ?? () from /usr/lib64/apache2/modules/libphp5.so

(gdb) bt

#0  0x00007fa7d489464c in ?? () from /usr/lib64/apache2/modules/libphp5.so

#1  0x00007fa7d489462f in ?? () from /usr/lib64/apache2/modules/libphp5.so

#2  0x00007fa7d489632b in ?? () from /usr/lib64/apache2/modules/libphp5.so

#3  0x00007fa7d4897a94 in _efree () from /usr/lib64/apache2/modules/libphp5.so

#4  0x00007fa7d48b402f in _zval_ptr_dtor () from /usr/lib64/apache2/modules/libphp5.so

#5  0x00007fa7d48c5d55 in _zval_ptr_dtor_wrapper () from /usr/lib64/apache2/modules/libphp5.so

#6  0x00007fa7d48dc720 in zend_hash_destroy () from /usr/lib64/apache2/modules/libphp5.so

#7  0x00007fa7d48f9a23 in zend_object_std_dtor () from /usr/lib64/apache2/modules/libphp5.so

#8  0x00007fa7d45ef223 in ?? () from /usr/lib64/apache2/modules/libphp5.so

#9  0x00007fa7d45ef403 in ?? () from /usr/lib64/apache2/modules/libphp5.so

#10 0x00007fa7d4900a84 in zend_objects_store_del_ref_by_handle_ex () from /usr/lib64/apache2/modules/libphp5.so

#11 0x00007fa7d4900576 in zend_objects_store_del_ref () from /usr/lib64/apache2/modules/libphp5.so

#12 0x00007fa7d48c5854 in _zval_dtor_func () from /usr/lib64/apache2/modules/libphp5.so

#13 0x00007fa7d48b1bcc in ?? () from /usr/lib64/apache2/modules/libphp5.so

#14 0x00007fa7d48b400c in _zval_ptr_dtor () from /usr/lib64/apache2/modules/libphp5.so

#15 0x00007fa7d490287a in ?? () from /usr/lib64/apache2/modules/libphp5.so

#16 0x00007fa7d490897b in ?? () from /usr/lib64/apache2/modules/libphp5.so

#17 0x00007fa7d490e9c7 in ?? () from /usr/lib64/apache2/modules/libphp5.so

#18 0x00007fa7d4907f37 in execute () from /usr/lib64/apache2/modules/libphp5.so

#19 0x00007fa7d48b6835 in zend_call_function () from /usr/lib64/apache2/modules/libphp5.so

#20 0x00007fa7d474654e in zif_call_user_func_array () from /usr/lib64/apache2/modules/libphp5.so

#21 0x00007fa7d4908ffb in ?? () from /usr/lib64/apache2/modules/libphp5.so

#22 0x00007fa7d490e853 in ?? () from /usr/lib64/apache2/modules/libphp5.so

#23 0x00007fa7d4907f37 in execute () from /usr/lib64/apache2/modules/libphp5.so

#24 0x00007fa7d48ca8eb in zend_execute_scripts () from /usr/lib64/apache2/modules/libphp5.so

#25 0x00007fa7d4825a4f in php_execute_script () from /usr/lib64/apache2/modules/libphp5.so

#26 0x00007fa7d49d99c1 in ?? () from /usr/lib64/apache2/modules/libphp5.so

#27 0x000000000043a60f in ap_run_handler ()

#28 0x000000000043dd0e in ap_invoke_handler ()

#29 0x0000000000448acc in ap_internal_redirect ()

#30 0x00007fa7d6773f45 in ?? () from /usr/lib64/apache2/modules/mod_rewrite.so

#31 0x000000000043a60f in ap_run_handler ()

#32 0x000000000043dd0e in ap_invoke_handler ()

#33 0x0000000000448c68 in ap_process_request ()

#34 0x0000000000445bb8 in ?? ()

#35 0x0000000000441c07 in ap_run_process_connection ()

#36 0x000000000044e8a7 in ?? ()

#37 0x00007fa7db192c1a in start_thread () from /lib64/libpthread.so.0

#38 0x00007fa7dacf42cd in clone () from /lib64/libc.so.6

 
```

Apache segfault causally. First of all i suspected Zend, but i dont use zend extension and in my php.ini i  turned off all settings belong to Zend.  

Did you recognize from coredump, what causes the segfault?  Many thanks for any idea.

emerge info:

```

ACCEPT_KEYWORDS="amd64"

ACCEPT_LICENSE="* -@EULA"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-march=core2 -O2 -pipe"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.2/ext-active/ /etc/php/apache2-php5.3/ext-active/ /etc/php/cgi-php5.2/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.2/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-march=core2 -O2 -pipe"

DISTDIR="/usr/portage/distfiles"

FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"

FFLAGS=""

GENTOO_MIRRORS="http://gentoo.mirror.dkm.cz/pub/gentoo/ http://ftp.fi.muni.cz/pub/linux/gentoo/ ftp://ftp.fi.muni.cz/pub/linux/gentoo/"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

MAKEOPTS="-j16"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY=""

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

USE="acl amd64 bash-completion berkdb bzip2 cli cracklib crypt cups cxx dri fortran gdbm gpm iconv ipv6 mmx modules mudflap multilib ncurses nls nptl nptlonly openmp pam pcre pppd readline session sse sse2 ssl sysfs tcpd unicode vim-syntax zlib" 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" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" APACHE2_MPMS="worker" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" 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 ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga neomagic nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" 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, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

```

----------

## gimpel

Seems common since php-5.3. https://forums.gentoo.org/viewtopic-t-906880-start-0.html

----------

