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
Electron 10 - sporadic illegal access
errors resulting in exit code 7 during process.exit
#25267
Comments
We've been seeing this in our CI occasionally and haven't been able to track it down. My best current guess is that it's related to I/O (possibly to stdout?) occurring during the shutdown process. |
@nornagon in #25430 you didn't seem super confident that you've found the root cause. I've been able to strip down my code base to a minimal example that reproduces it 100% of the time for me. I'm using a Worker Thread but I'm not sure if it is relevent to the issue. It's just what my stripped down version came down to. I hope it helps. Electron main.js const path = require('path');
const { Worker } = require('worker_threads');
const { app, BrowserWindow } = require('electron');
let worker = new Worker(path.join(__dirname, 'server.js'));
let mainWindow = null;
app.on('ready', () => {
mainWindow = new BrowserWindow();
}); server.js setInterval(() => {
console.log('hello from server');
}, 1000); Run it using
|
This should be fixed by #25430, which is not yet in a 10.x release but should be shortly. |
I just tested with 10.1.3 and my above code still errors, but now with I've updated it so it doesn't require user interaction (closing the window) anymore. Also here https://github.com/Prinzhorn/electron-illegal-access main.js const path = require('path');
const { Worker } = require('worker_threads');
const { app, BrowserWindow } = require('electron');
let worker = new Worker(path.join(__dirname, 'server.js'));
let mainWindow = null;
app.on('ready', () => {
mainWindow = new BrowserWindow();
mainWindow.close();
}); server.js (can actually just be empty as well) setInterval(() => {
console.log('hello from server');
}, 1000); Edit: with
Also the
Edit2: Maybe related? cypress-io/cypress#7048 @flotwig does Cypress use worker threads as well? Can you reproduce the issue with my code above? |
The code you've linked doesn't produce a segfault for me on master, but it does on 10.1.3. Here's the stack trace:
|
I've opened a new issue to track this: #25691 |
@Prinzhorn no, at least not in the officially-supported features those folks were using. We do have some experimental functionality that relies on worker_threads, which was runnin into a similar segfault issue with Electron 9: #23315 |
Preflight Checklist
Issue Details
Expected Behavior
process.exit(code)
exits the process with exit codecode
.Actual Behavior
After updating to Electron 10.0.0,
process.exit(0)
sporadically results in an error that looks like this:The process then exits with exit code
7
.Passing
--trace-uncaught
toelectron
seems to have no effect on the output.To Reproduce
You can see this error popping up in the status checks on our Electron 10 upgrade PR: cypress-io/cypress#8406
I attempted to make a reproducible example for this, but couldn't reproduce it outside of Cypress's tests.
To reproduce using Cypress's tests:
packages/server/test/e2e/1_deprecated_spec.ts
and add a.only
to thee2e.it
on line 22, so it reads:You should see the test fail about 1/3 of the time with exit code
7
and the error mentioned above.You can enable Cypress's debug logging by setting env var
DEBUG=cypress:*
, from which you can see that the last thing that happens before the crash is a call toprocess.exit(0)
.This is blocking us from upgrading to Electron 10, so please let me know if there is a way I can investigate further, or if I can provide any additional information to help debug.
The text was updated successfully, but these errors were encountered: