8369944: Notification can be lost due to interrupt in Object.wait - #703
8369944: Notification can be lost due to interrupt in Object.wait#703theaoqi wants to merge 1 commit into
Conversation
|
👋 Welcome back aoqi! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
|
This backport pull request has now been updated with issue from the original commit. |
|
|
|
/approval request Clean backport of JDK-8369944. The fix removes the redundant _notified field from ObjectWaiter and uses node.TState exclusively to determine notification state, fixing a bug due to unordered reads of independent volatile fields. JDK-8369944 has been in JDK 26 since GA (~5 months) with no reported regressions. Locally tested tier1/tier2/tier3 on x86_64 (release and fastdebug), no issues found. The risk is low: the fix simplifies the code by removing a redundant state field. |
|
Hi @theaoqi |
|
Hi @GoeLin , Thanks for the reply. The reason I am requesting this backport is as follows. It started because this backport fixes a crash on the LoongArch platform. However, note that OpenJDK does not officially support LoongArch (JIT), and this crash occurs in our self-maintained repository. Still, we think this issue may also affect other weakly-ordered architectures, which is why I am requesting this backport. I cannot confirm whether other platforms can actually reproduce this issue since I lack the testing environment. The problem first became observable after JDK-8343840 and its corresponding LoongArch port, so it has been visible for over a year now. |
This is a clean backport of JDK-8369944 from mainline. The original change removes the redundant
_notifiedfield from ObjectWaiter and usesnode.TStateexclusively to determine whether a thread was notified.On LoongArch64, this fix addresses a low-probability crash:
guarantee(node.TState != ObjectWaiter::TS_WAIT) failed: invariant.The crash is possibly due to the ordering between
TStateand_notifiednot being guaranteed on weakly-ordered architectures. Applying this patch resolves the crash.Progress
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk25u-dev.git pull/703/head:pull/703$ git checkout pull/703Update a local copy of the PR:
$ git checkout pull/703$ git pull https://git.openjdk.org/jdk25u-dev.git pull/703/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 703View PR using the GUI difftool:
$ git pr show -t 703Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk25u-dev/pull/703.diff
Using Webrev
Link to Webrev Comment