Skip to content

feat(node): Send ANR events from main thread #11525

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

Closed
wants to merge 2 commits into from

Conversation

timfish
Copy link
Collaborator

@timfish timfish commented Apr 10, 2024

This PR modifies the ANR integration to send ANR events from the main thread via the debugger interface.

Negatives

  • captureStackTrace option is removed as it's we require the debugger to send the events to the main thread. ANR without stack traces are not very actionable anyway [BREAKING!]

Positives

  • Minified ANR worker code goes from 42KB to 4KB
  • Events now include context lines and more up-to-date context
  • Dedupe/beforeSend now work

Still TODO

  • Test that events are still sent if the event loop is blocked indefinitely!

This comment was marked as off-topic.

@timfish timfish changed the title feat(node): Send ARN events from main thread feat(node): Send ANR events from main thread Apr 10, 2024
@timfish
Copy link
Collaborator Author

timfish commented Apr 12, 2024

If the event loop is blocked indefinitely, Runtime.evaluate never returns which means this isn't a viable option.

#11578 fixes where we're waiting on the scope to be returned in the existing implementation.

@timfish timfish closed this Apr 12, 2024
AbhiPrasad pushed a commit that referenced this pull request Apr 12, 2024
…nitely (#11578)

When experimenting for #11525 I found that `Runtime.evaluate` only
returns when the event loop becomes unblocked. This means that we are
not sending ANR events if the event loop is blocked indefinitely.

This PR adds a timeout that sends the ANR event if we have not been able
to evaluate the scope within 5 seconds.
cadesalaberry pushed a commit to cadesalaberry/sentry-javascript that referenced this pull request Apr 19, 2024
…nitely (getsentry#11578)

When experimenting for getsentry#11525 I found that `Runtime.evaluate` only
returns when the event loop becomes unblocked. This means that we are
not sending ANR events if the event loop is blocked indefinitely.

This PR adds a timeout that sends the ANR event if we have not been able
to evaluate the scope within 5 seconds.
@timfish timfish deleted the timfish/send-anr-from-main-thread branch July 30, 2024 22:52
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.

1 participant