Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggest setting request_terminate_timeout_track_finished = yes in Performance Tuning page #19768

Open
tom-- opened this issue Feb 17, 2023 · 0 comments
Labels
type:docs Documentation

Comments

@tom--
Copy link
Contributor

tom-- commented Feb 17, 2023

PHP 7.3 introduced the FPM ini config directive request_terminate_timeout_track_finished. I think the Performance Tuning of the Yii 2 def guide should suggest turning it on.

I quote PHP Manual below and there's a discussion of why this config was needed here.

request_terminate_timeout mixed

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.

request_terminate_timeout_track_finished bool

The timeout set by request_terminate_timeout is not engaged after a fastcgi_finish_request or when application has finished and internal shutdown functions are being called. This directive will enable timeout limit to be applied unconditionally even in such cases. Default value: no. Since PHP 7.3.0.

Yii's session, error handler and logging components (which are by convention defaults in Yii apps) all register shutdown functions.

So if an FPM request to a Yii app gets stuck after finishing then the request_terminate_timeout will not kill the FPM worker and it will hang indefinitely. Iiuc, PHP devs considered this a bug in FPM and introduced request_terminate_timeout_track_finished as the fix. But it is off by default.

@samdark samdark added pr:too many objectives It is impossible to review pull request because it does too many things at once. type:docs Documentation and removed pr:too many objectives It is impossible to review pull request because it does too many things at once. labels Feb 20, 2023
@yii-bot yii-bot closed this as completed Feb 20, 2023
@yiisoft yiisoft deleted a comment from yii-bot Feb 20, 2023
@samdark samdark reopened this Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:docs Documentation
Projects
None yet
Development

No branches or pull requests

3 participants