Fix debugger threads not being cleaned up properly #704
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 inRuntime.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: