Add initial implementation of cleanup logic when a Sandbox is evicted #8467
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.
Add initial implementation of cleanup logic when a Sandbox is evicted
Previously, when a Sandbox was evicted from SandboxManager, there was no logic
to shut down any of the associated resources. There was an implicit assumption
that the Sandbox would be garbage collected, and cleanup would magically occur,
but currently there are a lot of things preventing Sandbox GC from occurring,
and there are a lot of resources that need to be explicitly cleaned up.
Add a 'shutdown' method to Sandbox that closes the classloader and shuts down
the main executor thread. Although this is not currently sufficient to make the
Sandbox eligible for GC, it does free some resources.
Forthcoming CLs will add additional cleanup logic, with the eventual goal of
making Sandboxes eligible for GC when they are evicted from SandboxManager.