"Printing failed" error after many requests



  • I'm using a batch process to call the the js reports API using .net to generate thousands of PDFs. It has rate limiting built-in to avoid hitting the concurrent request limits. After a few hundred PDFs are generated, I start seeing the following error in requests and they become more and more frequent until all requests are failing with the same error. The data for these requests is very similar, and running the request manually with the debugger does not hit the error. Any ideas for what might be happening?

    I am using the cloud version of jsreports, with handlebars and chrome-pdf.

    Protocol error (Page.printToPDF): Printing failed

    ProtocolError: Protocol error (Page.printToPDF): Printing failed
    at new Callback (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:62:35)
    at CallbackRegistry.create (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:108:26)
    at Connection._rawSend (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:224:26)
    at CDPSessionImpl.send (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:433:78)
    at CDPPage.createPDFStream (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.js:738:88)
    at CDPPage.pdf (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.js:771:37)
    at /app/node_modules/@jsreport/jsreport-chrome-pdf/lib/conversion.js:391:27
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /app/node_modules/@jsreport/jsreport-chrome-pdf/lib/conversion.js:432:22



  • It appears that Chrome's state gets corrupted somehow.
    I wasn't able to replicate the issue when running many thousands of your reports, so I'm not sure what will help here.

    If you need to run such big batches, perhaps you could use a serverless environment with on-prem jsreport.
    Like Azure Container App or AWS Lambda.



  • Thanks for the reply. Is there any way to configure the settings so that instances are not re-used? I'd prefer not to switch to on-prem since it will require more development/infra work and we're trying to get this issue resolved asap.



  • Unfortunately, that is not possible. jsreportonline doesn't allow altering the server config.



  • Thank you again. It is solved now by using on-prem jsreport using Azure Container App (following the tutorial from the docs). I was able to recreate the same issue when the container had 1CPU core and 2 GB memory. Bumping up to 4 cores and 8GB memory no longer has the issue, so it must be related to maxing out memory/cpu on the instances created in jsreportonline.



  • Thanks for sharing. Yes, Chrome may have some issues due to limited hardware.
    jsreportonline has currently allocated 1.5 CPU and 2048 + 2560(SWAP) MB for every rendering container.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.