PDF utils timeout
-
Hi.
I am running 2.3.0 docker image with following config:{"httpPort":5488,"allowLocalFilesAccess":true,"store":{"provider":"fs"},"blobStorage":{"provider":"fs"},"templatingEngines":{"timeout":240000, "strategy": "in-process"},"chrome":{"timeout":240000},"extensions":{"scripts":{"timeout":240000}}}
I have huge report on 94 pages and when I enable merge for each page of following template:
<div style="height: 100%; width: 100%; font-size: 8px; display: flex; justify-content: justify-content: space-between; align-items: flex-end"> <div style="margin-left: auto; margin-right: auto"> {{parameters.companyInfo}} </div> <div> {{$pdf.pageNumber}} / {{$pdf.pages.length}} </div> </div>
I am getting timeout with following log:
2019-02-25T19:01:30.143Z - info: Starting rendering request 1 (user: null) 2019-02-25T19:01:30.146Z - info: Rendering template { name: clientNotes, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:01:31.910Z - info: Rendering request 1 finished in 1767 ms 2019-02-25T19:11:15.271Z - info: Starting rendering request 2 (user: null) 2019-02-25T19:11:15.272Z - info: Rendering template { name: clientNotes, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:16.881Z - info: pdf-utils is starting pdf processing 2019-02-25T19:11:18.304Z - info: Starting rendering request 3 (user: null) 2019-02-25T19:11:18.305Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:18.571Z - info: Rendering request 3 finished in 267 ms 2019-02-25T19:11:18.576Z - info: Starting rendering request 4 (user: null) 2019-02-25T19:11:18.577Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:18.871Z - info: Rendering request 4 finished in 295 ms 2019-02-25T19:11:18.874Z - info: Starting rendering request 5 (user: null) 2019-02-25T19:11:18.875Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:19.139Z - info: Rendering request 5 finished in 265 ms 2019-02-25T19:11:19.142Z - info: Starting rendering request 6 (user: null) 2019-02-25T19:11:19.143Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:19.412Z - info: Rendering request 6 finished in 269 ms 2019-02-25T19:11:19.414Z - info: Starting rendering request 7 (user: null) 2019-02-25T19:11:19.415Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:19.659Z - info: Rendering request 7 finished in 245 ms 2019-02-25T19:11:19.662Z - info: Starting rendering request 8 (user: null) 2019-02-25T19:11:19.663Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:19.925Z - info: Rendering request 8 finished in 263 ms 2019-02-25T19:11:19.930Z - info: Starting rendering request 9 (user: null) 2019-02-25T19:11:19.931Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:20.199Z - info: Rendering request 9 finished in 269 ms 2019-02-25T19:11:20.202Z - info: Starting rendering request 10 (user: null) 2019-02-25T19:11:20.204Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:20.461Z - info: Rendering request 10 finished in 259 ms 2019-02-25T19:11:20.465Z - info: Starting rendering request 11 (user: null) 2019-02-25T19:11:20.466Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:20.732Z - info: Rendering request 11 finished in 267 ms 2019-02-25T19:11:20.735Z - info: Starting rendering request 12 (user: null) 2019-02-25T19:11:20.736Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:20.988Z - info: Rendering request 12 finished in 253 ms 2019-02-25T19:11:20.991Z - info: Starting rendering request 13 (user: null) 2019-02-25T19:11:20.992Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:21.252Z - info: Rendering request 13 finished in 261 ms 2019-02-25T19:11:21.254Z - info: Starting rendering request 14 (user: null) 2019-02-25T19:11:21.256Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:21.515Z - info: Rendering request 14 finished in 261 ms 2019-02-25T19:11:21.518Z - info: Starting rendering request 15 (user: null) 2019-02-25T19:11:21.519Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:21.783Z - info: Rendering request 15 finished in 265 ms 2019-02-25T19:11:21.788Z - info: Starting rendering request 16 (user: null) 2019-02-25T19:11:21.789Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:22.028Z - info: Rendering request 16 finished in 240 ms 2019-02-25T19:11:22.030Z - info: Starting rendering request 17 (user: null) 2019-02-25T19:11:22.031Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:22.332Z - info: Rendering request 17 finished in 302 ms 2019-02-25T19:11:22.335Z - info: Starting rendering request 18 (user: null) 2019-02-25T19:11:22.336Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:22.579Z - info: Rendering request 18 finished in 244 ms 2019-02-25T19:11:22.583Z - info: Starting rendering request 19 (user: null) 2019-02-25T19:11:22.584Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:22.830Z - info: Rendering request 19 finished in 247 ms 2019-02-25T19:11:22.833Z - info: Starting rendering request 20 (user: null) 2019-02-25T19:11:22.834Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:23.106Z - info: Rendering request 20 finished in 273 ms 2019-02-25T19:11:23.110Z - info: Starting rendering request 21 (user: null) 2019-02-25T19:11:23.111Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:23.378Z - info: Rendering request 21 finished in 268 ms 2019-02-25T19:11:23.382Z - info: Starting rendering request 22 (user: null) 2019-02-25T19:11:23.383Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:23.646Z - info: Rendering request 22 finished in 264 ms 2019-02-25T19:11:23.652Z - info: Starting rendering request 23 (user: null) 2019-02-25T19:11:23.653Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:23.898Z - info: Rendering request 23 finished in 246 ms 2019-02-25T19:11:23.901Z - info: Starting rendering request 24 (user: null) 2019-02-25T19:11:23.902Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:24.183Z - info: Rendering request 24 finished in 282 ms 2019-02-25T19:11:24.186Z - info: Starting rendering request 25 (user: null) 2019-02-25T19:11:24.187Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:24.471Z - info: Rendering request 25 finished in 285 ms 2019-02-25T19:11:24.475Z - info: Starting rendering request 26 (user: null) 2019-02-25T19:11:24.476Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:24.747Z - info: Rendering request 26 finished in 273 ms 2019-02-25T19:11:24.750Z - info: Starting rendering request 27 (user: null) 2019-02-25T19:11:24.751Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:25.022Z - info: Rendering request 27 finished in 272 ms 2019-02-25T19:11:25.026Z - info: Starting rendering request 28 (user: null) 2019-02-25T19:11:25.027Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:25.301Z - info: Rendering request 28 finished in 275 ms 2019-02-25T19:11:25.304Z - info: Starting rendering request 29 (user: null) 2019-02-25T19:11:25.305Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:25.597Z - info: Rendering request 29 finished in 293 ms 2019-02-25T19:11:25.601Z - info: Starting rendering request 30 (user: null) 2019-02-25T19:11:25.602Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:25.849Z - info: Rendering request 30 finished in 249 ms 2019-02-25T19:11:25.852Z - info: Starting rendering request 31 (user: null) 2019-02-25T19:11:25.853Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:26.110Z - info: Rendering request 31 finished in 258 ms 2019-02-25T19:11:26.112Z - info: Starting rendering request 32 (user: null) 2019-02-25T19:11:26.113Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:26.354Z - info: Rendering request 32 finished in 242 ms 2019-02-25T19:11:26.356Z - info: Starting rendering request 33 (user: null) 2019-02-25T19:11:26.357Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:26.589Z - info: Rendering request 33 finished in 233 ms 2019-02-25T19:11:26.591Z - info: Starting rendering request 34 (user: null) 2019-02-25T19:11:26.592Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:26.830Z - info: Rendering request 34 finished in 239 ms 2019-02-25T19:11:26.833Z - info: Starting rendering request 35 (user: null) 2019-02-25T19:11:26.834Z - info: Rendering template { name: footer, recipe: chrome-pdf, engine: handlebars, preview: true } 2019-02-25T19:11:26.912Z - warn: Error when processing render request Timeout error during executing script Error: Timeout error during executing script at Timeout._onTimeout (/app/node_modules/script-manager/lib/manager-servers.js:152:23) at listOnTimeout (timers.js:324:15) at processTimers (timers.js:268:5)```
If I turn off the footer rendering everything works like a charm. I do not have any scripts attached to report.
-
hi! it looks like your configuration is not being applied, because you are specifying the
in-process
strategy in your config, however according to your logs the error comes from the default strategy which ishttp-server
when using docker.note that if you have a configuration file in your project, you need to mount a directory in order for the container to be able to see that file, so probably you are missing this step.
-
You are kinda right, I remapped directory and it is definitely applied. but the log output looks the same anyway. I was able to improve speed a bit by adding
"chrome": {
"timeout": 240000,
"strategy": "chrome-pool",
"numberOfWorkers": 8
}
to config. But it is still huge overhead... report without footer is rendered in 1900 ms and with footer and 8 workers in 16000 ms
-
Hi,
using the "merge for each page" will be always slow for 90 pages because it needs to touch chrome for every page.
We have a new option "merge whole document" that lets you do the whole header merging in the single roundtrip.
https://jsreport.net/learn/pdf-utils#merge
https://github.com/jsreport/jsreport-pdf-utils/issues/10Jan