New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Network service crashed, restarting service. #31675
Comments
Will you see the same error if you run chromium browser in docker? |
Probably not. Can it be related to SignalR/Web Socket connection? The error occurs only in certain situation, when Electron loads an Angular app with win.loadURL while the backend services are already running and the Network Service crashed error occurs somewhere near trying to establish a signalR connection.
Browser logs
|
I managed to find what triggers the issue, not sure about the root cause though. Here is a part of the
Apparently the issue disappears when commenting out the I tried setting it also to Couple of more questions/thoughts. Omitting this hook from Also, from the logs I was able to see that at least 2 requests were executed before the According to the logs, the hook seems to be called twice. Is this a bug?
Thanks for the support :) |
I can confirm that this sporadic issue is triggered by setting the setCertificateVerifyProc hook. We are running into this issue on both Mac and Windows on v16.0.2 and v17.0.1 |
I made two Fiddles:
The difference is in the setCertificateVerifyProc handler: + const seenHostnames = new Set();
mainWindow.webContents.session.setCertificateVerifyProc((request, callback) => {
console.log('verify', request.hostname);
- callback(-3);
+ if (!seenHostnames.has(request.hostname)) {
+ seenHostnames.add(request.hostname);
+ callback(-3);
+ }
});
My hypothesis on why this bug happensIf you load a page ( Log from Fiddle 1Note how the page stops loading once the network service crashes. We would expect many more domains to be verified, since this particular URL loads resources from many other domains.
Logs from Fiddle 2
|
I managed to reproduce the bug on these versions:
using the first Fiddle. Sometimes have you to run it a couple of times for the bug to show. |
Crash dump:
That's crashing here, so Looks like what's happening is that the SSLClientSocketImpl is getting destroyed while the CertificateVerifyProc is in-flight due to a SPDY upgrade:
We should be able to detect this and tear down the in-flight verify request gracefully when the underlying socket is destroyed to avoid crashing. |
Looks like the way to get notified about request cancellation is by setting electron/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch Line 49 in e41c3e9
Destruction of that object signals cancellation: https://source.chromium.org/chromium/chromium/src/+/main:net/cert/cert_verifier.h;l=83;drc=459dba1945dd88c8dd98c6fbfd617f84e62eba99 CoalescingCertVerifier's logic is a bit complicated but does use this signal, as an example in upstream. |
@nornagon thank you so much for putting in the time. Currently this is last blocking bug for our next production release. You can't imagine how much this helps us out. I'm almost afraid to ask, but how much time does it usually take before a PR like this hits a stable release? |
Preflight Checklist
Electron Version
15.0.2
What operating system are you using?
Ubuntu
Operating System Version
Linux rrouwprlc0068 5.4.0-89-generic #100-Ubuntu SMP Fri Sep 24 14:50:10 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux, Ubuntu 20.04.3 LTS, GNOME Version 3.36.8, OS Type 64-bit
What arch are you using?
x64
Last Known Working Electron version
No response
Expected Behavior
Network service should not crash and the error
[15:1102/154337.143944:ERROR:network_service_instance_impl.cc(333)] Network service crashed, restarting service.
, to not appear in the logs.Actual Behavior
Sporadically, when I run Electron inside a Docker container, I get the following error:
Which causes partially rendering of the front-end application that is loaded with
win.loadURL
on localhost.The issue seems very similar to https://bbs.archlinux.org/viewtopic.php?id=268123, but nothing from the suggestions works consinstently.
Also, when closing the Electron window, I get an error
Which is caught inside the main.js when executing await
win.loadURL(url)
Also, in the browser window console, there is an error:
Any ideas on the issue?
Testcase Gist URL
No response
Additional Information
Chromedriver 95.0.0 v
The text was updated successfully, but these errors were encountered: