You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
Segfault in AllocateJSPromise after upgrading to Electron 3 #19372
One interesting idea pointed out by @MarshallOfSound is that a limited number of code paths pass through Node's util::CreatePromise helper, defined here. I tried monkey-patching process.binding('util'), but the built-in Node modules that rely on this helper all capture it in their closure scope before I can run the monkey-patching code. But if we can somehow figure out where this function is getting called in our test suite, it might give us a hint as to the origin of the crash in our application JS. I'm not sure if that involves building our own version of Electron and injecting a console.trace or exception, or if there's an easier approach.
@nathansobo As that is being called from JS, you should be able to launch the inspector and add a breakpoint in that method to see when it gets called.
@MarshallOfSound Correct, but I think that has to do with the fact that we upgraded one of our dependencies to not use promisify anymore and now the crash is happening in JavaScript itself (possibly by creating a JS Promise via new Promise()).
Is it possible that a native module is using some V8's APIs in a weird/deprecated way (e.g., by not using AsyncResource correctly or whatnot) and then subsequent attempts to create Promises (or interacting with the async context in any way) generates an exception?
Is it possible that a native module is using some V8's APIs in a weird/deprecated way (e.g., by not using AsyncResource correctly or whatnot) and then subsequent attempts to create Promises (or interacting with the async context in any way) generates an exception?
Possible, but also unlikely, without knowing where it's crashing in the native module it's hard to say
@as-cii I commented out the code that watches the config file on the main process and encountered this crash on the render process on d5ee4ba when running the nsfw test suite with the nsfw repository open in Atom.
This seems to rule out nsfw's use of a deprecated code path to call back into JS as the cause of the crashes, since this version of Atom depends on an nsfw that includes your changes from fix-deprecations branch.
In bdf6b17, I hacked in some changes that seem to eliminate crashes of both the render process and the main process. We eliminate polling of the config file in the main process and process nsfw events in a process.nextTick callback. It's still worrisome that we don't really understand why these changes fix the crashes, however.
Nevermind. I encountered a render process crash after running the nsfw tests for a bit longer yesterday. Similar stack trace to those previously posted. The changes in bdf6b17 are not the solution.
Yesterday, we discovered that not using snapshots made the issue impossible to reproduce via the nsfw tests. That pushed me to investigate what could be possibly going wrong when running mksnapshot and, after some spelunking in the Electron codebase, I discovered electron/electron#18420.
The good news is that the Electron team is working on releasing a new version that doesn't exhibit this behavior, and we only need a small tweak on our side to finally ship Atom on Electron 3.
This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!
Activity
nornagon commentedon May 20, 2019
What electron version?
Arcanemagus commentedon May 20, 2019
This was from Electron 3.1.9.
nathansobo commentedon May 21, 2019
One interesting idea pointed out by @MarshallOfSound is that a limited number of code paths pass through Node's
util::CreatePromisehelper, defined here. I tried monkey-patchingprocess.binding('util'), but the built-in Node modules that rely on this helper all capture it in their closure scope before I can run the monkey-patching code. But if we can somehow figure out where this function is getting called in our test suite, it might give us a hint as to the origin of the crash in our application JS. I'm not sure if that involves building our own version of Electron and injecting aconsole.traceor exception, or if there's an easier approach.MarshallOfSound commentedon May 21, 2019
@nathansobo As that is being called from JS, you should be able to launch the inspector and add a breakpoint in that method to see when it gets called.
as-cii commentedon May 21, 2019
After merging upstream changes from Axosoft/nsfw, I am still able to reproduce this crash, even though
AllocateJSPromisedoesn't show up anymore:MarshallOfSound commentedon May 21, 2019
@as-cii That looks like a different stack trace to the one @nathansobo posted above, yours has no mention of node promise util
as-cii commentedon May 21, 2019
@MarshallOfSound Correct, but I think that has to do with the fact that we upgraded one of our dependencies to not use
promisifyanymore and now the crash is happening in JavaScript itself (possibly by creating a JSPromisevianew Promise()).Is it possible that a native module is using some V8's APIs in a weird/deprecated way (e.g., by not using
AsyncResourcecorrectly or whatnot) and then subsequent attempts to createPromises (or interacting with the async context in any way) generates an exception?MarshallOfSound commentedon May 21, 2019
Possible, but also unlikely, without knowing where it's crashing in the native module it's hard to say
nathansobo commentedon May 21, 2019
@as-cii I commented out the code that watches the config file on the main process and encountered this crash on the render process on d5ee4ba when running the
nsfwtest suite with thensfwrepository open in Atom.This seems to rule out
nsfw's use of a deprecated code path to call back into JS as the cause of the crashes, since this version of Atom depends on annsfwthat includes your changes fromfix-deprecationsbranch.nathansobo commentedon May 21, 2019
In bdf6b17, I hacked in some changes that seem to eliminate crashes of both the render process and the main process. We eliminate polling of the config file in the main process and process
nsfwevents in aprocess.nextTickcallback. It's still worrisome that we don't really understand why these changes fix the crashes, however.nathansobo commentedon May 22, 2019
Nevermind. I encountered a render process crash after running the
nsfwtests for a bit longer yesterday. Similar stack trace to those previously posted. The changes in bdf6b17 are not the solution.as-cii commentedon May 23, 2019
Yesterday, we discovered that not using snapshots made the issue impossible to reproduce via the
nsfwtests. That pushed me to investigate what could be possibly going wrong when runningmksnapshotand, after some spelunking in the Electron codebase, I discovered electron/electron#18420.The good news is that the Electron team is working on releasing a new version that doesn't exhibit this behavior, and we only need a small tweak on our side to finally ship Atom on Electron 3.
Stay tuned for an update on this.
lock commentedon Nov 26, 2019
This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!