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

fix(node): Send ANR events without scope if event loop blocked indefinitely #11578

Merged
merged 1 commit into from
Apr 12, 2024

Conversation

timfish
Copy link
Collaborator

@timfish timfish commented Apr 12, 2024

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.

@timfish timfish marked this pull request as ready for review April 12, 2024 11:27
Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

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

Thinking about this, do you think we can create spans that represent how long the event loop was blocked (and use the inspector to attach stacktrace or similar?)

@AbhiPrasad AbhiPrasad merged commit a1f3a11 into develop Apr 12, 2024
78 checks passed
@AbhiPrasad AbhiPrasad deleted the timfish/anr-infinine-block branch April 12, 2024 14:22
@timfish
Copy link
Collaborator Author

timfish commented Apr 12, 2024

Thinking about this, do you think we can create spans that represent how long the event loop was blocked (and use the inspector to attach stacktrace or similar?)

Yes, assuming the event loop becomes unblocked we can run any code in the main app thread. The only limitation I can think of is that our resolution will only be as good as our poll interval which is currently 50ms.

How would you add stack traces to spans?

@AbhiPrasad
Copy link
Member

How would you add stack traces to spans?

you can add code locations to span via the code attributes: https://opentelemetry.io/docs/specs/semconv/attributes-registry/code/

otherwise I guess most people rely on profiling data

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.
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.

2 participants