2012-07-05 40 views
2

我正在調試Apache,Fast-CGI和我們的Perl應用程序的問題。 根本原因是Perl應用程序需要退出並在完成特定操作時重新加載。 在CGI下,這不是問題,因爲應用程序正在爲每個請求加載。在Apache上自行停止fast-cgi應用程序

但是,它看到Fast CGI協議沒有考慮到這種情況 - 沒有辦法通知Web服務器您將要退出 - 您只需退出。

但是這樣做,我們遇到了mod_fastcgi方面看起來像競爭條件:它認識到編程已退出,但隨後嘗試發送請求。最終它放棄並將錯誤500返回給瀏覽器。

我在網上看到類似的錯誤消息,但是這些都是關於PHP在500次請求後退出,解決方法是告訴fastcgi將每個進程的請求限制爲500次。這不符合我的問題,因爲我需要根據某些請求退出,而不是在固定數量的請求之後退出。

信息: Apache模塊加載:

LoadModule fastcgi_module libexec/apache2/mod_fastcgi.so 

兩個日誌行:服務器檢測到的應用程序退出,但隨後試圖將其連接

[Thu Jul 05 15:02:32 2012] [warn] FastCGI: (dynamic) server "/Users/sfomberg/Sites/cgi-bin/mt/mt.cgi" (pid 9277) terminated by calling exit with status '0' 
[Thu Jul 05 15:02:32 2012] [warn] FastCGI: (dynamic) server "/Users/sfomberg/Sites/cgi-bin/mt/mt.cgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds 

最後,放棄:

[Thu Jul 05 15:03:07 2012] [error] [client 127.0.0.1] FastCGI: comm with (dynamic) server "/Users/sfomberg/Sites/cgi-bin/mt/mt.cgi" aborted: (first read) idle timeout (30 sec), referer: http://localhost/~sfomberg/cgi-bin/mt/mt.cgi?__mode=cfg_plugins&blog_id=0&switched=1 
[Thu Jul 05 15:03:07 2012] [error] [client 127.0.0.1] FastCGI: incomplete headers (0 bytes) received from server "/Users/sfomberg/Sites/cgi-bin/mt/mt.cgi", referer: http://localhost/~sfomberg/cgi-bin/mt/mt.cgi?__mode=cfg_plugins&blog_id=0&switched=1 

我試圖在結束請求之前直接關閉偵聽套接字t,(偵聽套接字是fileno 0)但沒有奏效。

謝謝。

回答

0

問題是因爲mod_fastcgi是一箇舊版本 - 2.4.2 升級到2.4.6解決了它。

另外,mod_fcgid沒有這個問題。