-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Memory leaks due to str_pad()
in yii\base\ErrorHandler::register()
#19738
Comments
The memory reserved should be freed if the object is destroyed. I guess the bridge package could solve it by killing the app instance and de-registering error handler. |
Anyway, that's not the framework issue but likely an issue of the bridge package. If not, please feel free to submit a pull request with a fix. |
@samdark, I think, the whole idea of RoadRunner-based approach is not to kill an application instance with every request, so that the framework can process long-living request-response loop. And, I suppose, the framework could handle its memory consumption here. Anyway, I guess, I should open an issue in that bridge repository. Thanks for the reply! |
Not sure how RoadRunner handles PHP memory limit but if memory limit exception handling works without the trick we use here you can set the size of errorHandling reserve to 0. |
Hi there!
I’m using Yii2 with RoadRunner through
charlesportwoodii/yii2-psr7-bridge
package (https://github.com/charlesportwoodii/yii2-psr7-bridge).I had set
memprof
extension (https://github.com/arnaud-lb/php-memory-profiler/) to dump memory profile every 1000 processed requests and got some interesting results:Almost all memory leaks are caused by
yii\base\ErrorHandler::register()
method which internally usesstr_pad()
to reserve some merory for fatal error handling:It works perfect in classic (but not performant) PHP short-living application approach but behaves badly in long-running approach where one application instance responses to many requests.
Any ideas on how we can fix this?
What steps will reproduce the problem?
charlesportwoodii/yii2-psr7-bridge
.memprof
with somememprof_enable()
andmemprof_dump_callgrind()
calls.What is the expected result?
yii\base\ErrorHandler::register()
reserves memory for fatal exception handler only once and not for every request. (?)What do you get instead?
yii\base\ErrorHandler::register()
reserves memory for fatal exception handler for every request.Additional info
The text was updated successfully, but these errors were encountered: