Timeout error or return blank sub reports.

  • Hi,

    I have a parent template which have many child templates(4-5).Sometime all working fine but sometimes it through the timeout error or return some blank sub reports.Mainly problem occur with those sub reports which takes too much time to bind with API data.
    Is there way to wait until all sub reports are not bind completely before to render?

    I have created sample of what I'm doing.
    I have 4-5 sub reports but in sample I bind only one sub reports.

    Thanks in Advance.

  • You probably don't understand how your linked report is being rendered. Let me explain:

    1. The parent template starts to render
    2. The rendering pipeline hits assets extension and replace the linked jquery
    3. The pipeline hits child templates extension, recognizes mark for template foo and start rendering it
    4. The foo template now runs
    5. The assets extension replaces the asset mark with content of the demo.js script
    6. The child templates rendering now finishes, no external request done so far, and the parent mark {#child foo} is replaced whit its content
    7. The rendering pipeline of the parent templates now has final html and sends it to phantomjs
    8. Phantomjs evaluates the html and also runs your AJAX function to get the data]

    You see that the timeouts has nothing todo with child templates because they are likely coming from your AJAX script which is evaluated later.

    You have two solutions now.

    1. You can use phantomjs printing trigger to postpone the final pdf printing to the point all your requests are finished.

    2. You can load your data in different way using jsreport custom server script. The script would run as a part of the jsreport child template pipeline and before the final html is assembled. There are examples in docs how this work, check it out.

  • Thanks

  • Hi

    I had used "phantomjs printing trigger" but it's not working. If I increase the print delay from left side jsreport property window to 19000 then it's working for one parent report which has only one child but issue with other parent template which have many child templates and one of it's child template call API endpoint which takes 40-45 sec to return data.If I try to increase the print delay then it show following error otherwise return blank child template :-

    Error occured - Error during rendering report: Timeout
    Stak - Error: Timeout
        at /usr/src/app/node_modules/phantom-workers/lib/phantomManager.js:117:29
        at /usr/src/app/node_modules/phantom-workers/lib/phantomWorker.js:119:13
        at /usr/src/app/node_modules/phantom-workers/lib/phantomWorker.js:135:20
        at Socket.<anonymous> (/usr/src/app/node_modules/phantom-workers/lib/checkPortStatus.js:45:9)
        at emitOne (events.js:96:13)
        at Socket.emit (events.js:188:7)
        at TCP._handle.close [as _onclose] (net.js:497:12)

    How can we increase print delay to 60000?
    Thanks in Advance.

  • This seems like phantomjs timeout. Can you take a look what you have in config file for phantom.timeout and increase it?

    "phantom": {
            "strategy": "dedicated-process",
            "timeout": 60000

  • Hi Jan,

    I'm using jsreportonline "jsreport studio". Can you please show me where is config file and where we need to set it?

    Thanks in advance.

  • Ah, I didn't know. I thought you are using on-prem.

    The jsreportonline has 20s timeout limit for phantomjs which cannot ba changed. You can see it here in the faq.
    How much time does it take to you API to fetch the data? Is there a way to make it faster to fit to jsreportonline limits?

  • Hi Jan,

    Thanks for your quick reply!

    API takes takes 30-40 sec to return data.Actually It return about 25,000 records so takes time and increasing continuously.
    No.Is there way to handle it on jsreportonline "jsreport studio"?

    Thanks in advance.

  • As I mentioned, there are unfortunately hard timeouts/limits in jsreportonline which user can't change.

    Do you really need 25 000 records in your report? Perhaps you can change your API to return only records you are really interested in.

  • Thanks

Log in to reply

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