2011-10-12 105 views
82

我正在使用Apache/PHP/MySQL堆棧。
使用CakePHP作爲框架。「[notice] child pid XXXX exit signal Segmentation fault(11)」in apache error.log

我偶爾會看到一個空白的白頁。我無法通過調試蛋糕,所以我偷看在Apache error.log中和這裏就是我得到:

[Wed Oct 12 15:27:23 2011] [notice] child pid 3580 exit signal Segmentation fault (11) 
[Wed Oct 12 15:27:34 2011] [notice] child pid 3581 exit signal Segmentation fault (11) 
[Wed Oct 12 15:30:52 2011] [notice] child pid 3549 exit signal Segmentation fault (11) 
[Wed Oct 12 16:04:27 2011] [notice] child pid 3579 exit signal Segmentation fault (11) 
zend_mm_heap corrupted 
[Wed Oct 12 16:26:24 2011] [notice] child pid 3625 exit signal Segmentation fault (11) 
[Wed Oct 12 17:57:24 2011] [notice] child pid 3577 exit signal Segmentation fault (11) 
[Wed Oct 12 17:58:54 2011] [notice] child pid 3550 exit signal Segmentation fault (11) 
[Wed Oct 12 17:59:52 2011] [notice] child pid 3578 exit signal Segmentation fault (11) 
[Wed Oct 12 18:01:38 2011] [notice] child pid 3683 exit signal Segmentation fault (11) 
[Wed Oct 12 22:20:53 2011] [notice] child pid 3778 exit signal Segmentation fault (11) 
[Wed Oct 12 22:29:51 2011] [notice] child pid 3777 exit signal Segmentation fault (11) 
[Wed Oct 12 22:33:42 2011] [notice] child pid 3774 exit signal Segmentation fault (11) 

這是什麼分段錯誤,我怎麼能解決這個問題,我不知道和會非常棒。

UPDATE:

PHP Version 5.3.4, OSX local development 
Server version: Apache/2.2.17 (Unix) 
CakePhp: 1.3.10 
+0

需要更多的配置信息,例如,如果php和使用的模塊的版本是最新的,如果您使用某種緩存或加速器。 – CodeCaster

+0

你能告訴我你需要什麼信息和如何得到它,所以我可以發佈它? – mgPePe

+0

另外檢查:http://stackoverflow.com/questions/15689765/apc-and-child-pid-xxxxx-exit-signal-segmentation-fault/15724464#15724464 – trante

回答

54

將gdb附加到其中一個httpd子進程並重新加載或繼續工作並等待崩潰,然後查看回溯。做這樣的事情:

$ ps -ef|grep httpd 
0  681  1 0 10:38pm ??   0:00.45 /Applications/MAMP/Library/bin/httpd -k start 
501 690 681 0 10:38pm ??   0:00.02 /Applications/MAMP/Library/bin/httpd -k start 

...

現在GDB連接到其中一個子進程,在這種情況下PID 690(列UID,PID,PPID,...)

$ sudo gdb 
(gdb) attach 690 
Attaching to process 690. 
Reading symbols for shared libraries . done 
Reading symbols for shared libraries ....................... done 
0x9568ce29 in accept$NOCANCEL$UNIX2003() 
(gdb) c 
Continuing. 

等待崩潰了...然後:

(gdb) backtrace 

或者

(gdb) backtrace full 

應該給你一些線索是怎麼回事。如果您提交錯誤報告,則應包含回溯。

如果崩潰很難重現,那麼將Apache配置爲僅使用一個子進程處理請求可能是一個好主意。配置是這樣的:

StartServers 1 
MinSpareServers 1 
MaxSpareServers 1 
+1

我剛剛遇到這個問題,看起來當我有gdb連接到子進程時,我沒有得到segfault,並且apache沒有完成渲染頁面。 (重現segfault否則只是刷新刷新的問題,因爲它發生在每次重新加載時)。自從我在C日子裏接近金屬工具鏈以來,已經有一段時間了。我想知道爲什麼它會表現出這種行爲。它沒有從我的構建中找到很多符號,但是這隻會產生一個信息量較少的回溯行爲? – lucian303

+0

嗯,這很奇怪。你能確定segfaults實際上是你連接gdb的進程嗎?檢查'dmesg'是否爲segfaulted進程的pid。 –

+0

GDB不起作用。給我'無法訪問進程ID爲70的任務:(os/kern)失敗。「 – mgPePe

18

甲segementation故障是在PHP內部錯誤(或可能性較小,阿帕奇)。通常情況下,分段錯誤是由較新和較少測試的php模塊之一引起的,例如imagemagick或subversion。

嘗試禁用所有非必要模塊(在php.ini中),然後逐個重新啓用它們直到發生錯誤。你可能也想更新php和apache。

如果這沒有幫助,你應該report a php bug

+0

但我怎麼知道它是哪一個? – mgPePe

16

您是否嘗試過在您的php.ini中增加output_buffering?

What does "zend_mm_heap corrupted" mean

+2

我有一些更新後的debian與apache/php/mysql擠壓相同的問題。我將它設置爲'output_buffering = 4096',現在頁面再次工作。 Thx – rubo77

+2

而對於我而言,只有'output_buffering = 8192'起作用。非常感謝! – Oleg

+1

現在,在另一頁上,'output_buffering = 8192'會導致段錯誤,通過設置'output_buffering = Off'來修復。我很困惑。 – Oleg

相關問題