BookStack icon indicating copy to clipboard operation
BookStack copied to clipboard

Env file option to encrease PDF render timeout

Open baevga opened this issue 2 years ago • 5 comments

Describe the feature you'd like

Hello!

I faced with timeout issue while pdf export and didn't find the option of .env file to control this behaiviour. [2024-01-22 20:04:17] production.ERROR: The process "/usr/local/bin/wkhtmltopdf --lowquality --page-size 'A4' --outline --print-media-type '/tmp/knp_snappy65ae9fd597ee72.18454063.html' '/tmp/knp_snappy65ae9fd5a8eac8.16039684.pdf'" exceeded the timeout of 60 seconds. {"userId":3,"exception":"[object] (Symfony\\Component\\Process\\Exception\\ProcessTimedOutException(code: 0): The process \"/usr/local/bin/wkhtmltopdf --lowquality --page-size 'A4' --outline --print-media-type '/tmp/knp_snappy65ae9fd597ee72.18454063.html' '/tmp/knp_snappy65ae9fd5a8eac8.16039684.pdf'\" exceeded the timeout of 60 seconds. at /var/www/bookstack/vendor/symfony/process/Process.php:1152)

I found app/Config/snappy.php file where i changed 'timeout' => false value to 120 seconds and after that it became working. But it will override during next update and i belive it should be great to have option to change it permanently using config.

Thank you!

Describe the benefits this would bring to existing BookStack users

Exporting huge books to pdf

Can the goal of this request already be achieved via other means?

No

Have you searched for an existing open/closed issue?

  • [X] I have searched for existing issues and none cover my fundamental request

How long have you been using BookStack?

3 months to 1 year

Additional context

No response

baevga avatar Jan 22 '24 17:01 baevga

Hello, i create pull request on it: https://github.com/BookStackApp/BookStack/pull/4792

lexasub avatar Jan 23 '24 05:01 lexasub

Thanks for the request @baevga. I'm hesitant to increase the limit here though, or make it configurable, since 60 seconds is already quite a lot and needing longer is usually an indicator of an underlying issue rather.

Thanks for the PR @lexasub but the change in that PR likely does not affect PDFs, or any functionality in BookStack, and as above I'm not keen in increasing this or making it configurable.

ssddanbrown avatar Jan 23 '24 12:01 ssddanbrown

Thank you for your so fast answer @ssddanbrown !

I'm sad panda :( I thought configurable option can't cause any negative effect. We have pretty big book such as usage guide and exporting of it is taking more then 60 sec. Of course, maybe, if use more resources it can be faster but i'm not very happy to increase hw resourses only for this operation because in any other operations bookstack is rocket.

I'll be happy if this option will appear in some future releases.

baevga avatar Jan 23 '24 12:01 baevga

It would be great if this could be implemented.

We are facing the same problem right now, and it would be kind of a waste of resources to increase the overall server resources just for the export of a huge book or shelf in general, which happens every now and then.

abr1x avatar Feb 05 '24 10:02 abr1x

When using the default PDF export package, you can modify your php-local.ini (/config/php/php-local.ini or bookstack_app_data/php/php_local.ini in the lscr.io docker image) to increase the timeout. Adding a max_execution_time = 300 fixed any issues with exporting ridiculously long PDFs that we had. Is this a good idea? Not really. Does it work? Yes.

DanielGordonIT avatar Feb 15 '24 21:02 DanielGordonIT