Service worker in page causes Electron to leave process behind on quit

[Originally posted Mar. 27, 2020 to “support” - did not receive any replies so cross-posting to electron. Apologies.]

Using electron-builder I built an installer for an electron version of my company’s web application. The electron side just hits a URL to get my application’s javascript from my server. A service worker is included for offline access.

I notice that when app.quit() is called after the window is closed an electron process is left behind (i.e. still running in the background) even though the application window has closed. I have determined that the service worker is responsible for the process: If I comment out the service worker so that it is not registered when the page loads, and then quit the application, no process is left behind.

Is the left-behind process to be expected? Or is it a bug in electron? If the former, does that mean it is the developer’s responsibility to unregister service workers on exit? And if so, doesn’t that preclude offline access?

Thanks!

Jeff S

If anyone else out there has the same problem… the fix was to upgrade electron. I was running 6.0.10. Upgrading to 6.1.12 seems to have done the trick - no more service worker process left behind when closing the window.