(0.37) Handle continuation scanning in pending to be mounted case #17046
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.
In order to reduce performance impact, we use one way synchronization
(concurrent continuation scan block continuation mount and skip the
concurrent continuation scan during mounted) between concurrent scanning
and continuation mounting instead of using full mutex.
But there would be a pending to be mounted case when a concurrent scan
block the mounting, during pending to be mounted, another concurrent
scan from different collector could be skipped, plus pending to be
mounted would cause the mounting thread release the vm access during
waiting, there might be race case for vm access between STW collector
and require back from the mounting thread, then the mounting thread
might stay ending to be mounted and the related continuation scan for
the STW collector would be skipped.
also there might be small gap between checking for last unmount and
other concurrent scan conditions, it could cause a race between
concurrent scanning and clean up the related java stacks.
Fix: #16652
backport #17030
backport #16713