Closed iateadonut closed 1 year ago
i've added logging to the showPdf() methods in UserHinarioController and HinarioController to try to catch this bug.
we can reproduce the error by going here: https://nossairmandade.com/hinario/97/ARosaEAEstrela and clicking "Printable Version" this leads to a timeout:
[2023-02-27 12:47:37] local.ERROR: Maximum execution time of 120 seconds exceeded {"exception":"[object] (Symfony\Component\ErrorHandler\Error\FatalError(code: 0): Maximum execution time of 120 seconds exceeded at /home/dh_nossa/nossairmandade.com/vendor/mpdf/mpdf/src/Mpdf.php:15401) [stacktrace]
"}
So I wonder what we can do with this. Are the pdf's cached? If so, maybe we can write a script that runs once a day to cache the pdf's so when they are updated, they just pull from the cache that is created daily.
i added public function showPdf($hinarioId, $hinarioName) { ini_set('max_execution_time', 240);
an upper limit to max_execution_time which works on my localhost but does not work on the VPS. i've written a ticket to ask if they can change that.
dreamhost suggested we switch from php 8.2 fcgi to php 8.2 cgi. that and a custom php file:
[vps35459]$ cat ~/.php/8.2/phprc max_execution_time = 500 ; {{{ The following lines were automatically added by DreamHost zend_extension=opcache.so ; }}} That's all from DreamHost
solved the problem.
This error is in the logs:
Maximum execution time of 120 seconds exceeded {"exception":"[object] (Symfony\Component\ErrorHandler\Error\FatalError(code: 0): Maximum execution time of 120 seconds exceeded at /home/dh_nossa/nossairmandade.com/vendor/mpdf/mpdf/src/Mpdf.php:15401) [stacktrace]
0 {main}
"}
but there's no stack trace. i see there is this section: http://nossairmandade.com/hinarios/individual - where pdf's can be generated. do you know of a particular set of hinarios that are so large that they would cause this error?