8382170: Assert in AnyObj::operator delete due to race condition in in_aot_cache()#30726
Open
iklam wants to merge 5 commits intoopenjdk:masterfrom
Open
8382170: Assert in AnyObj::operator delete due to race condition in in_aot_cache()#30726iklam wants to merge 5 commits intoopenjdk:masterfrom
iklam wants to merge 5 commits intoopenjdk:masterfrom
Conversation
…_in_aot_cache() and AOTMetaspace::in_aot_cache()
|
👋 Welcome back iklam! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The range
_aot_metaspace_base ... _aot_metaspace_topis initialized in the main JVM thread during early bootstrap. In almost all cases when this range is consulted, the main thread has already published these two variables to all threads.However, since JDK-8374549, we could read this range during
GrowableArraysize adjustment or destruction, which can legally happen in anArchiveWorkerThreadbefore the range is properly initialized and published. The reader could get inconsistent values from these two variables and assert.The fix is to require the
GrowableArrayuse cases (inGrowableArrayCHeapAllocator::deallocate()andAnyObj::in_aot_cache()) to explicitly check for_aot_metaspace_range_initializedwithAtomicAccess::release_store/load_acquire.I also an assert to make sure in all other cases,
MetaspaceObj::is_pointer_in_aot_cache()is called only after the range is initialized. This should catch similar bugs in the future.Performance:
For performance reasons, I do not use
AtomicAccessto load the range itself. In the product build,AtomicAccess::load_acquireis called only inGrowableArrayCHeapAllocator::deallocate(), which happens very infrequently.Progress
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/30726/head:pull/30726$ git checkout pull/30726Update a local copy of the PR:
$ git checkout pull/30726$ git pull https://git.openjdk.org/jdk.git pull/30726/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 30726View PR using the GUI difftool:
$ git pr show -t 30726Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/30726.diff
Using Webrev
Link to Webrev Comment