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

DDR vthreads command no longer works #17084

Closed
keithc-ca opened this issue Mar 31, 2023 · 15 comments · Fixed by #17093
Closed

DDR vthreads command no longer works #17084

keithc-ca opened this issue Mar 31, 2023 · 15 comments · Fixed by #17093

Comments

@keithc-ca
Copy link
Contributor

Java -version output

$ java -Xdump:system:events=vmstop -version
openjdk version "21-internal" 2023-09-19
OpenJDK Runtime Environment (build 21-internal-adhoc.keithc.jdknext)
Eclipse OpenJ9 VM (build main-55b92677405, JRE 21 Linux amd64-64-Bit Compressed References 20230323_000000 (JIT enabled, AOT enabled)
OpenJ9   - 55b92677405
OMR      - e6796be5b15
JCL      - 80e1dc85e7e based on jdk-21+13)

Summary of problem

Core dumps created by VM which include the changes in #16855 will not have the field J9JavaVM.virtualThreadLinkNextOffset. Attempts to use the !vthreads command will always just fail:

> !vthreads
Problem running command:
com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException: java.lang.NoSuchFieldException
	at com.ibm.j9ddr.vm29.tools.ddrinteractive.VirtualThreadsCommand.run(VirtualThreadsCommand.java:64)
	at openj9.dtfj/com.ibm.j9ddr.tools.ddrinteractive.Context.tryCommand(Context.java:229)
	at openj9.dtfj/com.ibm.j9ddr.tools.ddrinteractive.Context.execute(Context.java:202)
	at openj9.dtfj/com.ibm.j9ddr.tools.ddrinteractive.DDRInteractive.execute(DDRInteractive.java:356)
	at openj9.dtfj/com.ibm.j9ddr.command.CommandReader.processLine(CommandReader.java:78)
	at openj9.dtfj/com.ibm.j9ddr.tools.ddrinteractive.DDRInteractive.processLine(DDRInteractive.java:331)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:578)
	at openj9.dtfjview/com.ibm.jvm.dtfjview.CombinedContext.executeDDRInteractiveCommand(CombinedContext.java:258)
	at openj9.dtfjview/com.ibm.jvm.dtfjview.CombinedContext.execute(CombinedContext.java:169)
	at openj9.dtfjview/com.ibm.jvm.dtfjview.Session.execute(Session.java:813)
	at openj9.dtfjview/com.ibm.jvm.dtfjview.Session.execute(Session.java:767)
	at openj9.dtfjview/com.ibm.jvm.dtfjview.tools.ToolsRegistry.executeJdmpviewCommand(ToolsRegistry.java:183)
	at openj9.dtfjview/com.ibm.jvm.dtfjview.tools.ToolsRegistry.execute(ToolsRegistry.java:107)
	at openj9.dtfjview/com.ibm.jvm.dtfjview.tools.ToolsRegistry.execute(ToolsRegistry.java:88)
	at openj9.dtfjview/com.ibm.jvm.dtfjview.tools.ToolsRegistry.recordAndExecute(ToolsRegistry.java:72)
	at openj9.dtfjview/com.ibm.jvm.dtfjview.Session.runInteractive(Session.java:741)
	at openj9.dtfjview/com.ibm.jvm.dtfjview.Session.run(Session.java:665)
	at openj9.dtfjview/com.ibm.jvm.dtfjview.DTFJView.launch(DTFJView.java:52)
	at openj9.dtfjview/com.ibm.jvm.dtfjview.DTFJView.main(DTFJView.java:46)
Caused by: java.lang.NoSuchFieldException
	at com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer.liveVirtualThreadList(Unknown Source)
	at com.ibm.j9ddr.vm29.tools.ddrinteractive.VirtualThreadsCommand.displayVirtualThreads(VirtualThreadsCommand.java:75)
	at com.ibm.j9ddr.vm29.tools.ddrinteractive.VirtualThreadsCommand.run(VirtualThreadsCommand.java:61)
	... 19 more
@keithc-ca
Copy link
Contributor Author

FYI @fengxue-IS @gacholio @tajila

@pshipton pshipton added this to the Java 19 0.37 milestone Mar 31, 2023
@babsingh
Copy link
Contributor

babsingh commented Apr 3, 2023

@thallium Can you provide links to the PRs where !vthreads and !continuationstack are being reworked?

I don't believe !vthreads has been formally documented. So, it does not need to be fixed for the 0.37 release.

@babsingh
Copy link
Contributor

babsingh commented Apr 3, 2023

Alone !vthreads is not sufficient, both !vthreads and !continuationstack are needed for complete diagnostic support.

For the JDK19 release, the easiest approach would be to disable the !vthreads cmd for resolving the reported DDR error.

@fengxue-IS
Copy link
Contributor

I agree with @babsingh , Without !continuationstack, the use of !vthreads is only to list out all the allocated vthread objects, it wouldn't be very useful if DDR user cannot see the associated stack with the vthread as nothing in the vthread object it self can go wrong.

@keithc-ca
Copy link
Contributor Author

Unfortunately, if the standard were that it was "formally documented", we would have very few commands. I don't think that's a helpful measure.

Yes, the output of !vthreads includes !continuationstack which is not yet implemented, but other helpful information provided, so I think we should try to keep it. Unless there's some other way to enumerate VirtualThread objects, I suggest we use JavaHeap.getObjects(), checking that the class is java.lang.VirtualThread.

@babsingh
Copy link
Contributor

babsingh commented Apr 3, 2023

JDK19 is the first Openj9 release where !vthreads will be publicly published. We do have an option to push !vthreads to the next release since it does not exist in any prior OpenJ9 release.

@gacholio
Copy link
Contributor

gacholio commented Apr 3, 2023

This sort of thing is for VM developers, not users. Why would we document it at all (other than in the !help list)?

@babsingh
Copy link
Contributor

babsingh commented Apr 3, 2023

Why would we document it at all (other than in the !help list)?

Yes, it does not need to be documented. I used the wrong phrase formally documented -> published in an earlier OpenJ9 release.

Not sure how quickly #17093 will be merged. @pshipton When are the JDK19 release builds scheduled?

@pshipton
Copy link
Member

pshipton commented Apr 3, 2023

There is no fixed schedule other than asap. We are waiting for the things in the milestone plan to be resolved in order to proceed with RC1. Typically we allow DDR updates to occur after a release since you can use a later build to investigate core files created by earlier builds. Are there quick updates we can make as Keith suggests in #17084 (comment), or is it better to defer this?

@babsingh
Copy link
Contributor

babsingh commented Apr 3, 2023

Are there quick updates we can make as Keith suggests in #17084 (comment), or is it better to defer this?

#17093 should be the first preference. @keithc-ca Let us know if #17093 is close to being merged. If not, we can explore the JavaHeap.getObjects suggestion.

@gacholio
Copy link
Contributor

gacholio commented Apr 3, 2023

It should be noted that both of these solutions are unrealible if the heap is in a bad state (i.e. in the middle of a GC). The JVMTI code also flushes some GC stuff before walking the continuation list, which DDR will of course not be able to do. I have no solution for this.

@babsingh
Copy link
Contributor

babsingh commented Apr 3, 2023

The JVMTI code also flushes some GC stuff before walking the continuation list, which DDR will of course not be able to do.

Option 1: We can invoke j9gc_flush_nonAllocationCaches_for_walk prior to system dump (core file) generation. There will be a timing gap if the system dump is not created under exclusive VM access i.e the GC will be able to update the continuation list.

Option 2: Iterate through GC's nonAllocationCaches in DDR.

@amicic @LinHu2016 @dmitripivkine for thoughts?

@keithc-ca
Copy link
Contributor Author

Let us know if #17093 is close to being merged.

Yes, I expect it's close.

@dmitripivkine
Copy link
Contributor

The JVMTI code also flushes some GC stuff before walking the continuation list, which DDR will of course not be able to do.

Option 1: We can invoke j9gc_flush_nonAllocationCaches_for_walk prior to system dump (core file) generation. There will be a timing gap if the system dump is not created under exclusive VM access i.e the GC will be able to update the continuation list.

Option 2: Iterate through GC's nonAllocationCaches in DDR.

@amicic @LinHu2016 @dmitripivkine for thoughts?

I believe nonAllocationCaches should be flushed already before core generation. There is very similar logic for Ownable Synchronizers lists in gccheck can be used as example.

thallium added a commit to thallium/openj9 that referenced this issue Apr 11, 2023
Fixes eclipse-openj9#17084

Signed-off-by: Gengchen Tuo <gengchen.tuo@ibm.com>
@pshipton
Copy link
Member

Reopen until we have the backport in 0.37

@pshipton pshipton reopened this Apr 12, 2023
pshipton pushed a commit to pshipton/openj9 that referenced this issue Apr 12, 2023
Fixes eclipse-openj9#17084

Signed-off-by: Gengchen Tuo <gengchen.tuo@ibm.com>
pshipton pushed a commit to pshipton/openj9 that referenced this issue Apr 12, 2023
Fixes eclipse-openj9#17084

Signed-off-by: Gengchen Tuo <gengchen.tuo@ibm.com>
thallium added a commit to thallium/openj9 that referenced this issue Apr 12, 2023
Fixes eclipse-openj9#17084

Signed-off-by: Gengchen Tuo <gengchen.tuo@ibm.com>
mikezhang1234567890 pushed a commit to mikezhang1234567890/openj9 that referenced this issue Apr 17, 2023
Fixes eclipse-openj9#17084

Signed-off-by: Gengchen Tuo <gengchen.tuo@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants