Skip to content

8265150: AsyncGetCallTrace crashes on ResourceMark #6606

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

Closed
wants to merge 1 commit into from

Conversation

coleenp
Copy link
Contributor

@coleenp coleenp commented Nov 30, 2021

This change seems to keep the test case in the bug from crashing in the ResourceMark destructor. We have a ResourceMark during stack walking in AsyncGetCallTrace. Also RegisterMap during jvmti shouldn't process oops, fix care of @fisk.
Testing tier1-6 in progress.


Progress

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

Issue

  • JDK-8265150: AsyncGetCallTrace crashes on ResourceMark

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 6606

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 30, 2021

👋 Welcome back coleenp! 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.

@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 30, 2021
@openjdk
Copy link

openjdk bot commented Nov 30, 2021

@coleenp The following labels will be automatically applied to this pull request:

  • hotspot
  • serviceability

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

@openjdk openjdk bot added serviceability serviceability-dev@openjdk.org hotspot hotspot-dev@openjdk.org labels Nov 30, 2021
@mlbridge
Copy link

mlbridge bot commented Nov 30, 2021

Webrevs

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Coleen,

This bypasses the currently observed problem, but we still have a fundamentally unsafe mechanism in use here. :(

Thanks,
David

@openjdk
Copy link

openjdk bot commented Nov 30, 2021

@coleenp 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:

8265150: AsyncGetCallTrace crashes on ResourceMark

Reviewed-by: dholmes, stuefe, eosterlund, sspitsyn

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 166 new commits pushed to the master branch:

  • 65251f7: 8151594: Move concurrent refinement thread activation logging out of GC pause
  • f1c20e9: 8190748: java/text/Format/DateFormat/DateFormatTest.java and NonGregorianFormatTest fail intermittently
  • 2942646: 8276683: Malformed Javadoc inline tags in JDK source in com/sun/tools/javac/util/RawDiagnosticFormatter.java
  • e30e676: 8277606: String(String) constructor could copy hashIsZero
  • 5a4a9bb: 8278019: ProblemList java/awt/dnd/BadSerializationTest/BadSerializationTest.java on linux and windows
  • 15a6806: 8277434: tests fail with "assert(is_forwarded()) failed: only decode when actually forwarded"
  • 21d9ca6: 8274983: C1 optimizes the invocation of private interface methods
  • 98a9f03: 8277602: Deopt code does not extend the stack enough if the caller is an optimize entry blob
  • 9150840: 8277899: Parallel: Simplify PSVirtualSpace::initialize logic
  • 01cefc9: 8277977: Incorrect references to --enable-reproducible-builds in docs
  • ... and 156 more: https://git.openjdk.java.net/jdk/compare/b6876649a82bed508d817ccbde1600d00937e4b2...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.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Nov 30, 2021
Copy link
Member

@tstuefe tstuefe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tstuefe
Copy link
Member

tstuefe commented Nov 30, 2021

Hi Coleen,

This bypasses the currently observed problem, but we still have a fundamentally unsafe mechanism in use here. :(

Thanks, David

Does AsyncGetCallTrace get triggered asynchronously via signal?

Copy link
Contributor

@fisk fisk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@dholmes-ora
Copy link
Member

Hi Coleen,
This bypasses the currently observed problem, but we still have a fundamentally unsafe mechanism in use here. :(
Thanks, David

Does AsyncGetCallTrace get triggered asynchronously via signal?

Yes:

C [libasyncProfiler.so+0x89b4] Profiler::getJavaTraceAsync(void*, ASGCT_CallFrame*, int)+0xd4
C [libasyncProfiler.so+0x9242] Profiler::recordSample(void*, unsigned long long, int, Event*)+0xd2 
C [libasyncProfiler.so+0x34f2c] PerfEvents::signalHandler(int, siginfo_t*, void*)+0x8c 

@tstuefe
Copy link
Member

tstuefe commented Nov 30, 2021

Hi Coleen,
This bypasses the currently observed problem, but we still have a fundamentally unsafe mechanism in use here. :(
Thanks, David

Does AsyncGetCallTrace get triggered asynchronously via signal?

Yes:

C [libasyncProfiler.so+0x89b4] Profiler::getJavaTraceAsync(void*, ASGCT_CallFrame*, int)+0xd4
C [libasyncProfiler.so+0x9242] Profiler::recordSample(void*, unsigned long long, int, Event*)+0xd2 
C [libasyncProfiler.so+0x34f2c] PerfEvents::signalHandler(int, siginfo_t*, void*)+0x8c 

What you could do is keep (on demand only) a secondary resource area per thread. On entering a context that may have been called by a signal handler, and with the current resource area in an unknown state, swap the current resource area pointer in Thread with that prepared secondary resource area, and upon leaving swap back. That way you never touch the original resource area.

Kind of like double buffering for signal contexts.

Copy link
Contributor

@sspitsyn sspitsyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Coleen,
I'm okay with this work around.
Thanks,
Serguei

@coleenp
Copy link
Contributor Author

coleenp commented Dec 4, 2021

This bypasses the currently observed problem, but we still have a fundamentally unsafe mechanism in use here. :(

Definitely. I think having some assert code that verifies that we don't do anything "unsafe" while in AsyncGetCallTrace might be a good enhancement, but the definition of "unsafe" in this case might be almost anything we do.

This change chops off a piece of the top of the iceberg as observed. Thanks for all the code reviews.
/integrate

@openjdk
Copy link

openjdk bot commented Dec 4, 2021

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

  • 9642629: 8276779: (ch) InputStream returned by Channels.newInputStream should have fast path for SelectableChannels
  • 02ee337: 8278175: Enable all doclint warnings for build of java.desktop
  • 24e16ac: 8277617: Adjust AVX3Threshold for copy/fill stubs
  • 2b87c2b: 8277793: Support vector F2I and D2L cast operations for X86
  • e1cde19: 8278247: KeyStoreSpi::engineGetAttributes does not throws KeyStoreException
  • a729a70: 8225181: KeyStore should have a getAttributes method
  • 38f525e: 8275821: Optimize random number generators developed in JDK-8248862 using Math.unsignedMultiplyHigh()
  • 780b8b1: 8278179: Enable all doclint warnings for build of java.naming
  • 678ac58: 8278240: ProblemList containers/docker/TestJcmd.java on linux-aarch64
  • 01cb2b9: 8277529: SIGSEGV in C2 CompilerThread Node::rematerialize() compiling Packet::readUnsignedTrint
  • ... and 242 more: https://git.openjdk.java.net/jdk/compare/b6876649a82bed508d817ccbde1600d00937e4b2...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Dec 4, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Dec 4, 2021
@openjdk
Copy link

openjdk bot commented Dec 4, 2021

@coleenp Pushed as commit 267c024.

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

@coleenp coleenp deleted the rollback branch December 4, 2021 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot hotspot-dev@openjdk.org integrated Pull request has been integrated serviceability serviceability-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

5 participants