Intermittent issue where chrome fails to open.



  • Hi,

    I have created a report for our system and for the most part it works fine. Our scenario is that we have an API which is called, it executes some tasks and then generates a PDF report which we email to the user.

    It seems to work 99% of the time but every now and then we get the error below.

    Error rendering report: instance has been daemonized and initialized successfully (pid: 1420)rendering has finished with errors:A critical error occurred while trying to execute the render command (2). Failed to launch chrome![0430/094925.949:WARNING:resource_bundle.cc(426)] locale_file_path.empty() for locale [0430/094926.059:FATAL:feature_list.cc(282)] Check failed: !g_initialized_from_accessor. Backtrace: ovly_debug_event [0x00007FFBFE881252+16183762] ovly_debug_event [0x00007FFBFE880832+16181170] ovly_debug_event [0x00007FFBFE893383+16257795] ovly_debug_event [0x00007FFBFE883386+16192262] ovly_debug_event [0x00007FFBFE3D4B2E+11283118] ovly_debug_event [0x00007FFBFE7FDB58+15645400] ovly_debug_event [0x00007FFBFE7FDACD+15645261] ovly_debug_event [0x00007FFBFE828F28+15822504] ovly_debug_event [0x00007FFBFE7FD35E+15643358] ovly_debug_event [0x00007FFBFE8283E3+15819619] ovly_debug_event [0x00007FFBFE8282BB+15819323] ovly_debug_event [0x00007FFBFE8280F2+15818866] ChromeMain [0x00007FFBFD9111B6+286] Ordinal0 [0x00007FF6E07F275F+10079] Ordinal0 [0x00007FF6E07F182D+6189] GetHandleVerifier [0x00007FF6E08FB7C2+697538] BaseThreadInitThunk [0x00007FFC2CE384D4+20] RtlUserThreadStart [0x00007FFC2DBDE871+33]TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md (1). caused by error (2):-> stackError: at onCriticalError (D:\snapshot\jsreport\node_modules\jsreport-cli\lib\commands\render.js:302:19) at D:\snapshot\jsreport\node_modules\jsreport-cli\lib\commands\render.js:256:14 at processTicksAndRejections (internal/process/task_queues.js:93:5)caused by error (1):-> stackError: Failed to launch chrome![0430/094925.949:WARNING:resource_bundle.cc(426)] locale_file_path.empty() for locale [0430/094926.059:FATAL:feature_list.cc(282)] Check failed: !g_initialized_from_accessor. Backtrace: ovly_debug_event [0x00007FFBFE881252+16183762] ovly_debug_event [0x00007FFBFE880832+16181170] ovly_debug_event [0x00007FFBFE893383+16257795] ovly_debug_event [0x00007FFBFE883386+16192262] ovly_debug_event [0x00007FFBFE3D4B2E+11283118] ovly_debug_event [0x00007FFBFE7FDB58+15645400] ovly_debug_event [0x00007FFBFE7FDACD+15645261] ovly_debug_event [0x00007FFBFE828F28+15822504] ovly_debug_event [0x00007FFBFE7FD35E+15643358] ovly_debug_event [0x00007FFBFE8283E3+15819619] ovly_debug_event [0x00007FFBFE8282BB+15819323] ovly_debug_event [0x00007FFBFE8280F2+15818866] ChromeMain [0x00007FFBFD9111B6+286] Ordinal0 [0x00007FF6E07F275F+10079] Ordinal0 [0x00007FF6E07F182D+6189] GetHandleVerifier [0x00007FF6E08FB7C2+697538] BaseThreadInitThunk [0x00007FFC2CE384D4+20] RtlUserThreadStart [0x00007FFC2DBDE871+33]TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md at Client.render (D:\snapshot\jsreport\node_modules\jsreport-client\lib\client.js) at processTicksAndRejections (internal/process/task_queues.js:93:5) at async startRender (D:\snapshot\jsreport\node_modules\jsreport-cli\lib\commands\render.js:319:24) at async D:\snapshot\jsreport\node_modules\jsreport-cli\lib\commands\render.js:226:22 at async Commander.executeCommand (D:\snapshot\jsreport\node_modules\jsreport-cli\lib\commander.js:242:22)Remote stack: Error: Failed to launch chrome![0430/094925.949:WARNING:resource_bundle.cc(426)] locale_file_path.empty() for locale [0430/094926.059:FATAL:feature_list.cc(282)] Check failed: !g_initialized_from_accessor. Backtrace: ovly_debug_event [0x00007FFBFE881252+16183762] ovly_debug_event [0x00007FFBFE880832+16181170] ovly_debug_event [0x00007FFBFE893383+16257795] ovly_debug_event [0x00007FFBFE883386+16192262] ovly_debug_event [0x00007FFBFE3D4B2E+11283118] ovly_debug_event [0x00007FFBFE7FDB58+15645400] ovly_debug_event [0x00007FFBFE7FDACD+15645261] ovly_debug_event [0x00007FFBFE828F28+15822504] ovly_debug_event [0x00007FFBFE7FD35E+15643358] ovly_debug_event [0x00007FFBFE8283E3+15819619] ovly_debug_event [0x00007FFBFE8282BB+15819323] ovly_debug_event [0x00007FFBFE8280F2+15818866] ChromeMain [0x00007FFBFD9111B6+286] Ordinal0 [0x00007FF6E07F275F+10079] Ordinal0 [0x00007FF6E07F182D+6189] GetHandleVerifier [0x00007FF6E08FB7C2+697538] BaseThreadInitThunk [0x00007FFC2CE384D4+20] RtlUserThreadStart [0x00007FFC2DBDE871+33]TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md at onClose (D:\snapshot\jsreport\node_modules\puppeteer\lib\Launcher.js:348:14) at ChildProcess.<anonymous> (D:\snapshot\jsreport\node_modules\puppeteer\lib\Launcher.js:338:60) at ChildProcess.emit (events.js:215:7) at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)

    We have a fairly simple HTML template and we use handlebars to get the model rendered into it.

    There doesnt seem to be any pattern to when this happens, we use azure devops to run the release process and in there is a unit test which creates a report and checks that it is saved correctly, again, most of the time this test passes but every now and then we get this happens.

    It also happens at run time when users request the reports.

    This is what the code looks like (Note that this is not the exact code).

    public class ReportGenerator{
    
    public async Task<MemoryStream> GenerateReportPdfAsync(Model model) 
            {
                var rs = new LocalReporting()
                    .RunInDirectory(Path.Combine(Directory.GetCurrentDirectory(), "jsreport"))
                    .KillRunningJsReportProcesses()
                    .UseBinary(JsReportBinary.GetBinary())
                    .Configure(cfg => cfg.AllowedLocalFilesAccess().FileSystemStore().BaseUrlAsWorkingDirectory())
                    .AsUtility()
                    .Create();
                
                var customReport = rs.RenderAsync(new RenderRequest()
                {
                    Template = new Template()
                    {
                        Content = await GetContent(pathToTemplate), //This returns a string of the HTML template that we want to render
                        Engine = jsreport.Types.Engine.Handlebars,
                        Recipe = Recipe.ChromePdf,
                        Helpers = await GetContent(pathToJsHelpers) //This method returns a string of the  js file that we inject into the template do some specific conversions for us.
                    },
                    Data = model
                });
    
                var stream = new MemoryStream();
    
                await customReport.Result.Content.CopyToAsync(stream);
                await stream.FlushAsync();
    
                return stream;
            }
    
    }
    
    

    Any help with this would be appreciated, its quite frustrating that we dont seem to be able to replicate the issue.



  • Sorry didnt mention, this is on windows.



  • Hm, I have already seen this error. It happens on windows, somehow, something quarantines or delete the chrome binary or other parts we extract to the temp.
    We haven't been able to identify fully the cause so far,

    Please configure jsreport local to use the temp directory somewhere at the same location your app is.
    Hopefully, it will help.

    https://jsreport.net/learn/dotnet-local#temp-files



  • Great, Thanks Ill give that a try.

    The issue has not cropped up again today so Ill put this change in place and monitor the situation.


Log in to reply
 

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