Skip to content

JCEF_Helper.exe is not dying on closing the application #535

@aamir-lgtm

Description

@aamir-lgtm

The issue is the jcef_helper.exe process still holding file handles to JCEF libraries when my local java swing client exits, so swing client's relaunch fails when trying to re‑extract build.
I have tried to dispose (browser.close(Boolean.TRUE); and dispose(); ) when closing the browser window and also added delays and below code to properly exit the jcef.

	public static void shutdown() {
		try {
			// Step 1: Close ALL browsers first 
		    if (client != null) {
		        try {
			    	List<CefBrowser> browsers = allBrowsers;  
			        for (CefBrowser browser : browsers) {
			            if (browser != null) {
			                browser.close(true);  
			            }
			        }
			        allBrowsers.clear();
			    }catch(Exception e) {
					log.error(e,e);
				}
		    }
		    
		    // Step 2: Dispose client(s)
		    if (client != null) {
		        client.dispose();
		        client = null;
		    }
		    
		    // Step 3: Dispose CefApp (once per JVM lifetime)
		    if (cefApp != null) {
		        cefApp.dispose();
		        cefApp = null;
		    }
		    
		    // Step 4: Wait briefly for helpers to exit (optional but reliable)
		    try {
		        Thread.sleep(1000);  // 1 second;
		    } catch (InterruptedException e) {
		        Thread.currentThread().interrupt();
		    }
		}catch(Exception e) {
			log.error(e,e);
		}
	}

but still jcef helper exe is not exiting on application exit. so am i missing here anything to properly exit the jcef?
To Reproduce
Normally the issue is not always reproducible but it is observed that the issue mostly occurs in multi user windows system, where multiple users are using the same machine and launching the jcef browser using above java swing client application.

Expected behavior
Ideally it should release and kill all the jcef processes on exiting the parent swing application.

Versions (please complete the following information):

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions