Timeout rendering report in K8s
-
Hi,
we are running JSreport in a Kubernetes pod using imagejsreport/jsreport:2.9.0-full
.
In deployment definition we set an env to config the timeout value as described by docs, something like this:env: - name: reportTimeout value: "600000"
When the container starts we find in logs that this parameter:
2020-10-12T14:17:46.987184032Z 2020-10-12T14:17:46.987Z - info: Using general timeout for rendering (reportTimeout: 600000)
Unexpectedly, when rendering a report we got the following error:
2020-10-12T14:24:54.426311019Z 2020-10-12T14:24:54.424Z - info: Starting rendering request 1 (user: null) 2020-10-12T14:24:54.427760255Z 2020-10-12T14:24:54.427Z - info: Rendering template { name: co-gestione-odl, recipe: html-to-xlsx, engine: handlebars, preview: false } 2020-10-12T14:24:55.344144635Z 2020-10-12T14:24:55.343Z - info: html-to-xlsx generation is starting 2020-10-12T14:25:06.011606592Z 2020-10-12T14:25:05.998Z - warn: Rendering request 1 finished with error in 11575 ms 2020-10-12T14:25:06.011653615Z 2020-10-12T14:25:05.999Z - warn: Error when processing render request 1 Error while executing html-to-xlsx recipe. Timeout Error: script evaluation not completed after 10000ms Error: Error while executing html-to-xlsx recipe. Timeout Error: script evaluation not completed after 10000ms 2020-10-12T14:25:06.011662432Z at module.exports (/app/node_modules/jsreport-core/lib/util/createError.js:11:13) 2020-10-12T14:25:06.011666168Z at Reporter.createError (/app/node_modules/jsreport-core/lib/reporter.js:332:12) 2020-10-12T14:25:06.011669668Z at Object.execute (/app/node_modules/jsreport-html-to-xlsx/lib/recipe.js:159:20) 2020-10-12T14:25:06.011673157Z at processTicksAndRejections (internal/process/task_queues.js:97:5) 2020-10-12T14:25:06.011676508Z at async module.exports (/app/node_modules/jsreport-core/lib/render/render.js:149:5) 2020-10-12T14:25:06.01167979Z caused by: Error: Timeout Error: script evaluation not completed after 10000ms 2020-10-12T14:25:06.011682992Z at Timeout._onTimeout (/app/node_modules/chrome-page-eval/lib/eval.js:19:19) 2020-10-12T14:25:06.011686315Z at listOnTimeout (internal/timers.js:549:17) 2020-10-12T14:25:06.011689387Z at processTimers (internal/timers.js:492:7)
Are we missing some other config to rise timeout to
600000ms
? Also tried to add the following without luck...- name: tasks_timeout value: "600000" - name: scripts_timeout value: "600000"
Any help appreciated
Paolo
-
Hm, that is strange, can't replicate it when running with
docker run -p 5488:5488 -e reportTimeout=60000 jsreport/jsreport:2.10.0-full
You can try adding env
templatingEngines_timeout=60000
-
Thanks for your quick reply, I've tried to align the env to match your suggestion and also moved to 2.10.0-full image, but the result is the same. This is the full container log:
Trying to remove the lock on display 99 Running display 99 Starting node.js 2020-10-13T09:27:34.800Z - info: Initializing jsreport@2.10.0 in production mode using configuration file: jsreport.config.json 2020-10-13T09:27:34.802Z - info: Searching for available extensions in /app/ 2020-10-13T09:27:34.805Z - info: Extensions location cache not found, crawling directories 2020-10-13T09:27:35.177Z - info: Found 52 extensions 2020-10-13T09:27:35.328Z - warn: "templatingEngines.timeout" configuration is ignored when "reportTimeout" is set 2020-10-13T09:27:35.329Z - info: Setting dedicated-process (process based) strategy for rendering. Please visit http://jsreport.net/learn/configuration for information how to get more performance. 2020-10-13T09:27:35.334Z - info: Using extension authentication@2.6.0 2020-10-13T09:27:35.353Z - info: Using extension azure-storage@1.1.1 2020-10-13T09:27:35.489Z - info: Using extension cli@2.2.5 2020-10-13T09:27:35.491Z - info: Using extension debug@2.1.3 2020-10-13T09:27:35.492Z - info: Using extension ejs@2.2.0 2020-10-13T09:27:35.493Z - info: Using extension express@2.8.0 2020-10-13T09:27:35.551Z - info: Using extension fop-pdf@2.2.0 2020-10-13T09:27:35.572Z - info: Using extension freeze@2.0.0 2020-10-13T09:27:35.573Z - info: Using extension handlebars@2.1.0 2020-10-13T09:27:35.574Z - info: Using extension import-export@2.1.0 2020-10-13T09:27:35.601Z - info: Using extension jsrender@2.1.1 2020-10-13T09:27:35.602Z - info: Using extension mongodb-store@1.3.3 2020-10-13T09:27:35.679Z - info: Using extension mssql-store@1.4.0 2020-10-13T09:27:35.857Z - info: Using extension postgres-store@1.3.1 2020-10-13T09:27:35.951Z - info: Using extension pug@3.1.0 2020-10-13T09:27:35.952Z - info: Using extension tags@2.5.0 2020-10-13T09:27:35.954Z - info: Using extension templates@2.4.0 2020-10-13T09:27:35.955Z - info: Using extension authorization@2.4.0 2020-10-13T09:27:35.956Z - info: Using extension base@2.0.2 2020-10-13T09:27:35.957Z - info: Using extension browser-client@2.2.2 2020-10-13T09:27:35.958Z - info: Using extension child-templates@1.4.0 2020-10-13T09:27:35.960Z - info: Using extension chrome-pdf@1.9.0 2020-10-13T09:27:35.995Z - info: Using extension data@2.4.0 2020-10-13T09:27:35.996Z - info: Using extension docx@2.8.0 2020-10-13T09:27:35.998Z - info: Using extension electron-pdf@3.2.0 2020-10-13T09:27:36.039Z - info: Using extension fs-store@2.9.0 2020-10-13T09:27:36.115Z - info: Using extension html-embedded-in-docx@2.2.0 2020-10-13T09:27:36.118Z - info: Using extension html-to-text@2.1.0 2020-10-13T09:27:36.121Z - info: Using extension licensing@2.2.3 2020-10-13T09:27:36.124Z - info: Using extension pdf-utils@1.9.0 2020-10-13T09:27:36.172Z - info: Using extension phantom-image@2.1.0 2020-10-13T09:27:36.187Z - info: Using extension phantom-pdf@2.6.0 2020-10-13T09:27:36.192Z - info: fs store underlying changes synchronization with studio is disabled 2020-10-13T09:27:36.194Z - info: Using extension pptx@0.7.0 2020-10-13T09:27:36.196Z - info: Using extension reports@2.5.0 2020-10-13T09:27:36.198Z - info: Using extension static-pdf@0.4.0 2020-10-13T09:27:36.200Z - info: Using extension studio@2.10.1 2020-10-13T09:27:36.241Z - info: Using extension text@2.0.0 2020-10-13T09:27:36.242Z - info: Using extension version-control@1.5.1 2020-10-13T09:27:36.268Z - info: Using extension wkhtmltopdf@2.3.0 2020-10-13T09:27:36.295Z - info: Using extension assets@1.7.0 2020-10-13T09:27:36.300Z - info: Using extension fs-store-aws-s3-persistence@1.4.0 2020-10-13T09:27:36.342Z - info: Using extension fs-store-aws-sns-sync@1.2.1 2020-10-13T09:27:36.387Z - info: Using extension fs-store-azure-sb-sync@1.1.0 2020-10-13T09:27:36.445Z - info: Using extension fs-store-azure-storage-persistence@1.2.0 2020-10-13T09:27:36.488Z - info: Using extension html-to-xlsx@2.8.0 2020-10-13T09:27:36.617Z - info: html-to-xlsx detected chrome as available html engine 2020-10-13T09:27:36.618Z - info: html-to-xlsx detected phantom as available html engine 2020-10-13T09:27:36.618Z - info: Using extension scheduling@2.5.0 2020-10-13T09:27:36.645Z - info: Using extension scripts@2.6.0 2020-10-13T09:27:36.647Z - info: Using extension studio-theme-dark@0.3.0 2020-10-13T09:27:36.648Z - info: Using extension xlsx@2.5.0 2020-10-13T09:27:36.703Z - info: Using extension public-templates@2.2.0 2020-10-13T09:27:36.704Z - info: Using extension resources@2.1.0 2020-10-13T09:27:36.704Z - info: Using extension sample-template@2.6.0 2020-10-13T09:27:36.706Z - info: Using general timeout for rendering (reportTimeout: 60000) 2020-10-13T09:27:36.706Z - info: Using fs provider for template store. 2020-10-13T09:27:36.711Z - info: fs store is persisting using fs 2020-10-13T09:27:36.712Z - info: fs store sync is disabled 2020-10-13T09:27:36.715Z - info: fs store is loading data 2020-10-13T09:27:36.733Z - info: fs store is initialized successfully 2020-10-13T09:27:36.778Z - info: Creating default express app. 2020-10-13T09:27:36.791Z - info: jsreport server successfully started on http port: 5488 2020-10-13T09:27:36.792Z - info: Verifying license key free 2020-10-13T09:27:37.049Z - info: Starting one month enterprise trial 2020-10-13T09:27:37.056Z - info: reporter initialized 2020-10-13T10:13:10.575Z - info: Starting rendering request 1 (user: null) 2020-10-13T10:13:10.578Z - info: Rendering template { name: co-gestione-prog, recipe: html-to-xlsx, engine: handlebars, preview: false } 2020-10-13T10:13:10.940Z - info: html-to-xlsx generation is starting 2020-10-13T10:13:21.302Z - warn: Rendering request 1 finished with error in 10728 ms 2020-10-13T10:13:21.303Z - warn: Error when processing render request 1 Error while executing html-to-xlsx recipe. Timeout Error: script evaluation not completed after 10000ms Error: Error while executing html-to-xlsx recipe. Timeout Error: script evaluation not completed after 10000ms at module.exports (/app/node_modules/jsreport-core/lib/util/createError.js:11:13) at Reporter.createError (/app/node_modules/jsreport-core/lib/reporter.js:332:12) at Object.execute (/app/node_modules/jsreport-html-to-xlsx/lib/recipe.js:159:20) at processTicksAndRejections (internal/process/task_queues.js:97:5) at async module.exports (/app/node_modules/jsreport-core/lib/render/render.js:150:5) caused by: Error: Timeout Error: script evaluation not completed after 10000ms at Timeout._onTimeout (/app/node_modules/chrome-page-eval/lib/eval.js:19:19) at listOnTimeout (internal/timers.js:549:17) at processTimers (internal/timers.js:492:7) 2020-10-13T10:13:21.306Z - warn: Error during processing request at http://reporting-prod.common-prod.svc.cluster.local./api/report 2020-10-13T10:13:27.697Z - info: Starting rendering request 2 (user: null) 2020-10-13T10:13:27.698Z - info: Rendering template { name: co-gestione-prog, recipe: html-to-xlsx, engine: handlebars, preview: false } 2020-10-13T10:13:28.057Z - info: html-to-xlsx generation is starting 2020-10-13T10:13:38.411Z - warn: Rendering request 2 finished with error in 10714 ms 2020-10-13T10:13:38.412Z - warn: Error when processing render request 2 Error while executing html-to-xlsx recipe. Timeout Error: script evaluation not completed after 10000ms Error: Error while executing html-to-xlsx recipe. Timeout Error: script evaluation not completed after 10000ms at module.exports (/app/node_modules/jsreport-core/lib/util/createError.js:11:13) at Reporter.createError (/app/node_modules/jsreport-core/lib/reporter.js:332:12) at Object.execute (/app/node_modules/jsreport-html-to-xlsx/lib/recipe.js:159:20) at processTicksAndRejections (internal/process/task_queues.js:97:5) at async module.exports (/app/node_modules/jsreport-core/lib/render/render.js:150:5) caused by: Error: Timeout Error: script evaluation not completed after 10000ms at Timeout._onTimeout (/app/node_modules/chrome-page-eval/lib/eval.js:19:19) at listOnTimeout (internal/timers.js:549:17) at processTimers (internal/timers.js:492:7)
and this is the environment:
jsreport@reporting-prod-7d5ff5b46d-sbh2z:/app$ env NODE_VERSION=12.16.1 NVM_CD_FLAGS= TERM=xterm NVM_DIR=/home/jsreport/.nvm PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true extensions.authentication.cookieSession.secret=xxxx PATH=/home/jsreport/.nvm/versions/node/v12.16.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/fop-2.1 PWD=/app extensions.authentication.admin.username=xxxxxx NODE_PATH=/home/jsreport/.nvm/v12.16.1/lib/node_modules NODE_ENV=production extensions.authentication.admin.password=xxxxxxx chrome_launchOptions_executablePath=google-chrome-stable SHLVL=1 HOME=/home/jsreport templatingEngines_timeout=60000 chrome_launchOptions_args=--no-sandbox,--disable-dev-shm-usage NVM_BIN=/home/jsreport/.nvm/versions/node/v12.16.1/bin reportTimeout=60000 _=/usr/bin/env
This is the content of
jsreport.config.json
:jsreport@reporting-prod-7d5ff5b46d-sbh2z:/app$ cat jsreport.config.json {"httpPort":5488,"allowLocalFilesAccess":false,"store":{"provider":"fs"},"blobStorage":{"provider":"fs"},"reportTimeout":60000,"extensions":{"fs-store":{"syncModifications":false}}}```
-
Hm, I am having the same env variables. The same config. But the template timeouts after 60s
2020-10-13T01:59:51.806Z - info: Rendering template { name: t, recipe: html-to-xlsx, engine: handlebars, preview: true } 2020-10-13T02:00:51.908Z - warn: Rendering request 1 finished with error in 60106 ms 2020-10-13T02:00:51.909Z - warn: Error when processing render request 1 Timeout during execution of templating engine Error: Timeout during execution of templating engine at Timeout._onTimeout (/app/node_modules/script-manager/lib/manager-processes.js:29:10) at listOnTimeout (internal/timers.js:549:17) at processTimers (internal/timers.js:492:7)
Could you try it with a template like this?
<table> <tr> <td>aaa</td> </tr> </table>
helpers
while (true) { }
Does it also timeouts after 10s or 60s?
I see you render from API call, can you try to render from the studio? Does it change something?
What if you run jsreport outside Kubernetes? There is no problem with running in Kuberentes, but we need to isolate the problem location.
-
Hi jan,
using your sample template my K8s JSreport timeouts after 60 s as expected, both launching the render from Studio or API call. I also tested an another sample template that builds a big table and had the same result (and some OOM error).Testing with our production template and data I got the 10 s timeout, both launching the render from Studio or API call.
As you suggested I tried same call to a local instance started with docker on my local machine with
docker run -e reportTimeout=60000 -p 5488:5488 -v $PWD/jsdata:/app/data jsreport/jsreport:2.10.0-full
and the error looks the same, timed out after 10s:
2020-10-16T18:16:47.201Z - info: Using general timeout for rendering (reportTimeout: 60000) 2020-10-16T18:16:47.201Z - info: Using fs provider for template store. 2020-10-16T18:16:47.207Z - info: fs store is persisting using fs 2020-10-16T18:16:47.208Z - info: fs store sync is disabled 2020-10-16T18:16:47.220Z - info: fs store is loading data 2020-10-16T18:16:47.293Z - info: fs store is initialized successfully 2020-10-16T18:16:47.312Z - info: Creating default express app. 2020-10-16T18:16:47.329Z - info: jsreport server successfully started on http port: 5488 2020-10-16T18:16:47.331Z - info: Verifying license key free 2020-10-16T18:16:47.617Z - info: Starting one month enterprise trial 2020-10-16T18:16:47.624Z - info: reporter initialized 2020-10-16T18:16:54.711Z - info: Starting rendering request 1 (user: null) 2020-10-16T18:16:54.714Z - info: Rendering template { name: co-gestione-prog, recipe: html-to-xlsx, engine: handlebars, preview: false } 2020-10-16T18:16:55.213Z - info: html-to-xlsx generation is starting 2020-10-16T18:17:05.754Z - warn: Rendering request 1 finished with error in 11043 ms 2020-10-16T18:17:05.755Z - warn: Error when processing render request 1 Error while executing html-to-xlsx recipe. Timeout Error: script evaluation not completed after 10000ms Error: Error while executing html-to-xlsx recipe. Timeout Error: script evaluation not completed after 10000ms at module.exports (/app/node_modules/jsreport-core/lib/util/createError.js:11:13) at Reporter.createError (/app/node_modules/jsreport-core/lib/reporter.js:332:12) at Object.execute (/app/node_modules/jsreport-html-to-xlsx/lib/recipe.js:159:20) at processTicksAndRejections (internal/process/task_queues.js:97:5) at async module.exports (/app/node_modules/jsreport-core/lib/render/render.js:150:5) caused by: Error: Timeout Error: script evaluation not completed after 10000ms at Timeout._onTimeout (/app/node_modules/chrome-page-eval/lib/eval.js:19:19) at listOnTimeout (internal/timers.js:549:17) at processTimers (internal/timers.js:492:7) 2020-10-16T18:17:05.759Z - warn: Error during processing request at http://127.0.0.1:5488/api/report
This is our template:
<html> <head> <style> {#asset co-style.css @encoding=utf8} </style> </head> <body> {{#each pages}} <table name="{{GetSectionDescription section}}""> <tr class="header"> <td> Ticket </td> <td> Stato </td> <td> Cliente </td> <td> Immobile </td> <td> Immobile cliente </td> <td> Resp. immobile </td> <td> Regione </td> <td> Provincia </td> <td> Codice Raggrup. </td> <td> Num. ODL Costi Extra </td> <td> SERVIZIO </td> <td> Descrizione </td> <td> Numero Fornitori </td> <td> Fornitore </td> <td> Fornitore data inizio </td> <td> Fornitore data fine </td> <td> Data inizio Pianificata </td> <td> Data fine Pianificata </td> <td> Data Scadenza </td> <td> Data inizio </td> <td> Data Fine </td> <td> Data inizio minimo </td> <td> Data sospesione </td> <td> Data ripr. lavori </td> <td> Data ricev. rapp. </td> </tr> {{#each items}} <tr> <td>{{wonum}}</td> <td>{{state}}</td> <td>{{siteId}}</td> <td>{{eqnum}}</td> <td>{{customerEqnum}}</td> <td>{{personResponsible}}</td> <td>{{country}}</td> <td>{{province}}</td> <td>{{groupNumber}}</td> <td>{{extraordinaryTicket}}</td> <td>{{service}}</td> <td>{{description}}</td> <td>{{supplierCount}}</td> <td>{{supplierId}} - {{supplierName}}</td> <td>{{supplierStartDate}}</td> <td>{{supplierEndDate}}</td> <td>{{plannedDateStart}}</td> <td>{{plannedDateEnd}}</td> <td>{{expirationDate}}</td> <td>{{startDate}}</td> <td>{{endDate}}</td> <td>{{minDateStart}}</td> <td>{{suspensionDate}}</td> <td>{{presumedWorkDate}}</td> <td>{{receptionReportDate}}</td> </tr> {{/each}} </table> {{/each}} </body> </html>
this is the helper function:
function GetSectionDescription (section) { var descr = section; switch(section) { case 'DA_ASSEGNARE_DA_ASSEGNARE_MAKE': descr = 'DA ASSEGNARE MAKE'; break; case 'DA_ASSEGNARE_DA_ASSEGNARE_BUY': descr = 'DA ASSEGNARE BUY'; break; case 'DA_ASSEGNARE_IN_ASSEGNAZIONE_SU_SF': descr = 'IN ASSEGNAZIONE SU SF'; break; case 'IN_PROGRAM': descr = 'IN PROGRAMMA'; break; case 'DONE': descr = 'SVOLTI'; break; case 'ALL': descr = 'TUTTI'; break; } return descr; }
and this is the content of
co-style.css
file:.header { font-weight: bold; }
If you'd like to test it to try to reproduce the wired timeout, I'm going to send you the
curl
sample code that make me getting the 10 s timeout.Many thanks for your kind support.
Paolo
-
Thank you for the emailed test. This looks like our bug.
We will hotfix it on Monday hopefully.
https://github.com/jsreport/jsreport/issues/770
-
Thank you very much for your kind support.
-
this is now fixed in jsreport-html-to-xlsx@2.8.1, please update
jsreport-html-to-xlsx@2.8.1
the extension in your server and the issue should be gone.
-
Thanks @bjrmatos ,
just updated the dependency in my container, this is the resulting
Dockerfile
:FROM jsreport/jsreport:2.10.0-full RUN npm install --save --save-exact jsreport-html-to-xlsx@2.8.1 COPY --chown=jsreport:jsreport ./jsdata /app/data
and 10' timeout is overcome.
Many for fixing this.