Please help to resolve this error while rendering jsreport for bulk data getting error gateway timeout (Need info about Config.json) what exactly needed.



  • ERROR: 11/10/2022 13:37:41 UserId - ADVICON Error in Getting Report DataException message- Error rendering report: Error: socket hang up at connResetException (internal/errors.js:604:14) at Socket.socketOnEnd (_http_client.js:460:23) at Socket.emit (events.js:323:22) at endReadableNT (_stream_readable.js:1204:12) at processTicksAndRejections (internal/process/task_queues.js:84:21)Error: at connResetException (internal/errors.js:604:14) at Socket.socketOnEnd (_http_client.js:460:23) at Socket.emit (events.js:323:22) at endReadableNT (_stream_readable.js:1204:12) at processTicksAndRejections (internal/process/task_queues.js:84:21) Exception Source - jsreport.Local Exception StackTrace - at jsreport.Local.Internal.LocalUtilityReportingService.RenderAsync(String requestString, CancellationToken ct)

    Json file -

    {
      "httpPort": 3000,
      "store": {
        "provider": "fs"
      },
      "blobStorage": {
        "provider": "fs"
      },
      "logger": {
        "console": {
          "transport": "console",
          "level": "debug"
        },
        "file": {
          "transport": "file",
          "level": "info",
          "filename": "logs/reporter.log"
        },
        "error": {
          "transport": "file",
          "level": "error",
          "filename": "logs/error.log"
        }
      },
      "trustUserCode": false,
      "reportTimeout": 60000,
      "workers": {
        "numberOfWorkers": 2
      },
      "extensions": {
        "authentication": {
          "cookieSession": {},
          "admin": {
            "username": "admin",
            "password": "password"
          },
          "enabled": false
        }
      }
    }
    

    Current error: Error rendering report: instance has been daemonized and initialized successfully (pid: 23358)rendering has finished with errors:A critical error occurred while trying to execute the render command (2). Error while executing request to remote server. socket hang up

    need solution on this asap.



  • The process likely unexpectedly failed.
    Would you be able to replicate it for us? In a minimal sample repo?
    Is this failing deterministically for the same template/data? If yes, could you provide it?



  • Currently I am using just one template, and that is throwing this error.
    This error is occurring on one of my staging server (Adding the logs/details below).
    The application is deployed on Kubernetes.

    My Startup.cs code:

    services.AddJsReport(new LocalReporting()
    .UseBinary(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ?
    jsreport.Binary.JsReportBinary.GetBinary() :
    jsreport.Binary.Linux.JsReportBinary.GetBinary())
    .KillRunningJsReportProcesses()
    .RunInDirectory(_reportPath)
    .TempDirectory(_tempPath)
    .Configure(cfg =>
    {
    cfg.Chrome = new ChromeConfiguration()
    {
    Timeout = 2400000
    };
    cfg.TemplatingEngines = new TemplatingEnginesConfiguration()
    {
    Timeout = 2400000
    };
    cfg.Extensions = new ExtensionsConfiguration()
    {
    Phantom = new PhantomConfiguration()
    {
    Timeout = 2400000
    },
    Express = new ExpressConfiguration
    {
    InputRequestLimit = "500mb"
    },
    Scripts = new ScriptsConfiguration()
    {
    Timeout = 2400000
    }
    };
    cfg.Logger = new LoggerConfiguration() { Transport = new LoggerTransportConfiguration() { Transport = "console", Level = "debug" } };
    cfg.AllowedLocalFilesAccess();
    cfg.FileSystemStore();
    cfg.EnableRequestReportTimeout = true;
    return cfg;
    })
    .AsUtility()
    .Create());

    Method where I am generating report:
    Environment.SetEnvironmentVariable("chrome_strategy", "chrome-pool");
    Environment.SetEnvironmentVariable("chrome_numberOfWorkers", "2");
    Environment.SetEnvironmentVariable("extensions_express_renderTimeout", "2400000");

    var report = await _jsReportMVCService.RenderByNameAsync("returnTemplate", reportData);

    Error Log:
    Error rendering report: instance has been daemonized and initialized successfully (pid: 23358)rendering has finished with errors:A critical error occurred while trying to execute the render command (2). Error while executing request to remote server. socket hang up (1). caused by error (2):-> stackError: at onCriticalError (/snapshot/jsreport/node_modules/jsreport-cli/lib/commands/render.js:302:19) at /snapshot/jsreport/node_modules/jsreport-cli/lib/commands/render.js:256:14 at processTicksAndRejections (internal/process/task_queues.js:97:5)caused by error (1):-> meta = {"config":{"url":http://localhost:3000/api/report,"method":"post","data":"<<data omitted>>","headers":{"Accept":"application/json, text/plain, /","Content-Type":"application/json","User-Agent":"axios/0.19.2","Content-Length":9227},"auth":{"username":"XXXXXX","password":"XXXXX"},"transformRequest":[null],"transformResponse":[null],"timeout":0,"responseType":"stream","xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":null,"httpsAgent":{"_events":{},"_eventsCount":2,"defaultPort":443,"protocol":"https:","options":{"rejectUnauthorized":false,"path":null},"requests":{},"sockets":{},"freeSockets":{},"keepAliveMsecs":1000,"keepAlive":false,"maxSockets":null,"maxFreeSockets":256,"maxCachedSessions":100,"_sessionCache":{"map":{},"list":[]}},"maxBodyLength":null},"code":"ECONNRESET"}-> stackError: Error while executing request to remote server at Client.render (/snapshot/jsreport/node_modules/jsreport-client/lib/client.js) at processTicksAndRejections (internal/process/task_queues.js:97:5)Request Error stack: Error: socket hang up at connResetException (internal/errors.js:604:14) at Socket.socketOnEnd (_http_client.js:460:23) at Socket.emit (events.js:323:22) at endReadableNT (_stream_readable.js:1204:12) at processTicksAndRejections (internal/process/task_queues.js:84:21)



  • Does the same fail for you on local?
    Are you able to share the template you are rendering?



  • I tried on local dev machine (IIS express, IIS and docker) it is working fine. Also checked on a windows server IIS, it worked smoothly on it as well.

    On Kubernetes (linux containers), I have 2 identical instances with similar config (but different network/domain).
    It is working fine on one of it, while this error is generated on the other instance.
    I checked the 3000 port and it is also not blocked.

    Unfortunately, I am not able to share the template at the moment.



  • It could be killed with OOM. Check on that using dmesg or another way you are familiar with.



  • OOM is not the case here. I have already tried with double the size of memory which I was using for the other working instance. Then tried with max memory as well.



  • any suggestion?



  • Could you try to turn off the keepAlive?
    https://jsreport.net/learn/dotnet-local#jsreport-background-process

    AsUtility().KeepAlive(false)
    


  • New Error - Error rendering report: instance has been daemonized and initialized successfully rendering has finished with errors:A critical error occurred while trying to execute the render command . or user doesnt have permissions to read it:



  • Please try to clean the _tempPath you use and restart the app.


Log in to reply
 

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