Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8273695: Safepoint deadlock on VMOperation_lock #5613

Closed
wants to merge 7 commits into from

Conversation

@robehn
Copy link
Contributor

@robehn robehn commented Sep 21, 2021

We should not do any processing in SM::should_process().
The query is used to determine if we need to process safepoint/handshakes and with this change StackWaterMark.
When locking a Mutex which may be acquired in such processing, we must release that Mutex before we can start processing, otherwise we can deadlock.

This change adds a method to determine if StackWaterMarkSet::on_safepoint() will do any processing.
In that case there are poll is armed, we do not allow suspend handshakes and there is no safepoint and no non-suspend handshakes, we still return true if StackWaterMarkSet needs processing.
Thus the code querying should release any such Mutex and call process SM::process_if_requested().

The cross_modify_fence() do not have any such state, so we still need to emit that before returning false if poll is armed.

Passes t1-t4 and local stressing.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/5613/head:pull/5613
$ git checkout pull/5613

Update a local copy of the PR:
$ git checkout pull/5613
$ git pull https://git.openjdk.java.net/jdk pull/5613/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 5613

View PR using the GUI difftool:
$ git pr show -t 5613

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/5613.diff

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Sep 21, 2021

👋 Welcome back rehn! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Sep 21, 2021

@robehn The following label will be automatically applied to this pull request:

  • hotspot-runtime

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

Loading

@robehn robehn marked this pull request as ready for review Sep 21, 2021
@openjdk openjdk bot added the rfr label Sep 21, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Sep 21, 2021

Loading

@dcubed-ojdk
Copy link
Member

@dcubed-ojdk dcubed-ojdk commented Sep 21, 2021

@robehn - There are a couple of other bugs that are considered duplicates
of this bug. Some of those track failures in Tier7 and Tier8 so it would be a
good idea to do testing up through Tier8.

Loading

Copy link
Member

@dcubed-ojdk dcubed-ojdk left a comment

Thumbs up. Most of my comments are nits.

I have one question about a possible missing update_poll_values(thread) call
before cross_modify_fence().

Loading

src/hotspot/share/runtime/stackWatermarkSet.hpp Outdated Show resolved Hide resolved
Loading
src/hotspot/share/runtime/safepointMechanism.inline.hpp Outdated Show resolved Hide resolved
Loading
src/hotspot/share/runtime/safepointMechanism.inline.hpp Outdated Show resolved Hide resolved
Loading
src/hotspot/share/runtime/safepointMechanism.inline.hpp Outdated Show resolved Hide resolved
Loading
@openjdk
Copy link

@openjdk openjdk bot commented Sep 21, 2021

@robehn This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8273695: Safepoint deadlock on VMOperation_lock

Reviewed-by: dcubed, pchilanomate, eosterlund

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 32 new commits pushed to the master branch:

  • cc14c6f: 8274227: Remove "impl.prefix" jdk system property usage from InetAddress
  • 292d7bb: 8274363: Transitively sealed classes not considered exhaustive in switches
  • 1887028: 8269113: Javac throws when compiling switch (null)
  • b7b78ff: 8274561: sun/net/ftp/TestFtpTimeValue.java timed out on slow machines
  • 5e4b514: 8274550: c2i entry barriers read int as long on PPC
  • 2e690ba: 8274322: Problems with oopDesc construction
  • a8edd1b: 8274527: Minimal VM build fails after JDK-8273459
  • 7326481: 8274393: Suppress more warnings on non-serializable non-transient instance fields in security libs
  • 8215b2e: 8274398: Suppress more warnings on non-serializable non-transient instance fields in management libs
  • 9573022: 8253197: vmTestbase/nsk/jvmti/StopThread/stopthrd007/TestDescription.java fails with "ERROR: DebuggeeSleepingThread: ThreadDeath lost"
  • ... and 22 more: https://git.openjdk.java.net/jdk/compare/756d22c3563ac92e74bb68d5eecb86d4fbab2c6b...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

Loading

@openjdk openjdk bot added the ready label Sep 21, 2021
Copy link
Member

@dholmes-ora dholmes-ora left a comment

Hi Robbin,

Not knowing anything about stackwatermarks and their use I can't really review this in any detail. Avoiding the call to StackWatermarkSet::on_safepoint so that should_process is just a query does seem like a reasonable thing to do to avoid the problem. That said I'm more generally concerned that something hooked into the lowest-levels of the safepoint/handshake code can itself have a dependency on execution of a safepoint operation!

Cheers,
David

Loading

src/hotspot/share/runtime/safepointMechanism.inline.hpp Outdated Show resolved Hide resolved
Loading
@robehn
Copy link
Contributor Author

@robehn robehn commented Sep 22, 2021

@robehn - There are a couple of other bugs that are considered duplicates
of this bug. Some of those track failures in Tier7 and Tier8 so it would be a
good idea to do testing up through Tier8.

I started more testing.

Loading

Copy link
Member

@dcubed-ojdk dcubed-ojdk left a comment

Thumbs up.

Minor typographical nits.

Loading

src/hotspot/share/runtime/safepointMechanism.inline.hpp Outdated Show resolved Hide resolved
Loading
src/hotspot/share/runtime/safepointMechanism.inline.hpp Outdated Show resolved Hide resolved
Loading
@robehn
Copy link
Contributor Author

@robehn robehn commented Sep 24, 2021

@robehn - There are a couple of other bugs that are considered duplicates
of this bug. Some of those track failures in Tier7 and Tier8 so it would be a
good idea to do testing up through Tier8.

I started more testing.

After some investigations it passes t6-t8 (unrelated failures).
@dcubed-ojdk thanks
@dholmes-ora noted

Loading

Copy link
Contributor

@pchilano pchilano left a comment

LGTM!

Loading

src/hotspot/share/runtime/safepointMechanism.inline.hpp Outdated Show resolved Hide resolved
Loading
@robehn
Copy link
Contributor Author

@robehn robehn commented Sep 29, 2021

LGTM!

Thank you @pchilano !

Loading

fisk
fisk approved these changes Oct 1, 2021
Copy link
Contributor

@fisk fisk left a comment

Looks good Robbin!

Loading

@robehn
Copy link
Contributor Author

@robehn robehn commented Oct 3, 2021

Looks good Robbin!

Thanks Erik!

Loading

@robehn
Copy link
Contributor Author

@robehn robehn commented Oct 3, 2021

/integrate

Go!

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Oct 4, 2021

Going to push as commit 7957994.
Since your change was applied there have been 38 commits pushed to the master branch:

  • 9ca6bf0: 8274505: Too weak variable type leads to unnecessary cast in java.desktop
  • 0786d8b: 8268435: (ch) ChannelInputStream could override readAllBytes
  • bb4500d: 8274465: Fix javax/swing/text/ParagraphView/6364882/bug6364882.java failures
  • 05d3860: 8274605: Fix predicate guarantees on returned values in (Doc)SourcePositions
  • 3d7671b: 8274562: (fs) UserDefinedFileAttributeView doesn't correctly determine if supported when using OverlayFS
  • c05dc26: 8274435: EXCEPTION_ACCESS_VIOLATION in BFSClosure::closure_impl
  • cc14c6f: 8274227: Remove "impl.prefix" jdk system property usage from InetAddress
  • 292d7bb: 8274363: Transitively sealed classes not considered exhaustive in switches
  • 1887028: 8269113: Javac throws when compiling switch (null)
  • b7b78ff: 8274561: sun/net/ftp/TestFtpTimeValue.java timed out on slow machines
  • ... and 28 more: https://git.openjdk.java.net/jdk/compare/756d22c3563ac92e74bb68d5eecb86d4fbab2c6b...master

Your commit was automatically rebased without conflicts.

Loading

@openjdk openjdk bot closed this Oct 4, 2021
@openjdk openjdk bot added integrated and removed ready labels Oct 4, 2021
@openjdk openjdk bot removed the rfr label Oct 4, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Oct 4, 2021

@robehn Pushed as commit 7957994.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Loading

@robehn robehn deleted the 8273695-swm-should-proc branch Oct 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
5 participants