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

Breakpoint not work when enable ANR detection. #1029

Closed
3 tasks done
CurryYangxx opened this issue Dec 6, 2024 · 5 comments · Fixed by getsentry/sentry-javascript#14643 or #1032
Closed
3 tasks done

Breakpoint not work when enable ANR detection. #1029

CurryYangxx opened this issue Dec 6, 2024 · 5 comments · Fixed by getsentry/sentry-javascript#14643 or #1032
Assignees

Comments

@CurryYangxx
Copy link

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Electron SDK Version

5.4.0

Electron Version

31.4.0

What platform are you using?

MacOS

Link to Sentry event

No response

Steps to Reproduce

  1. open anr when init
  // main
  Sentry.init({
    ...SENTRY_OPTIONS,
    transportOptions: {
      /**
       * Called before we attempt to send an envelope to Sentry.
       *
       * If this function returns false, `shouldStore` will be called to determine if the envelope should be stored.
       *
       * Default: () => true
       *
       * @param envelope The envelope that will be sent.
       * @returns Whether we should attempt to send the envelope
       */
      shouldSend: () => enabled,
    },
    integrations: [
      Sentry.anrIntegration({ captureStackTrace: true }),
    ],
  });

  // renderer
  Sentry.init({
    ...SENTRY_OPTIONS,
    // enable sentry tracing
    integrations: [Sentry.browserTracingIntegration()],
    // set 0.1 sample rate for traces, only send 10% of traces, and check whether the limit is exceeded
    // https://konghq.sentry.io/settings/billing/overview/?category=transactions
    tracesSampleRate: 0.1,
    anrDetection: {
      captureStackTrace: true,
    },
  });
  1. add debugger in jscode in renderer process
  2. open devtool and can not hit breakpoint
  3. after close anr option, if can stop at breakpoint

Expected Result

stop at breakpoint

Actual Result

can not stop at breakpoint

@s1gr1d
Copy link
Member

s1gr1d commented Dec 6, 2024

Hello, just to make sure I understood the issue correctly:

  • You have a debugger statement in your code
  • When the anrIntegration is added to Sentry, the devtools don't stop at the breakpoint
  • When you remove the anrIntegration (but Sentry is still enabled), the devtools stop at the breakpoint

Is this what is happening?

@timfish
Copy link
Collaborator

timfish commented Dec 6, 2024

In many ways, this is related to getsentry/sentry-javascript#13414.

Both local variables and ANR use the debugger and we should probably not enable them and log a warning when users pass debugger cli args?

@CurryYangxx
Copy link
Author

Hello, just to make sure I understood the issue correctly:

  • You have a debugger statement in your code
  • When the anrIntegration is added to Sentry, the devtools don't stop at the breakpoint
  • When you remove the anrIntegration (but Sentry is still enabled), the devtools stop at the breakpoint

Is this what is happening?

@s1gr1d yes

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Dec 6, 2024
@timfish timfish self-assigned this Dec 6, 2024
@s1gr1d
Copy link
Member

s1gr1d commented Dec 6, 2024

Both local variables and ANR use the debugger and we should probably not enable them and log a warning when users pass debugger cli args?

Yes, logging a warning sounds reasonable

@timfish
Copy link
Collaborator

timfish commented Dec 12, 2024

Reopened since this has not been merged into the Electron SDK yet...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment