暇人じゃない

php5-fpm をアップデートしたら double free or corruption

このブログが動いているサーバーの PHP を 5.4.7 から 5.4.11 にアップデートしました。

ちなみにリポジトリは dotdeb を使用しています。

バージョンアップしたのは良いのですが、php5-fpm を再起動する時にエラー(警告?)が表示されるようになりました。

Processing triggers for php5-fpm ... 
Restarting PHP5 FastCGI Process Manager: php5-fpm*** glibc detected *** /usr/sbin/php5-fpm: double free or corruption (out): 0x00
007f3d4b2096b0 ***
======= Backtrace: =========
/lib/libc.so.6(+0x71e16)[0x7f3d48272e16]
/lib/libc.so.6(cfree+0x6c)[0x7f3d48277b8c]

(略)

Google 先生に聞いてみると、glibc がメモリの二重解放を検出 した時に表示されるメッセージのようです。

僕の場合は、PECL 経由でインストールしていた APC をアップデートすることでこの問題を解決しました:

% sudo pecl upgrade apc

downloading APC-3.1.13.tgz ...
Starting to download APC-3.1.13.tgz (171,591 bytes)

(略)

Build process completed successfully
Installing '/usr/lib/php5/20100525/apc.so'
Installing '/usr/include/php5/ext/apc/apc_serializer.h'
upgrade ok: channel://pecl.php.net/APC-3.1.13
configuration option "php_ini" is not set to php.ini location
You should add "extension=apc.so" to php.ini

php5-fpm を再起動:

% sudo service php5-fpm restart
Restarting PHP5 FastCGI Process Manager: php5-fpm.

ろくに調べもせずにアップデートを行ったため、他に解決する方法があるかもしれませんが…
誰かの助けになればと思います。

最後に、ログの全文を載せておきます:

Processing triggers for php5-fpm ... Restarting PHP5 FastCGI Process Manager: php5-fpm*** glibc detected *** /usr/sbin/php5-fpm: double free or corruption (out): 0x00
007f3d4b2096b0 ***
======= Backtrace: =========
/lib/libc.so.6(+0x71e16)[0x7f3d48272e16]
/lib/libc.so.6(cfree+0x6c)[0x7f3d48277b8c]
/usr/sbin/php5-fpm(destroy_zend_class+0x255)[0x6ba285]
/usr/sbin/php5-fpm(zend_hash_clean+0x73)[0x6d0513]
/usr/lib/php5/20100525/apc.so(apc_interned_strings_shutdown+0x20)[0x7f3d46bea0c0]
/usr/lib/php5/20100525/apc.so(apc_module_shutdown+0x12a)[0x7f3d46be263a]
/usr/lib/php5/20100525/apc.so(+0xafdf)[0x7f3d46bd8fdf]
/usr/sbin/php5-fpm[0x6c9555]
/usr/sbin/php5-fpm[0x6cfe95]
/usr/sbin/php5-fpm(zend_hash_graceful_reverse_destroy+0x18)[0x6d0118]
/usr/sbin/php5-fpm[0x6c3a9e]
/usr/sbin/php5-fpm(php_module_shutdown+0x2d)[0x664e6d]
/usr/sbin/php5-fpm[0x778b69]
/usr/sbin/php5-fpm[0x7700ce]
/usr/sbin/php5-fpm[0x77e989]
/usr/sbin/php5-fpm[0x76f483]
/usr/sbin/php5-fpm[0x776da3]
/lib/libc.so.6(__libc_start_main+0xfd)[0x7f3d4821fc8d]
/usr/sbin/php5-fpm[0x42fb89]
======= Memory map: ========
00400000-00b65000 r-xp 00000000 fe:01 1720497                            /usr/sbin/php5-fpm
00d65000-00e09000 r--p 00765000 fe:01 1720497                            /usr/sbin/php5-fpm
00e09000-00e13000 rw-p 00809000 fe:01 1720497                            /usr/sbin/php5-fpm
00e13000-00e30000 rw-p 00000000 00:00 0
00fdf000-011f0000 rw-p 00000000 00:00 0                                  ```heap
7f3d40000000-7f3d40021000 rw-p 00000000 00:00 0
7f3d40021000-7f3d44000000 ---p 00000000 00:00 0
7f3d449c1000-7f3d449cd000 r-xp 00000000 fe:01 11640854                   /lib/libnss_files-2.11.3.so
7f3d449cd000-7f3d44bcc000 ---p 0000c000 fe:01 11640854                   /lib/libnss_files-2.11.3.so
7f3d44bcc000-7f3d44bcd000 r--p 0000b000 fe:01 11640854                   /lib/libnss_files-2.11.3.so
7f3d44bcd000-7f3d44bce000 rw-p 0000c000 fe:01 11640854                   /lib/libnss_files-2.11.3.so
7f3d46bce000-7f3d46bf0000 r-xp 00000000 fe:01 1820022                    /usr/lib/php5/20100525/apc.so
7f3d46bf0000-7f3d46df0000 ---p 00022000 fe:01 1820022                    /usr/lib/php5/20100525/apc.so
7f3d46df0000-7f3d46df3000 rw-p 00022000 fe:01 1820022                    /usr/lib/php5/20100525/apc.so
7f3d46df3000-7f3d46dfc000 rw-p 00000000 00:00 0
7f3d47856000-7f3d4786c000 r-xp 00000000 fe:01 11640835                   /lib/libgcc_s.so.1
7f3d4786c000-7f3d47a6b000 ---p 00016000 fe:01 11640835                   /lib/libgcc_s.so.1
7f3d47a6b000-7f3d47a6c000 rw-p 00015000 fe:01 11640835                   /lib/libgcc_s.so.1
7f3d47a6c000-7f3d47be1000 r--p 00000000 fe:01 1737076                    /usr/lib/locale/locale-archive
7f3d47be1000-7f3d47be3000 r-xp 00000000 fe:01 11640845                   /lib/libkeyutils.so.1.3
7f3d47be3000-7f3d47de2000 ---p 00002000 fe:01 11640845                   /lib/libkeyutils.so.1.3
7f3d47de2000-7f3d47de3000 rw-p 00001000 fe:01 11640845                   /lib/libkeyutils.so.1.3
7f3d47de3000-7f3d47dea000 r-xp 00000000 fe:01 1722994                    /usr/lib/libkrb5support.so.0.1
7f3d47dea000-7f3d47fea000 ---p 00007000 fe:01 1722994                    /usr/lib/libkrb5support.so.0.1
7f3d47dea000-7f3d47fea000 ---p 00007000 fe:01 1722994                    /usr/lib/libkrb5support.so.0.1
7f3d47fea000-7f3d47feb000 rw-p 00007000 fe:01 1722994                    /usr/lib/libkrb5support.so.0.1
7f3d47feb000-7f3d47ffe000 r-xp 00000000 fe:01 11641280                   /lib/libresolv-2.11.3.so
7f3d47ffe000-7f3d481fd000 ---p 00013000 fe:01 11641280                   /lib/libresolv-2.11.3.so
7f3d481fd000-7f3d481fe000 r--p 00012000 fe:01 11641280                   /lib/libresolv-2.11.3.so
7f3d481fe000-7f3d481ff000 rw-p 00013000 fe:01 11641280                   /lib/libresolv-2.11.3.so
7f3d481ff000-7f3d48201000 rw-p 00000000 00:00 0
7f3d48201000-7f3d4835a000 r-xp 00000000 fe:01 11641288                   /lib/libc-2.11.3.so
7f3d4835a000-7f3d48559000 ---p 00159000 fe:01 11641288                   /lib/libc-2.11.3.so
7f3d48559000-7f3d4855d000 r--p 00158000 fe:01 11641288                   /lib/libc-2.11.3.so
7f3d4855d000-7f3d4855e000 rw-p 0015c000 fe:01 11641288                   /lib/libc-2.11.3.so
7f3d4855e000-7f3d48563000 rw-p 00000000 00:00 0
7f3d48563000-7f3d486aa000 r-xp 00000000 fe:01 1721614                    /usr/lib/libxml2.so.2.7.8
7f3d486aa000-7f3d488a9000 ---p 00147000 fe:01 1721614                    /usr/lib/libxml2.so.2.7.8
7f3d488a9000-7f3d488b2000 rw-p 00146000 fe:01 1721614                    /usr/lib/libxml2.so.2.7.8
7f3d488b2000-7f3d488b4000 rw-p 00000000 00:00 0
7f3d488b4000-7f3d488b7000 r-xp 00000000 fe:01 11640911                   /lib/libcom_err.so.2.1
7f3d488b7000-7f3d48ab6000 ---p 00003000 fe:01 11640911                   /lib/libcom_err.so.2.1
7f3d48ab6000-7f3d48ab7000 rw-p 00002000 fe:01 11640911                   /lib/libcom_err.so.2.1
7f3d48ab7000-7f3d48adc000 r-xp 00000000 fe:01 1722996                    /usr/lib/libk5crypto.so.3.1
7f3d48adc000-7f3d48cdb000 ---p 00025000 fe:01 1722996                    /usr/lib/libk5crypto.so.3.1
7f3d48cdb000-7f3d48cdd000 rw-p 00024000 fe:01 1722996                    /usr/lib/libk5crypto.so.3.1
7f3d48cdd000-7f3d48d9b000 r-xp 00000000 fe:01 1722999                    /usr/lib/libkrb5.so.3.3
7f3d48d9b000-7f3d48f9a000 ---p 000be000 fe:01 1722999                    /usr/lib/libkrb5.so.3.3
7f3d48f9a000-7f3d48fa5000 rw-p 000bd000 fe:01 1722999                    /usr/lib/libkrb5.so.3.3
7f3d48fa5000-7f3d48fd8000 r-xp 00000000 fe:01 1723001                    /usr/lib/libgssapi_krb5.so.2.2
7f3d48fd8000-7f3d491d8000 ---p 00033000 fe:01 1723001                    /usr/lib/libgssapi_krb5.so.2.2
7f3d491d8000-7f3d491da000 rw-p 00033000 fe:01 1723001                    /usr/lib/libgssapi_krb5.so.2.2
7f3d491da000-7f3d491ef000 r-xp 00000000 fe:01 11641292                   /lib/libnsl-2.11.3.so
7f3d491ef000-7f3d493ee000 ---p 00015000 fe:01 11641292                   /lib/libnsl-2.11.3.so
7f3d493ee000-7f3d493ef000 r--p 00014000 fe:01 11641292                   /lib/libnsl-2.11.3.so
7f3d493ef000-7f3d493f0000 rw-p 00015000 fe:01 11641292                   /lib/libnsl-2.11.3.so
7f3d493f0000-7f3d493f2000 rw-p 00000000 00:00 0
7f3d493f2000-7f3d493f4000 r-xp 00000000 fe:01 11641300                   /lib/libdl-2.11.3.so
7f3d493f4000-7f3d495f4000 ---p 00002000 fe:01 11641300                   /lib/libdl-2.11.3.so
7f3d495f4000-7f3d495f5000 r--p 00002000 fe:01 11641300                   /lib/libdl-2.11.3.so
7f3d495f5000-7f3d495f6000 rw-p 00003000 fe:01 11641300                   /lib/libdl-2.11.3.so
7f3d495f6000-7f3d49676000 r-xp 00000000 fe:01 11641301                   /lib/libm-2.11.3.so failed!