-
-
Notifications
You must be signed in to change notification settings - Fork 58
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
Detect non-responsiveness (ANR) in Electron applications #729
Comments
@timfish could we do a quick investigation into how much time/effort this will take? |
Electron has the By default we currently only log breadcrumbs for these events. Tracking "unresponsiveness" in the Electron main process could be trickier since it controls the entire app. Blocking the main process event loop can disrupt communication between renderers and the GPU process and cause jankiness so notifying of excessive blocking would be very helpful. |
As we briefly discussed in the meeting with your CFO and Anthony, ANR (or app freeze) monitoring is as critical as crash monitoring. I see on your web site that other platforms (mobile, Mac) actually are supported but the Windows. This is an essential function we are looking for. If Sentry cannot support it, then we have to develop this solution in house and that somewhat de-values the Sentry. |
We're gonna take a more active look at this, but we need to spend time to make sure the solution has low overhead and is compatible with multiple Node/Electron versions. getsentry/sentry-javascript#9027 our end goal is not just to detect an ANR, but give you a stacktrace of what is causing it - hence the extra effort involved here. Appreciate your patience while we investigate and experiment. |
We've just released ANR tracking support for our Node SDK in |
The top post now has a task list covering all the PRs adding ANR support to Electron |
Thanks to the amazing work of @timfish we've shipped initial ANR tracking support for the Electron main process in a beta state in @fredyangRC please give it a try - we would love any feedback! |
We will try this build and give feedback. Thank you! @AbhiPrasad @timfish |
I have a question. In this #753, there is a import { init, enableAnrDetection } from '@sentry/electron';
init({ dsn: "__DSN__" });
// Electron v28+ with ESM
await enableAnrDetection({ mainProcess: { captureStackTrace: true }});
runApp();
// with CJS
enableAnrDetection({ mainProcess: { captureStackTrace: true }}).then(() => {
runApp();
}); But From the index.d.ts in @sentry/electron 4.13.0, there's no /**
* **Note** This feature is still in beta so there may be breaking changes in future releases.
*
* Starts a child process that detects Application Not Responding (ANR) errors.
*
* It's important to await on the returned promise before your app code to ensure this code does not run in the ANR
* child process.
*
* ```js
* import { init, enableAnrDetection } from '@sentry/electron';
*
* init({ dsn: "__DSN__" });
*
* // with ESM + Electron v28+
* await enableAnrDetection({ captureStackTrace: true });
* runApp();
*
* // with CJS
* enableAnrDetection({ captureStackTrace: true }).then(() => {
* runApp();
* });
* ```
*/
export declare function enableAnrDetection(options: Parameters<typeof enableNodeAnrDetection>[0]): Promise<void>;
//# sourceMappingURL=index.d.ts.map |
ANR will be detected whenever the main process JavaScript event loop is prevented from running and sending messages to the ANR process. |
Ah you're correct, the types exported from Until then, the types exported from |
Hi @timfish |
I will find out what's required to get that working. Do you have any feedback to share? For example are ANR levels what you would expect? Do you have |
As per getsentry/develop#931 we can add the ref getsentry/sentry-java#2475 and cc @romtsn Abnormal mechanism can be either one of |
Opened #774 to track ANR rate separately @MercuryLiRC please follow GH issue there for progress on that! |
Closing since we've merged in ANR work for the renderer. Now we just need to update docs for that and work toward closing #774. |
It's worth noting that in the next release, /**
* **Note** This feature is still in beta so there may be breaking changes in future releases.
*
* Starts a child process that detects Application Not Responding (ANR) errors.
*
* It's important to await on the returned promise before your app code to ensure this code does not run in the ANR
* child process.
*
* ```js
* import { init, enableMainProcessAnrDetection } from '@sentry/electron';
*
* init({ dsn: "__DSN__" });
*
* // with ESM + Electron v28+
* await enableMainProcessAnrDetection({ captureStackTrace: true });
* runApp();
*
* // with CJS
* enableMainProcessAnrDetection({ captureStackTrace: true }).then(() => {
* runApp();
* });
* ```
*/
export function enableMainProcessAnrDetection(options: Parameters<typeof enableNodeAnrDetection>[0]): Promise<void> { |
Problem Statement
Submitting on behalf of a customer:
The Electron SDK currently does not detect non-responsiveness/ANRs.
Prior work:
Solution Brainstorm
An internal chat with Abhi on slack notes that we may be able to do watchdog approach that monitors the main thread but it’ll have to investigated more.
Tasks
webContents
of renderers via custom protocol #762The text was updated successfully, but these errors were encountered: