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

8247351: [aarch64] NullPointerException during stack walking (clhsdb "where -a") #4737

Closed
wants to merge 1 commit into from

Conversation

@nick-arm
Copy link
Member

@nick-arm nick-arm commented Jul 9, 2021

Running the jtreg test serviceability/sa/ClhsdbWhere.java with -Xcomp
-XX:-TieredCompilation fails with the following exception:

Error: java.lang.NullPointerException: Cannot invoke "sun.jvm.hotspot.debugger.Address.getJLongAt(long)" because "valueAddr" is null
java.lang.NullPointerException: Cannot invoke "sun.jvm.hotspot.debugger.Address.getJLongAt(long)" because "valueAddr" is null
at jdk.hotspot.agent/sun.jvm.hotspot.runtime.CompiledVFrame.createStackValue(CompiledVFrame.java:270)
at jdk.hotspot.agent/sun.jvm.hotspot.runtime.CompiledVFrame.getLocals(CompiledVFrame.java:107)
at jdk.hotspot.agent/sun.jvm.hotspot.ui.classbrowser.HTMLGenerator.genHTMLForJavaStackTrace(HTMLGenerator.java:1937)
at jdk.hotspot.agent/sun.jvm.hotspot.CommandProcessor$43.doit(CommandProcessor.java:1573)
at jdk.hotspot.agent/sun.jvm.hotspot.CommandProcessor.executeCommand(CommandProcessor.java:2090)
at jdk.hotspot.agent/sun.jvm.hotspot.CommandProcessor.executeCommand(CommandProcessor.java:2060)

The oop map for the frame being inspected is:

ScopeDesc(pc=0x0000ffff8957e000 offset=140):
jdk.test.lib.apps.LingeredApp::steadyState@7 (line 536)
Locals
- l0: empty
- l1: reg rfp [58],oop
- l2: empty
Monitor stack
- @0: monitor{reg rfp [58],oop,stack[16]}

But RegisterMap::getLocation() returns a null Address for register
58 (=RFP).

This patch fixes two problems: the fp VMReg value used in
AARCH64Frame::updateMapWithSavedLink should be 29<<1 not 29 because a
VMReg has two slots in a 64-bit VM. The other bug is that
RegisterMap::setLocation and getLocation calculate the long
locationValid mask using (1 << (i % locationValidTypeSize)) where i and
locationValidTypeSize are both int. We need to do this calculation as a
long if i % locationValidTypeSize can be > 32. There's no failure on
x86_64 because that only has 16 integer registers.


Progress

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

Issue

  • JDK-8247351: [aarch64] NullPointerException during stack walking (clhsdb "where -a")

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 4737

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

Using diff file

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

Running the jtreg test serviceability/sa/ClhsdbWhere.java with -Xcomp
-XX:-TieredCompilation fails with the following exception:

  Error: java.lang.NullPointerException: Cannot invoke "sun.jvm.hotspot.debugger.Address.getJLongAt(long)" because "valueAddr" is null
  java.lang.NullPointerException: Cannot invoke "sun.jvm.hotspot.debugger.Address.getJLongAt(long)" because "valueAddr" is null
          at jdk.hotspot.agent/sun.jvm.hotspot.runtime.CompiledVFrame.createStackValue(CompiledVFrame.java:270)
          at jdk.hotspot.agent/sun.jvm.hotspot.runtime.CompiledVFrame.getLocals(CompiledVFrame.java:107)
          at jdk.hotspot.agent/sun.jvm.hotspot.ui.classbrowser.HTMLGenerator.genHTMLForJavaStackTrace(HTMLGenerator.java:1937)
          at jdk.hotspot.agent/sun.jvm.hotspot.CommandProcessor$43.doit(CommandProcessor.java:1573)
          at jdk.hotspot.agent/sun.jvm.hotspot.CommandProcessor.executeCommand(CommandProcessor.java:2090)
          at jdk.hotspot.agent/sun.jvm.hotspot.CommandProcessor.executeCommand(CommandProcessor.java:2060)

The oop map for the frame being inspected is:

   ScopeDesc(pc=0x0000ffff8957e000 offset=140):
   jdk.test.lib.apps.LingeredApp::steadyState@7 (line 536)
   Locals
    - l0: empty
    - l1: reg rfp [58],oop
    - l2: empty
   Monitor stack
    - @0: monitor{reg rfp [58],oop,stack[16]}

But RegisterMap::getLocation() returns a null Address for register
58 (=RFP).

This patch fixes two problems: the fp VMReg value used in
AARCH64Frame::updateMapWithSavedLink should be 29<<1 not 29 because a
VMReg has two slots in a 64-bit VM.  The other bug is that
RegisterMap::setLocation and getLocation calculate the long
locationValid mask using (1 << (i % locationValidTypeSize)) where i and
locationValidTypeSize are both int.  We need to do this calculation as a
long if i % locationValidTypeSize can be > 32.  There's no failure on
x86_64 because that only has 16 integer registers.
@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Jul 9, 2021

👋 Welcome back ngasson! 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 label Jul 9, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Jul 9, 2021

@nick-arm The following label will be automatically applied to this pull request:

  • serviceability

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.

@mlbridge
Copy link

@mlbridge mlbridge bot commented Jul 9, 2021

Webrevs

@plummercj
Copy link
Contributor

@plummercj plummercj commented Jul 12, 2021

How did you even get the test to run without running into JDK-8270199

@nick-arm
Copy link
Member Author

@nick-arm nick-arm commented Jul 13, 2021

How did you even get the test to run without running into JDK-8270199

Linux not macOS.

@plummercj
Copy link
Contributor

@plummercj plummercj commented Jul 13, 2021

How did you even get the test to run without running into JDK-8270199

Linux not macOS.

Ah. OK.

@plummercj
Copy link
Contributor

@plummercj plummercj commented Jul 13, 2021

This looks like a dup of https://bugs.openjdk.java.net/browse/JDK-8247351. If so, please close this CR out as a dup and target this PR to JDK-8247351.

@nick-arm
Copy link
Member Author

@nick-arm nick-arm commented Jul 14, 2021

/issue add JDK-8247351

@nick-arm
Copy link
Member Author

@nick-arm nick-arm commented Jul 14, 2021

/issue remove JDK-8270067

@openjdk
Copy link

@openjdk openjdk bot commented Jul 14, 2021

@nick-arm
Adding additional issue to issue list: 8247351: [aarch64] NullPointerException during stack walking (clhsdb "where -a").

@nick-arm nick-arm changed the title 8270067: AArch64: several clhsdb tests fail with -Xcomp 8247351: [aarch64] NullPointerException during stack walking (clhsdb "where -a") Jul 14, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Jul 14, 2021

@nick-arm The issue 8270067 was not found in the list of additional solved issues. The list currently contains these issues: 8247351

@nick-arm
Copy link
Member Author

@nick-arm nick-arm commented Jul 14, 2021

This looks like a dup of https://bugs.openjdk.java.net/browse/JDK-8247351. If so, please close this CR out as a dup and target this PR to JDK-8247351.

Yes, I missed that one. Thanks.

Copy link
Contributor

@plummercj plummercj left a comment

The changes look good.

I assume this bug also existed on PPC, although I don't see any bugs filed for it.

@openjdk
Copy link

@openjdk openjdk bot commented Jul 14, 2021

@nick-arm 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:

8247351: [aarch64] NullPointerException during stack walking (clhsdb "where -a")

Reviewed-by: cjplummer

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

  • 4a7ccf3: Merge
  • 8583aab: 8270025: DynamicCallSiteDesc::withArgs doesn't throw NPE
  • d32e42c: 8270184: [TESTBUG] Add coverage for jvmci ResolvedJavaType.toJavaName() for lambdas
  • b2416b6: 8269281: java/foreign/Test{Down,Up}call.java time out
  • bd95c0c: 8269635: Stress test SEGV while emitting OldObjectSample
  • 00ef65f: 8269525: Deadlock during Volano with JFR
  • e631add: 8259848: Interim javadoc build does not support platform links
  • 040c02b: 8269795: C2: Out of bounds array load floats above its range check in loop peeling resulting in SEGV
  • 0f32982: 8270203: Missing build dependency between jdk.jfr-gendata and buildtools-hotspot
  • 770e2aa: 8215948: [TESTBUG] gtest pseudo-JavaThreads could be more regular JavaThreads
  • ... and 41 more: https://git.openjdk.java.net/jdk/compare/676f1d76cab9108655f2ce462db321b975563eb7...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 label Jul 14, 2021
@nick-arm
Copy link
Member Author

@nick-arm nick-arm commented Jul 14, 2021

Thanks @plummercj . I think I did something wrong with the /issue commands and now I ended up with the JBS line in the commit message duplicated. Not sure how to fix that...

@nick-arm
Copy link
Member Author

@nick-arm nick-arm commented Jul 14, 2021

/issue remove JDK-8247351

@openjdk
Copy link

@openjdk openjdk bot commented Jul 14, 2021

@nick-arm
Removing additional issue from issue list: 8247351.

@plummercj
Copy link
Contributor

@plummercj plummercj commented Jul 14, 2021

Looks like it is ok now.

@nick-arm
Copy link
Member Author

@nick-arm nick-arm commented Jul 14, 2021

/integrate

@openjdk
Copy link

@openjdk openjdk bot commented Jul 14, 2021

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

  • 589a1d5: 8270155: ARM32: Improve register dump in hs_err
  • b6d7653: 8264419: Remove has_max_index argument from G1BlockOffsetTablePart::block_at_or_preceding
  • 4a7ccf3: Merge
  • 8583aab: 8270025: DynamicCallSiteDesc::withArgs doesn't throw NPE
  • d32e42c: 8270184: [TESTBUG] Add coverage for jvmci ResolvedJavaType.toJavaName() for lambdas
  • b2416b6: 8269281: java/foreign/Test{Down,Up}call.java time out
  • bd95c0c: 8269635: Stress test SEGV while emitting OldObjectSample
  • 00ef65f: 8269525: Deadlock during Volano with JFR
  • e631add: 8259848: Interim javadoc build does not support platform links
  • 040c02b: 8269795: C2: Out of bounds array load floats above its range check in loop peeling resulting in SEGV
  • ... and 43 more: https://git.openjdk.java.net/jdk/compare/676f1d76cab9108655f2ce462db321b975563eb7...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Jul 14, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Jul 14, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Jul 14, 2021

@nick-arm Pushed as commit 357fe09.

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

@plummercj
Copy link
Contributor

@plummercj plummercj commented Jul 14, 2021

FYI, 2 reviews are required for hotspot changes, and SA is considered to be part of hotspot.

@nick-arm
Copy link
Member Author

@nick-arm nick-arm commented Jul 15, 2021

OK, understood. Sorry about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants