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 debugger threads not being cleaned up properly #704

Merged
merged 1 commit into from
Nov 6, 2024

Conversation

kmagiera
Copy link
Member

@kmagiera kmagiera commented Nov 6, 2024

This PR adds a proper cleanup of debugger threads and source maps when the runtime is cleared fixing the issue where multiple hermes instances would appear in the threads section of the debugger after reloads.

Fixes #703

In this PR we utilize the Runtime.executionContextsCleared CDP message to delete virtual threads that we create in Runtime.executionContextCreated to track hermes VM instances.

We also update that message handler to clear source maps object as it is associated with the running VM, so when the VM reloads we need to propagate source maps again (which already happens).

How Has This Been Tested:

  1. With old and new debugger (i.e. on RN76 and epxo-router projects) try the below
  2. Set breakpoint, make sure the debugger stops
  3. Reload JS several times
  4. Observe there are no additional hermes instances getting listed in call stack section of the debugger tab
  5. Make sure the breakpoint still function after the reloads.

Copy link

vercel bot commented Nov 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
radon-ide ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 6, 2024 1:17pm

Copy link
Contributor

@maciekstosio maciekstosio left a comment

Choose a reason for hiding this comment

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

It also seems to help with ghost breakpoints and not being able to resume that I was having when compared to the current main

@kmagiera kmagiera merged commit 0b52a57 into main Nov 6, 2024
2 of 4 checks passed
@kmagiera kmagiera deleted the kmagiera/clear-threads-from-debug-adapter branch November 6, 2024 13:42
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.

JS reloads causes the list of threads accumulate many hermes inances
3 participants