openlabs / docker-wkhtmltopdf-aas

wkhtmltopdf in a docker container as a web service.
BSD 3-Clause "New" or "Revised" License
99 stars 94 forks source link

timeout at 30 seconds #22

Closed MikeyF-Anovia closed 7 years ago

MikeyF-Anovia commented 7 years ago

On larger pdf's, at 30 seconds we receive [CRITICAL] WORKER TIMEOUT (pid:762). The pid changes each time of course. If I remove some of the html I am able to shorten the amount of time needed to build the pdf to below 30 seconds and it works. So I believe this is a genuine timeout issue due to a larger amount of html.

Research indicates that this is a gunicorn timeout. Explaining how to set gunicorn options is on the list of to-do's at https://github.com/openlabs/docker-wkhtmltopdf-aas. Can you explain how to set the gunicorn timeout? Or do you have any other suggestions?

Thanks, -Mikey

MikeyF-Anovia commented 7 years ago

For docker cloud, adjust the docker run command for the wkhtmlpdf service to include the timeout value. We adjusted ours to include --timeout 180 (3 minutes) -b 0.0.0.0:80 --timeout 180 --log-file - app:application

This resolved the gunicorn timeout. We also had to bump up timeout values for various other services where appropriate (nodejs express & request libraries, proxy services, etc)

For local instances and debugging add or adjust the docker-compose yml file to include the timeout in the command parameter command: ["-b", "0.0.0.0:80", "--timeout", "180", "--log-file", "-", "app:application"]

I'm pretty green with docker, so this may not be the most optimal method to achieve this, however this is what I was able to deduce from my research and it worked for me.