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

wkhtmltopdf processes becomes zombie #24

Closed
drmax24 opened this issue Apr 12, 2017 · 8 comments
Closed

wkhtmltopdf processes becomes zombie #24

drmax24 opened this issue Apr 12, 2017 · 8 comments

Comments

@drmax24
Copy link

drmax24 commented Apr 12, 2017

In our code that uses mikehaertl/phpwkhtmltopdf we have an option:
['window-status'=>'ready-to-print']

However on some occasions ready-to-print is not set in js. In this case wkhtmltopdf processes will never stop. And after some time we have hundreds of zombie-processes. Is it possible to set max execution time for wkhtmltopdf?

mikehaertl/phpwkhtmltopdf#223

P.S.:
ini_set('max_execution_time', 15);
Should do the job to kill php process and wkhtmltopdf with it right? It does not.

28378 www 1 20 0 213M 31292K piperd 5 0:01 0.00% php-fpm
28588 www 1 20 0 213M 31304K piperd 0 0:01 0.00% php-fpm

It hangs on piperead. max_execution_time apperantly does not work for piperead.


wkhtmltopdf -V
wkhtmltopdf 0.12.4 (with patched qt)

mikehaertl/php-shellcommand 1.2.4
mikehaertl/php-tmpfile 1.1.0
mikehaertl/phpwkhtmltopdf 2.2.1

PHP 7.0.13 (php-fpm)

@drmax24 drmax24 changed the title wkhtmltopdf processes never stop wkhtmltopdf processes never stops Apr 12, 2017
@drmax24 drmax24 changed the title wkhtmltopdf processes never stops wkhtmltopdf processes becomes zombie Apr 12, 2017
@mikehaertl
Copy link
Owner

Right. As I've said in mikehaertl/phpwkhtmltopdf#223 the implementation is not so easy. AFAIK there's no feature in PHP to set a timeout for command execution. See http://php.net/manual/en/function.proc-open.php. If you find a way, let us know and we can try to implement it.

@francoism90
Copy link

@mikehaertl It is possible to use the Linux timeout command before the executable. Don't know if that is an option.

@mikehaertl
Copy link
Owner

@francoism90 Hmm, interesting idea. But we can't assume that this command is available everywhere. So if we add it, it should definitely be optional. It would also add quite some complexity to the library. Something which I try to avoid as much as I can to keep maintenance efforts for the library at a reasonable level :).

@francoism90
Copy link

francoism90 commented Aug 4, 2017

@mikehaertl But it's much more simple to just set timeout before the command.

@drmax24
Copy link
Author

drmax24 commented Mar 2, 2018

Any news on this?

@mikehaertl
Copy link
Owner

@drmax24 Unless you have a suggestion on how to solve it - no, no news here.

@mikehaertl
Copy link
Owner

@drmax24 Not sure if you're still interested but after the change in 1.5.0 it was now easy to implement a timeout feature. Any feedback on #42 welcome.

@mikehaertl
Copy link
Owner

Release 1.6.0 now contains the new timeout setting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants