php long footsteps, reported 502

php-fpm timeout request_terminate_timeout analysis
of original loophome Last post on 2017-11-22 16:17:59 reading number 21201 Collection
launched
today found a very wonderful thing, php log for a time-out log, but in my request_terminate_timeout is set to 0, in theory, there should be no timeout son.

PHP Fatal error:  Maximum execution time of 30 seconds exceeded in ...

OK, now listed first configuration:

php-fpm:
request_terminate_timeout = 0
php.ini:
max_execution_time = 30

Check out a first look at php-fpm file comments on the request_terminate_timeout

; 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


This comment illustrates, request_terminate_timeout apply when max_execution_time due time for any reason can not terminate the script, this will get rid of php-fpm request.
Look at the comments max_execution_time: This sets the maximum execution time of the script before the parser is allowed to abort, the default is 30s. It appears that my request should be max_execution_time This setting blown away.

Well, I did not give up, did an experiment:

php-fpm request_terminate_timeout 15 provided 0
the php.ini provided the max_execution_time 30 30
Results of php Fatal error timeout has log, http status code 500 php no timeout Fatal error log, http status code 502, php-fpm log for sub kill process log

Well, the conclusion is php web request execution time by controlling 2, one is the php.ini max_execution_time (Note that sleep, http request is not waiting for a response, the calculation here is the real execution time), php-fpm request_terminate_timeout other is provided, the operator is requesting to start n seconds.
----------------
Disclaimer: This article is the original article CSDN bloggers "loophome", and follow CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement. .
Original link: https: //blog.csdn.net/loophome/article/details/78604986

Guess you like

Origin www.cnblogs.com/php-linux/p/12597544.html