Skip to content
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

chore: log hint on renderer crash #25317

Merged
merged 2 commits into from Sep 15, 2020
Merged

chore: log hint on renderer crash #25317

merged 2 commits into from Sep 15, 2020

Conversation

codebytere
Copy link
Member

Description of Change

Refs #25141 (comment).

It's clear that we can and should provide more helpful tips when debugging certain types of crashes in Electron, but this seems like a small and helpful step we can take towards helping users debug renderer crashes. This will now log a small hint to console when the renderer crashes, telling them that they can set the logging env var to potentially see more information.

cc @ckerr @jkleinsc @zcbenz

Checklist

Release Notes

Notes: Added a small console hint to console to help debug renderer crashes.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Sep 4, 2020
lib/browser/api/web-contents.ts Outdated Show resolved Hide resolved
lib/browser/api/web-contents.ts Outdated Show resolved Hide resolved
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Sep 5, 2020
@codebytere codebytere merged commit fa7a29e into master Sep 15, 2020
@release-clerk
Copy link

release-clerk bot commented Sep 15, 2020

Release Notes Persisted

Added a small console hint to console to help debug renderer crashes.

@codebytere codebytere deleted the log-on-renderer-crash branch September 15, 2020 19:01
@trop
Copy link
Contributor

trop bot commented Sep 15, 2020

I have automatically backported this PR to "10-x-y", please check out #25472

@trop
Copy link
Contributor

trop bot commented Sep 15, 2020

I have automatically backported this PR to "9-x-y", please check out #25473

@trop
Copy link
Contributor

trop bot commented Sep 15, 2020

I have automatically backported this PR to "11-x-y", please check out #25474

@@ -461,6 +461,11 @@ const addReturnValueToEvent = (event: any) => {
});
};

const loggingEnabled = () => {
return Object.prototype.hasOwnProperty.call(process.env, 'ELECTRON_ENABLE_LOGGING') ||
process.argv.some(arg => arg.toLowerCase().startsWith('--enable-logging'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to use app.commandLine to check this sort of thing.

Suggested change
process.argv.some(arg => arg.toLowerCase().startsWith('--enable-logging'));
app.commandLine.hasSwitch('enable-logging')

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


// Log out a hint to help users better debug renderer crashes.
if (loggingEnabled()) {
console.info('Renderer process crashed - see https://www.electronjs.org/docs/tutorial/application-debugging for potential debugging information.');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we give some more info about the crash here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mlaurencin pushed a commit to mlaurencin/electron that referenced this pull request Sep 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants