MachinePublishers / jBrowserDriver

A programmable, embeddable web browser driver compatible with the Selenium WebDriver spec -- headless, WebKit-based, pure Java
Other
809 stars 143 forks source link

Terminate child process when parent process killed #251

Closed trask closed 7 years ago

trask commented 7 years ago

Hi, I've been noticing that the JBrowserDriverServer child process is left running indefinitely when I kill my application while the child process is mid-execution.

A shutdown hook on the parent JVM is not totally reliable since it's not called if the parent process is forcibly terminated.

So I added a HeartbeatServer to the child process. The parent process sends the child process a heartbeat "ping" every 5 seconds, and the child process calls System.exit() if it has not heard from the parent process in over a minute.

hollingsworthd commented 7 years ago

Cool. Good idea! Thanks for looking into that and creating this. Looks good.

trask commented 7 years ago

Thanks for the quick merge

hollingsworthd commented 7 years ago

This is part of the v0.17.5 release now in Maven Central.