-
-
Notifications
You must be signed in to change notification settings - Fork 145
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
Leaking temp files in PHP-FPM when max_execution_time interrupts the script #681
Comments
It's not lack of ram; as I've seen this going on, with plenty of free ram. Not even close to the limit. The bug shows periodically. The most problematisk thing is that a uploaded file of 400KB, turns into a 300-450MB file in /tmp, not ever to be cleaned up. I've been waiting with a clean-up solution, but today I ended up adding a job to the crontab, and extended our /tmp space to 5GB. It's a real pain, and I'm very surprised that it's still a thing. Googling the specific issue shows plenty of cases with people blaming WordPress, hosting solutions, LiteSpeed and so on 😆 ... But in the end Imagick are the one, eating up the /tmp folder. |
Indeed it's not, Imagemagick switches from RAM to swapfile using a configured limit, see the This is documented and controlled behaviour. I have not tested it, but I guess setting |
Our PHP application using tcpdf thats will call imagick to produce a PDF output. This will create large imagick temporay files in /tmp . We have users thats will generate their report in pdf. This create many imagick temp files that nearly 400MB each that eatup free space. The report not larger then 1MB. During peak hours, the execution time increase and users may aborted the PDF report generation, due to its take longer time to produce. This will leave the imagick temp files in /tmp without been deleted. We have create a cron to monitor this behavior and remove them if needed. We increase the max_execution_time to monitor this will help during peak hours. |
This is a follow-up of ImageMagick/ImageMagick#395 (comment)
I encountered a case where a PHP app ran imagick-related jobs that were too long wrt. to the
max_execution_time
limit. As a consequence, temporary image files woud not being cleaned up and would pile up in/tmp
.At this moment in time, I'm not sure if the PHP app's framework is responsible for explicitly creating the temp files or if they are automatically created by imagick (lack of RAM, swapping to disk).
I am wondering if the imagick extension would take care of releasing the Imagick objects and implicitly remove temp files in the case of a request terminated by a
max_execution_time
limit ?Because if that's not the case, I would recommend to the PHP developpers to make sure to always define a cleanup function with
register_shutdown_function()
and push the reponsability to them.The text was updated successfully, but these errors were encountered: