Skip to content

Conversation

@MBaesken
Copy link
Member

@MBaesken MBaesken commented Jan 21, 2025

We were running into this error :
sun/tools/jhsdb/HeapDumpTestWithActiveProcess.java on Linux aarch64, jdk25

stderr: [java.lang.RuntimeException: Unable to deduce type of thread from address 0x0000ffff34144e30 (expected type JavaThread, CompilerThread, MonitorDeflationThread, AttachListenerThread, StringDedupThread, NotificationThread, ServiceThread or JvmtiAgentThread)
at jdk.hotspot.agent/sun.jvm.hotspot.runtime.Threads.createJavaThreadWrapper(Threads.java:196)
at jdk.hotspot.agent/sun.jvm.hotspot.runtime.Threads.getJavaThreadAt(Threads.java:178)
at jdk.hotspot.agent/sun.jvm.hotspot.utilities.HeapHprofBinWriter.dumpStackTraces(HeapHprofBinWriter.java:828)
at jdk.hotspot.agent/sun.jvm.hotspot.utilities.HeapHprofBinWriter.write(HeapHprofBinWriter.java:460)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.JMap.writeHeapHprofBin(JMap.java:216)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.JMap.run(JMap.java:103)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.startInternal(Tool.java:278)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.start(Tool.java:241)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.execute(Tool.java:134)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.JMap.main(JMap.java:202)
at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.runJMAP(SALauncher.java:344)
at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.main(SALauncher.java:507)
Caused by: sun.jvm.hotspot.types.WrongTypeException: No suitable match for type of address 0x0000ffff34144e30
at jdk.hotspot.agent/sun.jvm.hotspot.runtime.InstanceConstructor.newWrongTypeException(InstanceConstructor.java:62)
at jdk.hotspot.agent/sun.jvm.hotspot.runtime.VirtualConstructor.instantiateWrapperFor(VirtualConstructor.java:80)
at jdk.hotspot.agent/sun.jvm.hotspot.runtime.Threads.createJavaThreadWrapper(Threads.java:192)
... 11 more

In the discussion in the JBS bug it was found that a retry option inlaunchshould be added.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8347779: sun/tools/jhsdb/HeapDumpTestWithActiveProcess.java fails with Unable to deduce type of thread from address (Bug - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/23213/head:pull/23213
$ git checkout pull/23213

Update a local copy of the PR:
$ git checkout pull/23213
$ git pull https://git.openjdk.org/jdk.git pull/23213/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 23213

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/23213.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 21, 2025

👋 Welcome back mbaesken! 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
Copy link

openjdk bot commented Jan 21, 2025

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

8347779: sun/tools/jhsdb/HeapDumpTestWithActiveProcess.java fails with Unable to deduce type of thread from address

Reviewed-by: cjplummer, kevinw

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

  • cbe9ec5: 8348905: Add support to specify the JDK for compiling Jtreg tests
  • 6b581d2: 8347997: assert(false) failed: EA: missing memory path
  • 4662363: 8348687: [BACKOUT] C2: Non-fluid StringBuilder pattern bails out in OptoStringConcat
  • d266ca9: 8348752: Enable -XX:+AOTClassLinking by default when -XX:AOTMode is specified
  • cbc89a7: 8348898: Remove unused OctalDigits to clean up code
  • 96fefed: 8319850: PrintInlining should print which methods are late inlines
  • 51cce6e: 8318577: Windows Look-and-Feel JProgressBarUI does not render correctly on 2x UI scale
  • 6bfae3a: 8333386: TestAbortOnVMOperationTimeout test fails for client VM
  • f98d9a3: 8348870: Eliminate array bound checks in DecimalDigits
  • fe6d9ab: 8348582: Set -fstack-protector when building with clang
  • ... and 125 more: https://git.openjdk.org/jdk/compare/c33c1cfe7349ac657cd7bf54861227709d3c8f1b...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 changed the title JDK-8347779: sun/tools/jhsdb/HeapDumpTestWithActiveProcess.java fails with Unable to deduce type of thread from address 8347779: sun/tools/jhsdb/HeapDumpTestWithActiveProcess.java fails with Unable to deduce type of thread from address Jan 21, 2025
@openjdk openjdk bot added the rfr Pull request is ready for review label Jan 21, 2025
@openjdk
Copy link

openjdk bot commented Jan 21, 2025

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

  • core-libs
  • 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 core-libs core-libs-dev@openjdk.org labels Jan 21, 2025
@mlbridge
Copy link

mlbridge bot commented Jan 21, 2025

Webrevs

Comment on lines 101 to 104
boolean res = launch(expectedMessage, Arrays.asList(toolArgs), true);
if (!res) { // try once more
launch(expectedMessage, Arrays.asList(toolArgs), false);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

launch() should take an allowRetry argument and only retry if true. This test is operated in two different modes. One is with an active target process and one is with a target process that should be stabilized and inactive. The latter is not allowed to retry since it should never fail. Also, it would help to add a comment as to why the retry is being done. See the comment in printStackTrace().

I think a better approach would be for launch() to just return if a retry should be done. testHeapDump() should check the result, and just immediately return true if launch() returns true.

Copy link
Member Author

Choose a reason for hiding this comment

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

launch() should take an allowRetry argument and only retry if true.

Are you talking about public static void launch(String expectedMessage, String... toolArgs) ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, but my suggestion on how to fix this might not be the best one. It's a bit hard to get the naming and usage of flags and logic right here. allowRetry, vs retry, vs doSleep. They all relate. Bottom line is that we should only ever attempt a retry if doSleep is false. Right now that flag is checked in printStackTraces(), and determines if true should be returned to allow a retry, but only if we aren't already doing a retry. Something similar needs to be done with launch() when it is deciding to return true or false after a failure. Right now it is only checking the allowRetry flag, but it should also check the doSleep flag.

I think in testHeapDump(), the calling of launch(String expectedMessage, String... toolArgs) should be done in a way similar to calling printStackTraces(). Pass in allowRetry and assign the result to the retry boolean. If retry is true, then return it right away (back to main() so it can retry). In launch(String expectedMessage, String... toolArgs), only call launch(String expectedMessage, List<String> toolArgs, boolean allowRetry) once, passing in allowRetry flag. In launch(String expectedMessage, List<String> toolArgs, boolean allowRetry), only return true to allow a retry if allowRetry is true and doSleep is false.

Anyway, it's kind of messy and there may be another way. The key issue with your current version is that it always allows for a retry, but it should only allow a retry if doSleep is false.

@AlanBateman
Copy link
Contributor

/label remove core-libs

@openjdk openjdk bot removed the core-libs core-libs-dev@openjdk.org label Jan 23, 2025
@openjdk
Copy link

openjdk bot commented Jan 23, 2025

@AlanBateman
The core-libs label was successfully removed.

@MBaesken
Copy link
Member Author

I added more output as suggested and check doSleep in launch; are you fine with latest version ?

Copy link
Contributor

@plummercj plummercj left a comment

Choose a reason for hiding this comment

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

It's functionally correct but could use some comments.

static boolean doSleep = true; // By default do a short sleep when app starts up

public static void launch(String expectedMessage, List<String> toolArgs)
public static boolean launch(String expectedMessage, List<String> toolArgs, boolean allowRetry)
Copy link
Contributor

Choose a reason for hiding this comment

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

You should add a comment explaining the return value like we have for printStackTraces().


launch(expectedMessage, Arrays.asList(toolArgs));
boolean res = launch(expectedMessage, Arrays.asList(toolArgs), true);
if (!res && !doSleep) {
Copy link
Contributor

Choose a reason for hiding this comment

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

You should explain why we allow a retry here, and only for !doSleep, like we do in printStackTraces(). Note the doSleep reason is a bit different here. It is because the sleep allows the debuggee to stabilize, making it very unlikely that jmap will fail.

@MBaesken
Copy link
Member Author

Hi Chris, I added comments .

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jan 29, 2025
@MBaesken
Copy link
Member Author

Thanks for the reviews !

/integrate

@openjdk
Copy link

openjdk bot commented Jan 30, 2025

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

  • d985b31: 8342096: Popup menus that request focus are not shown on Linux with Wayland
  • cbe9ec5: 8348905: Add support to specify the JDK for compiling Jtreg tests
  • 6b581d2: 8347997: assert(false) failed: EA: missing memory path
  • 4662363: 8348687: [BACKOUT] C2: Non-fluid StringBuilder pattern bails out in OptoStringConcat
  • d266ca9: 8348752: Enable -XX:+AOTClassLinking by default when -XX:AOTMode is specified
  • cbc89a7: 8348898: Remove unused OctalDigits to clean up code
  • 96fefed: 8319850: PrintInlining should print which methods are late inlines
  • 51cce6e: 8318577: Windows Look-and-Feel JProgressBarUI does not render correctly on 2x UI scale
  • 6bfae3a: 8333386: TestAbortOnVMOperationTimeout test fails for client VM
  • f98d9a3: 8348870: Eliminate array bound checks in DecimalDigits
  • ... and 126 more: https://git.openjdk.org/jdk/compare/c33c1cfe7349ac657cd7bf54861227709d3c8f1b...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jan 30, 2025
@openjdk openjdk bot closed this Jan 30, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jan 30, 2025
@openjdk
Copy link

openjdk bot commented Jan 30, 2025

@MBaesken Pushed as commit 04c24f1.

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

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

Labels

integrated Pull request has been integrated serviceability serviceability-dev@openjdk.org

Development

Successfully merging this pull request may close these issues.

4 participants