Radek
Radek

Reputation: 11091

How to solve "mod_fastcgi.c.2566 unexpected end-of-file (perhaps the fastcgi process died)" when calling .php that takes long time to execute?

In my php application I restore db2 database. It works fine but here is one huge one 2.9GB that finishes with 500 - Internal Server Error.

I use exec() to run unix shell commands from .php - cp, db2 etc. The same error happens when running from firefox or ruby script.

I have to copy the backup image file first which takes few minutes. Then I call db2 to restored the image. For this particular database the php process finishes with above error. Then I can find this in the error log file

2012-08-02 10:25:18: (mod_fastcgi.c.2566) unexpected end-of-file (perhaps the fastcgi process died): pid: 0 socket: tcp:127.0.0.1:9090
2012-08-02 10:25:18: (mod_fastcgi.c.3352) response not received, request sent: 2758 on socket: tcp:127.0.0.1:9090 for /wrational/tools/rationalTest.php?mode=restore&database=RATIONAL&from_database=dbb&dbbackuptype=weekly, closing connection

I set both default_socket_timeout and max_execution_time to 5660 in php.ini and confirmed that it is set by phpinfo() but it doesn't look like it helped.

Any idea how I can make this one work?

update

It looks like it dies after 40mins. The corresponding line in access.log file look like

"GET /rational/tools/rationalTest.php?mode=restore&from_database=dbb&dbbackuptype=weekly HTTP/1.1" 500 369 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:11.0) Gecko/20100101 Firefox/11.0"

Upvotes: 3

Views: 3739

Answers (1)

Radek
Radek

Reputation: 11091

Looks like request_terminate_timeout option in php-fpm.ini was causing the troubles. It was set to 30 mins. I changed it to 0 and it looks good so far. Need to do more testing though.

; The timeout for serving a single request after which the worker process will
; be killed. This option should be used when the 'max_execution_time' ini option
; does not stop script execution for some reason. A value of '0' means 'off'.  
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0

Upvotes: 1

Related Questions