简体   繁体   English

PHP APC导致Apache分段故障

[英]PHP APC causing Apache to seg fault

First, versions: 一,版本:

Apache 2.2.22 阿帕奇2.2.22
PHP 5.3.10 PHP 5.3.10
Ubuntu 12.04 LTS (everything updated) Ubuntu 12.04 LTS(所有更新)
APC 3.1.7 (installed via APT and not PEAR) APC 3.1.7(通过APT而非PEAR安装)

The problem I'm experiencing is that when issuing a graceful restart ( sudo service apache2 graceful ), PHP has a fatal error which causes Apache to seg fault. 我遇到的问题是,在发出正常重启( sudo service apache2 graceful )时,PHP出现致命错误,导致Apache seg错误。 This is what I see in /var/log/apache2/error.log : 这是我在/var/log/apache2/error.log看到的内容:

[Tue Apr 30 11:05:33 2013] [notice] Graceful restart requested, doing restart
PHP Fatal error:  PHP Startup: apc_mmap: mmap failed: in Unknown on line 0
[Tue Apr 30 11:05:34 2013] [notice] seg fault or similar nasty error detected in the parent process

/etc/php5/conf.d/apc.ini only contains the following: /etc/php5/conf.d/apc.ini仅包含以下内容:

extension=apc.so
apc.shm_size=256M

Linode is my host. Linode是我的主人。 I have the 1GB version with a 256MB swap partition, so 256M should be a reasonable value for apc.shm_size (prior to the recent Linode memory upgrade , I only had 512MB of memory, and apc.shm_size was set to 128M). 我有一个具有256MB交换分区的1GB版本,因此256M应该是apc.shm_size的合理值(在最近的Linode内存升级之前 ,我只有512MB的内存,而apc.shm_size设置为128M)。

Here is some general cache information as shown in apc.php : 这是一些一般的缓存信息,如apc.php所示:

APC Version 3.1.7
PHP Version 5.3.10-1ubuntu3.6
APC Host    [removed]
Server Software Apache/2.2.22 (Ubuntu)
Shared Memory   1 Segment(s) with 256.0 MBytes
(mmap memory, pthread mutex Locks locking)
Start Time  2013/04/30 11:09:44
Uptime  21 minutes
File Upload Support 1

Here are my runtime settings as shown in apc.php : 这是我的运行时设置,如apc.php所示:

apc.cache_by_default    1
apc.canonicalize    1
apc.coredump_unmap  0
apc.enable_cli  0
apc.enabled 1
apc.file_md5    0
apc.file_update_protection  2
apc.filters 
apc.gc_ttl  3600
apc.include_once_override   0
apc.lazy_classes    0
apc.lazy_functions  0
apc.max_file_size   1M
apc.mmap_file_mask  
apc.num_files_hint  1000
apc.preload_path    
apc.report_autofilter   0
apc.rfc1867 0
apc.rfc1867_freq    0
apc.rfc1867_name    APC_UPLOAD_PROGRESS
apc.rfc1867_prefix  upload_
apc.rfc1867_ttl 3600
apc.serializer  default
apc.shm_segments    1
apc.shm_size    256M
apc.slam_defense    1
apc.stat    1
apc.stat_ctime  0
apc.ttl 0
apc.use_request_time    1
apc.user_entries_hint   4096
apc.user_ttl    0
apc.write_lock  1

I've done a ton of searching around, but I just can't figure out what's causing this. 我已经做了大量的搜索工作,但是我根本不知道是什么原因造成的。 Is this perhaps a PHP or APC or Apache bug? 这可能是PHP或APC或Apache错误吗? Is there some configuration value I need to add/change? 我需要添加/更改一些配置值吗?

Thanks for any help! 谢谢你的帮助!

[edit] [编辑]
I just tried updating APC (removed it in apt and installed through PECL), but that didn't fix the problem. 我只是尝试更新APC(在apt中将其删除并通过PECL安装),但这并不能解决问题。 I still see seg faults with APC 3.1.13. 我仍然看到APC 3.1.13出现段错误。

It might have to do with the shared memory allowed for a segment in the OS which can be significantly lower then 256MB. 这可能与操作系统中某个段所允许的共享内存有关,该共享内存可能大大低于256MB。

Check the output of sudo sysctl kernel.shmmax . 检查sudo sysctl kernel.shmmax的输出。 On my debian machine it's 33554432 (32MB). 在我的debian机器上是33554432(32MB)。

As a possible solution. 作为一种可能的解决方案。 Try to increase apc.shm_segments to 256 / 32 = 8 in your APC config. 尝试在APC配置apc.shm_segments增加到apc.shm_segments = 8。 You could also change the allowed shared memory for a segment system wide to 256MB. 您还可以将段系统范围的允许共享内存更改为256MB。

sudo sysctl -w kernel.shmmax 268435456

After looking around, I noticed a troublesome line in /var/log/syslog : 环顾四周后,我发现/var/log/syslog出现了一条麻烦的行:

kernel: apache2[11303]: segfault at ffffffff ip b7647bd8 sp bfe854b0 error 7 in libpthread-2.15.so[b763f000+17000]

After a little Googling, I came across https://bugs.launchpad.net/ubuntu/+source/apache2/+bug/1159748 , a confirmed bug in the Ubuntu Apache distribution. 稍作搜索后,我遇到了https://bugs.launchpad.net/ubuntu/+source/apache2/+bug/1159748 ,这是Ubuntu Apache发行版中的一个已确认错误。 I'm glad I'm not crazy! 我很高兴我没有疯! If anyone else encounters this, be sure to follow the progress on this bug. 如果还有其他人遇到此问题,请确保遵循此错误的进度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM