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
[macOS Big Sur] Kernel panic error caused by Electron Helper (Renderer) #27332
Comments
|
I have the same issue and it’s driving me nuts. I have also concluded it’s Electron (and not the Mac) because the same thing is happening on 2 different machines, both after upgrading to Big Sur. Please help! This is a major show stopping issue for us |
|
I have the same issue and have not found a solution yet. What I did find out it that the crash occurred every time I worked with the WebSocket library from node.js. I am using the Angular-Electron repository as a basis for my project. Here is what I did to cause the kernel panic error:
Here is what I think to be the relevant parts of my code: // electron.service.ts
// ...
import WebSocket from 'ws';
// ...
@Injectable({
providedIn: 'root'
})
export class ElectronService {
// ...
ws: typeof WebSocket;
// ...
constructor() {
if (this.isElectron) {
// ...
this.ws = window.require('ws');
}
}
}// myservice.service.ts
// ...
import { ElectronService } from '../electron/electron.service';
import WebSocket from 'ws';
// ...
Injectable({
providedIn: 'root'
})
export class MyServiceService {
// ...
private ws: typeof WebSocket
// ...
constructor(
private electronService: ElectronService
) {
this.ws = electronService.ws
}
// ...
public getUpdates(symbol: string): Observable<any> {
return new Observable((obs) => {
const socket = new this.ws(`wss://xxx:9443`);
socket.on('message', data => {
try {
const parsed = JSON.parse(data).data
obs.next(parsed)
} catch (error) {
console.log('Parse error: ' + error)
}
});
socket.on('error', error => {
console.error(error)
obs.complete()
})
return () => {
socket.close()
}
})
}
}Can you spot a similarity to your project? Please correct me if I am doing anything obvious incorrectly, I just started working with Electron today. EDIT: Added kernel log. |
|
Any updates from the dev team on this? This is happening 3-5 times per day for me. Also MacOS Big Sur. |
|
Sorry to hear that Apple's support was unresponsive, but this isn't something we can debug. We do not have access to the Darwin kernel source code or the tools required to debug kernel panics. I recommend escalating with Apple if possible. |
|
@nornagon But, isn't it partially the project's responsibility to try to get Apple's attention on this? Wouldn't the dev team of one of the largest open source projects on the planet submitting panic reports to Apple be more likely to elicit a response than just a random handful of lowly end-users? (no offense @robinclaes) |
|
Sadly, you overestimate our influence. If you have the ability to do so, I would recommend raising a TSI with Apple. |
|
Looks like threadstarter @Trafiz already contacted Apple, and open an issue op developer.apple.com. Maybe an update from this? |
|
@nornagon I reviewed the requirements for submitting a TSI and, well, that idea is dead on arrival (at least for me) for a number of reasons:
Right out of the gate, you must be a paying member of Apple's Dev program to even submit one of these—Strike 1.
Don't even think this is remotely possible...the app in question in my case (Obsidian) is not even open source—Strike 2.
Again, not open source, so there is no chance to get dSYMs, so no symbolication—Strike 3. There are more roadblocks, but it's pointless to go on. |
|
Same problem here on Catalina. Only while developing, so it has something to do w/ the filewatchers I guess |
|
@hans24o @Trafiz @luckman212 are you also using electron-forge? |
I'm not. |
|
After a lot of testing and debugging, I made some progress: Our codebase has some direct integrations with node from the renderer process (legacy, bad code). For example, we start a file watcher from the renderer process. The crashes happened significantly faster/more often as the folders we watched got bigger and bigger. This morning, I moved that code to the main process, starting the file watcher via ipc. So far I haven't had a crash yet (coming from consistently crashing within 2 minutes after starting the file watcher). It's still too short of a timespan to assume it completely solved the problem, but at least I wanted to post an update and see if others have similar node integrations/file watchers that run from the renderer process. Let me know what you think. |
|
@robinclaes Thank you for posting that, yes it's very helpful and interesting indeed. I confirmed with the developer of the project where I'm experiencing these crashes and he said they also initialize the filewatcher from the Renderer process. So the pattern is at least consistent there. Time will tell, would appreciate any further update/confirmation from your side on whether this is really fixed by this change. |
|
@robinclaes any further insight a week later? |
|
Also out of curiosity, what version of Electron are you testing with? For us it seems to be 11.x (we haven't had a chance to test with 12.x yet) |
|
So far so good, we haven't had any crashes since we start file watching via |
|
I'm particularly happy to hear this @robinclaes as it means hopefully my own software isn't waiting to suddenly crash for the first time, just when I really really don't want during a live performance... |
|
We were rewriting an application also because of that issue but got it at the new version again! My guess is that it's because of Node WS. More specifically we use https://github.com/jaggedsoft/node-binance-api for often changed trading data. |
|
Sorry for no updates on my part.
No, I'm not. @robinclaes what types of file watchers do you mean? Like fs.watch() / fs.watchFile()? If so, we don't use any of them. Also, I haven't had a panic error in the last 35 days but unfortunately I'm not sure what exactly could be the reason for that. First:
Second (more probable, as the date of introducing the change coincides with the date from which there are no panic errors): As I said, I'm not sure if this could be causing the renderer panic error, but maybe it will be helpful for you. |
|
A very similar issue is still happening with big commercial apps that I presume use electron (VSCode, Slack, Whatsapp, Figma). This is probably a hardware acceleration issue related to chromium as the kernel extensions in the backtrace are always similar to IOAcceleratorFamily2 and AppleIntelICLGraphics, the entire OS crash happens 2 to 3 times a day as I use these apps very often. |
|
Sadly, I'm also seeing this. It causes my machine to lock up and fully reboot about 3x per day. I'm running electron in dev mode, and the crash is attributed to Full dump |
I'm also facing this related to Electron Renderer, have you made any progress/insights on this? |
|
Today I was working with a simple |
|
@codingedgar which version of electron are you using, for the record? Have you been able to reproduce in other versions? |
Electron 11.0.1. It started to happen right after I added this line: /**
* Promise based download file method
*/
function downloadFile(remoteFile: string, localFile: string) {
return new Promise<void>((resolve, reject) => {
let file: fs.WriteStream | undefined;
const request = https.get(remoteFile, (response) => {
if (response.statusCode === 200) {
file = fs.createWriteStream(localFile);
response.pipe(file);
file.on('close', resolve);
file.on('error', (err) => {
fs.unlink(localFile, () => {
reject(err);
});
});
} else {
reject(response);
}
});
request.on('error', (e) => {
reject(e);
});
request.setTimeout(5000, reject); // <<<<< culprit, before adding this line it never happened before
});
}Before adding that line, sometimes I wonder if this is an issue that has been solved somewhere along the line and it is not present in other versions of electron. @Trafiz did the problem go away when you upgraded electron? |
|
@codingedgar does that code run in the context of a |
It does, I'll try that. Also, there have been several changes to how |
@xinaesthete, just to know more, why do you think if it runs on the node side it wouldn't crash?
|
|
@codingedgar yes, I think there is a very high probability that if it runs on the node side it won't crash. Hopefully it won't be too problematic to adapt your code, it can certainly lead to things getting more messy than they would otherwise be. I'm not an Electron developer or anything, so I'm not familiar with all of the internal technical details, I was going to comment something like that the node & chromium event loops being merged could mean some odd edge-cases around memory access. Actually it seems I was thinking of nw.js rather than Electron for the two contexts as their event-loops / stacks being merged... But still, I'm fairly convinced that there is something about bringing node into the renderer execution environment that is at root here. |
|
I solved this by upgrading to macOS Monterey, it seems to be a known issue also in Obsidian https://forum.obsidian.md/t/kernel-panic-on-macos-crash-reboot/12020/142 |
|
Yes I became aware of it because of Obsidian which used to crash badly sometimes, I haven't observed it in my own app. Also haven't had Obsidian crash for a while and I'm not on Monterey. |
Preflight Checklist
Issue Details
Expected Behavior
Electron Helper (Renderer) shouldn't caused macOS restart
Actual Behavior
Electron Helper (Renderer) restarts macOS
To Reproduce
I don't know the exact way to reproduce this problem, because when programming an application using Electron, the system automatically reboots at various intervals. I cannot share the entire codebase as it is a commercial product.
Additional Information
Hey, I have an issue with my Mac that keeps restarting periodically due to Electron Helper process. I develop app using Electron and few weeks ago I updated OS to Big Sur (I had no such problems with Catalina).
What happened:
During Electron app development Mac periodically restarts in different period of time (sometimes every few minutes, sometimes every few hours). It didn’t show any error logs at first, so here’s what I tried to do:
After these steps Mac still reboots but now with kernel panic log (attached below) with info about corresponding process - Electron Helper (Renderer).
I contacted the Apple service several times, they redirected the matter from the 1st line support to the 2nd, and from there to their 'engineers'. After a few days, I got the answer that Electron is the cause (something new...) and I have two options:
I also created similar issue on 'developer.apple.com', but with no answer.
I’m out of idea what else I can do. Maybe except downgrading to Catalina, but it’s not a solution at all.
I would be grateful for any suggestions
Kernel panic log.txt
The text was updated successfully, but these errors were encountered: