socket hang up issue



  • Hi all,

    I'm trying to fix an issue with one of my report that generate a CSV. I'm doing a call to my api to get that in the beforeRender function of the script section but since it's a big report, I often having this error:

    Error when processing render request Error during rendering report: socket hang up Error: socket hang up

    In my configuration file I have :

    "tasks": {
        "strategy": "http-server",
        "allowedModules": "*",
        "numberOfWorkers": 20,
        "timeout": 600000
      }
    

    The issue is that the timeout doesn't seem to work proprely. If it took more than 2 min, the beforeRender function crash. If I use an other strategy, it's working but I would prefer using http-server instead of something else as a strategy if possible. Can this timeout be overrided by something else by another set of options?

    Thank for your time and sorry if that question was asked before, I didn't find anything helpful about that for the moment.


  • administrators

    hi! are you sure that this is not caused by the call to your api in the beforeRender? i mean, usually when doing external http calls there is also a timeout option that you should configure but it depends on the exact module that you are using, what are you using for the http request? native nodejs http module? or something like request? or something else? if possible maybe you can past here the content of your beforeRender and script.



  • Thank for your reply. I'm using the Request module and was thinking the same thing as you but I don't think it's that. I'm doing paging with my api to extract a small amount of data and calling it many times in the beforeRender to get all my data before using my recipe. All the calls that I'm doing to my api are working great until I passed that 2 min timeout limit and after that it crash (hang out). I've also added a timeout on my Request too to see if it was that but no luck until now. And like I said, when I'm using dedicated process in the strategy, I don't have this issue so if it was a Request issue, it would be the same I think.


  • administrators

    ok i see, it will be faster (the debugging will be more faster) for me if you could setup some repository that shows the problem with the same script and template that you are using, so i can switch between http-server and dedicated-process strategy and see the error, maybe there is some problem with http-server so i would need that test case in order to find the issue.



  • I think I found what is causing that. It seem that there is a 2 min timeout limit to express, do you think it can be that ? If yes, do you know if can I override that in my jsreport settings somewhere ?


  • administrators

    ahh yes, you're right, this is the place where the 2min timeout is set, you can override it by updating your config to include:

    {
      "express": {
         "renderTimeout": 600000
      }
    }
    

  • administrators

    hmm actually the timeout there is 20min but let me know if that config solves your problem



  • Still not working. My configuration is like that, is it ok ?

    {
      "tempDirectory": "data/temp",
    
      "authentication": {
        "cookieSession": {
          "secret": "***********"
        },
        "admin": {
          "username": "******",
          "password": "******"
        },
        "enabled": true
      },
      "connectionString": {
        "name": "fs"
      },
      "httpPort": 8081,
    
      "express": {
        "renderTimeout": 600000
      },
    
      "logger": {
        "console": {
          "transport": "console",
          "level": "debug"
        },
        "file": {
          "transport": "file",
          "level": "info",
          "filename": "logs/reporter.log"
        },
        "error": {
          "transport": "file",
          "level": "error",
          "filename": "logs/error.log"
        }
      },
      "blobStorage": "fileSystem",
      "phantom": {
        "strategy": "dedicated-process",
        "timeout": 600000,
        "allowedModules": "*",
        "numberOfWorkers": 20
      },
      "tasks": {
        "strategy": "http-server",
        "allowedModules": "*",
        "numberOfWorkers": 20,
        "timeout": 60000000
      },
      "scripts": {
        "allowedModules": "*",
        "timeout": 60000000
      },
      "sample-template": {
        "createSamples": false
      }
    }
    

  • administrators

    yes, looks good to me, don't see anything bad there. i think the best here is that you share a repository with working code so we can debug it and find the issue with http-server strategy.


Log in to reply
 

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