Electron PDF timeout in AWS EC2 t2.medium instance (dual core) | configuration help



  • Issue

    • I'm trying to generate a report via electron-pdf and it's timing out with the following error:
    Error: Timeout when executing in electron
        at Timeout._onTimeout (/home/ubuntu/jsreportapp/node_modules/electron-html-to/lib/dedicatedProcessStrategy.js:277:20)
        at ontimeout (timers.js:498:11)
        at tryOnTimeout (timers.js:323:5)
        at Timer.listOnTimeout (timers.js:290:5)
    
    • Would very much appreciate any assistance :pray:

    Steps

    • I installed jsreport-electron-pdf and electron since electron-prebuilt is now Deprecated.
    • Here's the extract from my package.json:
    "dependencies": {
        "electron": "^2.0.5",
        "install": "^0.12.1",
        "jsreport": "2.1.1",
        "jsreport-electron-pdf": "^3.0.0",
        "jsreport-phantom-pdf": "^2.1.3",
        "npm": "^6.2.0"
      }
    
    • and here's the section from my jsreport.config.json file:
    "extensions": {
        "authentication": {
          "cookieSession": {
            "secret": "some secret"
          },
          "admin": {
            "username": "some name",
            "password": "some password"
          },
          "enabled": true
        },
        "scripts": {
          "timeout": 40000,
          "strategy": "http-server"
        },
        "electron":{
          "strategy":"electron-ipc",
          "pingTimeout":100,
          "timeout":5000
        }
      },
    

    Description

    • I'm running on an AWS EC2 t2.medium instance so that has 2 cores
    • However the electron-pdf strategy is defaulting to dedicated-process even though I'm setting it as electron-ipc in the jsreport "extensions" configuration.
    • It's not even taking the pingTimeout and timeout values from the config file
    • startup log
    2018-07-15T10:59:39.982Z - info: Using extension electron-pdf
      electron-html-to Creating a new conversion function with options: +0ms { timeout: 10000,
      numberOfWorkers: 2,
      chromeCommandLineSwitches: { 'ignore-certificate-errors': null },
      allowLocalFilesAccess: false,
      maxLogEntrySize: 1000,
      tmpDir: '/tmp/jsreport/autocleanup',
      strategy: 'dedicated-process' }
    
    
    • Jsreport Server Log
    2018-07-15T11:00:11.394Z - debug: Electron Pdf recipe start.
      electron-html-to:conversion generating new conversion task.. +31s
      electron-html-to:conversion conversion task id: ea778c01-9b8d-4672-865a-ee5c18cb5328 +0ms
      electron-html-to:conversion creating temporal html files in /tmp/jsreport/autocleanup.. +1ms
      electron-html-to:conversion creating temporal html file [type: html] in /tmp/jsreport/autocleanup/ea778c01-9b8d-4672-865a-ee5c18cb5328html.html.. +0ms
      electron-html-to:conversion starting conversion task [strategy:dedicated-process][task id:ea778c01-9b8d-4672-865a-ee5c18cb5328] with options: +1ms { browserWindow: 
       { width: undefined,
         height: undefined,
         webPreferences: { javascript: true } },
      waitForJSVarName: 'JSREPORT_READY_TO_START',
      collectLogs: true,
      delay: undefined,
      waitForJS: false,
      converterPath: '/home/ubuntu/jsreportapp/node_modules/electron-html-to/lib/converters/pdf.js',
      pdf: 
       { marginsType: undefined,
         pageSize: undefined,
         printBackground: true,
         landscape: false },
      htmlFile: '/tmp/jsreport/autocleanup/ea778c01-9b8d-4672-865a-ee5c18cb5328html.html',
      url: 'file:///tmp/jsreport/autocleanup/ea778c01-9b8d-4672-865a-ee5c18cb5328html.html',
      chromeCommandLineSwitches: { 'ignore-certificate-errors': null },
      extraHeaders: {},
      output: 
       { tmpDir: '/tmp/jsreport/autocleanup',
         id: 'ea778c01-9b8d-4672-865a-ee5c18cb5328' } }
      electron-html-to:dedicated-process-strategy saving settings in temporal file.. +1ms
      electron-html-to:dedicated-process-strategy searching electron executable path.. +0ms
      electron-html-to:dedicated-process-strategy trying to get electron path from "electron" module.. +0ms
      electron-html-to:dedicated-process-strategy spawning new electron process with args: +1ms [ '/home/ubuntu/jsreportapp/node_modules/electron-html-to/lib/scripts/standaloneScript.js' ] and options: { env: 
       { ELECTRON_WORKER_ID: 'ea778c01-9b8d-4672-865a-ee5c18cb5328',
         ELECTRON_HTML_TO_SETTINGS_FILE_PATH: '/tmp/jsreport/autocleanup/ea778c01-9b8d-4672-865a-ee5c18cb5328settings.html',
         DISPLAY: 'localhost:10.0' },
      stdio: [ null, null, null, 'ipc' ] }
      electron-html-to:dedicated-process-strategy electron process pid: +4ms 2196
      electron-html-to:dedicated-process-strategy processing conversion.. +1ms
      electron-html-to:dedicated-process-strategy electron process exit with code: 127 and signal: null +1ms
      electron-html-to:dedicated-process-strategy conversion timeout.. +10s
    2018-07-15T11:00:21.409Z - error: Error when processing render request Timeout when executing in electron Error: Timeout when executing in electron
        at Timeout._onTimeout (/home/ubuntu/jsreportapp/node_modules/electron-html-to/lib/dedicatedProcessStrategy.js:277:20)
        at ontimeout (timers.js:498:11)
        at tryOnTimeout (timers.js:323:5)
        at Timer.listOnTimeout (timers.js:290:5)
    2018-07-15T11:00:21.410Z - error: Error during processing request at http:/<IP_Address>:5488/api/report/student-list-normal-marks
    


  • Tried to get help on the jsreport-electron-pdf github repo but not sure if that's really active

    https://github.com/bjrmatos/jsreport-electron-pdf/issues/18



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