Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions desktop/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {autoUpdater} from 'electron-updater';
import {machineId} from 'node-machine-id';
import checkForUpdates from '@libs/checkForUpdates';
import {translate} from '@libs/Localize';
import Log from '@libs/Log';
import CONFIG from '@src/CONFIG';
import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
Expand Down Expand Up @@ -591,6 +592,17 @@ const mainWindow = (): Promise<void> => {
browserWindow.webContents.send(ELECTRON_EVENTS.BLUR);
});

// Handle renderer process crashes by relaunching the app
browserWindow.webContents.on('render-process-gone', (event, detailed) => {
if (detailed.reason === 'crashed') {
// relaunch app
app.relaunch({args: process.argv.slice(1).concat(['--relaunch'])});
app.exit(0);
}
Log.info('App crashed render-process-gone');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@yuwenmemon Just double-checking you agree with using Log.info here - my understanding is this will get sent to the server, so it'll be easier to track crashes down?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's correct. You may even want to use warn in this case if it's not expected.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
Log.info('App crashed render-process-gone');
Log.info('Desktop App crashed with "render-process-gone"');

Log.info(JSON.stringify(detailed));
});

app.on('before-quit', () => {
// Adding __DEV__ check because we want links to be handled by dev app only while it's running
// https://github.com/Expensify/App/issues/15965#issuecomment-1483182952
Expand Down