JDKMissionControl / jmc

This mirror is deprecated - please start using https://github.com/openjdk/jmc
197 stars 46 forks source link

Crash on Environment Processes of the PID running JMC itself #1

Open vorburger opened 6 years ago

vorburger commented 6 years ago

Using the JMC 7.0.0 Early-Access Build 03 (2018/8/14) from http://jdk.java.net/jmc/, when I create a JFR of a jdk1.8.0_181_ORACLE-server-jre JVM (see https://wiki.opendaylight.org/view/HowToProfilePerformance), and then open that in a JMC running on JDK 11 Early-Access Build 28 (2018/8/23) from http://jdk.java.net/11/, and then in the UI in Environment > Processes click on the line with the PID of the jdk-11 of the running JMC itself (only; clicking on all other processes works fine), then JMC hard crashes and exits, with that (Eclipse) pop-up saying "JVM terminated. Exit code=1" and the console showing this (not sure how relevant that is, but these messages are not shown on a normal orderly exit):

Gdk-Message: 13:57:45.416: Error 71 (Protocol error) dispatching to Wayland display.
Gtk-Message: 13:57:45.560: GtkDialog mapped without a transient parent. This is discouraged.

@thegreystone let me know if any additional information would be useful.

vorburger commented 6 years ago

This is using Fedora 28 with Wayland (which may be related, given above).

thegreystone commented 6 years ago

I see. Could you please try running Eclipse Photon with the same setup?

vorburger commented 6 years ago

I am running Eclipse 4.8 and it generally works OK on Wayland, but I don't run that on a JDK 11 EA, but an OpenJDK 8 from Fedora. JMC's UI seems to generally work just fine (as far as I can tell from briefly playing around). Just that particular combination causes that exit. Only clicking on the line with the PID of the jdk-11 of the running JMC itself (only; clicking on all other processes works fine). @thegreystone says that "It’s not like we’re doing anything magical just when you click a process.", I suspect something in that particular process' line is doing something which doesn't work on SWT on Wayland; I'd agree with you that this smells more like an SWT bug than a JMC problem. May be it's not because it's a PID from a jdk-11, but just because it's longer text, or something like that. Weird.

BTW don't see a dump file, but I'm not 100% sure this is a real JVM "crash" ? When that that (Eclipse) pop-up saying "JVM terminated. Exit code=1" comes up and on the Terminal console it's launched from there isn't the usual dump, that's not a "crash", but an "exit" - see that Error 71 (Protocol error) line above.

I'll reach out to someone I know internally who is on SWT. If he has time to further advise how to debug this from the SWT side for a possible fix, great. If not, forget about this.

ericwill commented 6 years ago

Can you try exporting GDK_BACKEND=x11 before running the application? If the issue doesn't reproduce there then it likely is a Wayland issue (though I'm not sure how that would crash the JVM).

vorburger commented 6 years ago

Can you try exporting GDK_BACKEND=x11 before running the application? If the issue doesn't reproduce there then it likely is a Wayland issue

@ericwill it does not happen when I launch JMC using GDK_BACKEND=x11 ./jmc, so yeah - Wayland issue.

(though I'm not sure how that would crash the JVM).

I'm not 100% what qualifies as a "JVM crash", but FYI re-read what I wrote above - there's no dump. (But, just FYI, I did get I dump file for a "real" crash for something else; when this SWT-based app, JMC, under an eariler Java 11 EA, due to https://bugs.openjdk.java.net/browse/JDK-8208676.)

@thegreystone says that "It’s not like we’re doing anything magical just when you click a process.", I suspect something in that particular process' line is doing something which doesn't work on SWT on Wayland

here's an interesting observation / idea: The "Command Line" which this UI displays is VERY (exceptionally) long for that single one line which causes this. All the others which work are much shorter. I don't actually have to even click on that entry in the list - the JVM also exits if I just hover over it. Here is this extremely long text, copied from the Properties view in that UI:

Field Value Verbose Value Command Line /home/vorburger/bin/jdk-11_openjdk-11+28/bin/java -XX:+IgnoreUnrecognizedVMOptions -XX:+UseG1GC -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:StartFlightRecording=name=JMC_Default,maxsize=100m -Djava.net.preferIPv4Stack=true -Djdk.attach.allowAttachSelf=true --add-exports=java.xml/com.sun.org.apache.xerces.internal.parsers=ALL-UNNAMED --add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED --add-exports=java.management/sun.management=ALL-UNNAMED --add-exports=java.management/sun.management.counter.perf=ALL-UNNAMED --add-exports=jdk.management.agent/jdk.internal.agent=ALL-UNNAMED --add-exports=jdk.attach/sun.tools.attach=ALL-UNNAMED --add-exports=java.desktop/sun.awt.windows=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=jdk.attach/sun.tools.attach=ALL-UNNAMED --add-exports=java.desktop/sun.awt.X11=ALL-UNNAMED -jar /home/vorburger/bin/jmc-7.0.0-ea+03_linux-x64_bin/bin//plugins/org.eclipse.equinox.launcher_1.5.0.v20180512-1130.jar -os linux -ws gtk -arch x86_64 -showsplash -launcher /home/vorburger/bin/jmc-7.0.0-ea+03_linux-x64_bin/bin/jmc -name Jmc --launcher.library /home/vorburger/bin/jmc-7.0.0-ea+03_linux-x64_bin/bin//plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.700.v20180518-1200/eclipse_1705.so -startup /home/vorburger/bin/jmc-7.0.0-ea+03_linux-x64_bin/bin//plugins/org.eclipse.equinox.launcher_1.5.0.v20180512-1130.jar --launcher.appendVmargs -exitdata a88008 -vm /home/vorburger/bin/jdk-11_openjdk-11+28/bin/java -vmargs -XX:+IgnoreUnrecognizedVMOptions -XX:+UseG1GC -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:StartFlightRecording=name=JMC_Default,maxsize=100m -Djava.net.preferIPv4Stack=true -Djdk.attach.allowAttachSelf=true --add-exports=java.xml/com.sun.org.apache.xerces.internal.parsers=ALL-UNNAMED --add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED --add-exports=java.management/sun.management=ALL-UNNAMED --add-exports=java.management/sun.management.counter.perf=ALL-UNNAMED --add-exports=jdk.management.agent/jdk.internal.agent=ALL-UNNAMED --add-exports=jdk.attach/sun.tools.attach=ALL-UNNAMED --add-exports=java.desktop/sun.awt.windows=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=jdk.attach/sun.tools.attach=ALL-UNNAMED --add-exports=java.desktop/sun.awt.X11=ALL-UNNAMED -jar /home/vorburger/bin/jmc-7.0.0-ea+03_linux-x64_bin/bin//plugins/org.eclipse.equinox.launcher_1.5.0.v20180512-1130.jar /home/vorburger/bin/jdk-11_openjdk-11+28/bin/java -XX:+IgnoreUnrecognizedVMOptions -XX:+UseG1GC -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:StartFlightRecording=name=JMC_Default,maxsize=100m -Djava.net.preferIPv4Stack=true -Djdk.attach.allowAttachSelf=true --add-exports=java.xml/com.sun.org.apache.xerces.internal.parsers=ALL-UNNAMED --add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED --add-exports=java.management/sun.management=ALL-UNNAMED --add-exports=java.management/sun.management.counter.perf=ALL-UNNAMED --add-exports=jdk.management.agent/jdk.internal.agent=ALL-UNNAMED --add-exports=jdk.attach/sun.tools.attach=ALL-UNNAMED --add-exports=java.desktop/sun.awt.windows=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=jdk.attach/sun.tools.attach=ALL-UNNAMED --add-exports=java.desktop/sun.awt.X11=ALL-UNNAMED -jar /home/vorburger/bin/jmc-7.0.0-ea+03_linux-x64_bin/bin//plugins/org.eclipse.equinox.launcher_1.5.0.v20180512-1130.jar -os linux -ws gtk -arch x86_64 -showsplash -launcher /home/vorburger/bin/jmc-7.0.0-ea+03_linux-x64_bin/bin/jmc -name Jmc --launcher.library /home/vorburger/bin/jmc-7.0.0-ea+03_linux-x64_bin/bin//plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.700.v20180518-1200/eclipse_1705.so -startup /home/vorburger/bin/jmc-7.0.0-ea+03_linux-x64_bin/bin//plugins/org.eclipse.equinox.launcher_1.5.0.v20180512-1130.jar --launcher.appendVmargs -exitdata a88008 -vm /home/vorburger/bin/jdk-11_openjdk-11+28/bin/java -vmargs -XX:+IgnoreUnrecognizedVMOptions -XX:+UseG1GC -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:StartFlightRecording=name=JMC_Default,maxsize=100m -Djava.net.preferIPv4Stack=true -Djdk.attach.allowAttachSelf=true --add-exports=java.xml/com.sun.org.apache.xerces.internal.parsers=ALL-UNNAMED --add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED --add-exports=java.management/sun.management=ALL-UNNAMED --add-exports=java.management/sun.management.counter.perf=ALL-UNNAMED --add-exports=jdk.management.agent/jdk.internal.agent=ALL-UNNAMED --add-exports=jdk.attach/sun.tools.attach=ALL-UNNAMED --add-exports=java.desktop/sun.awt.windows=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=jdk.attach/sun.tools.attach=ALL-UNNAMED --add-exports=java.desktop/sun.awt.X11=ALL-UNNAMED -jar /home/vorburger/bin/jmc-7.0.0-ea+03_linux-x64_bin/bin//plugins/org.eclipse.equinox.launcher_1.5.0.v20180512-1130.jar

So could be somehow related to a bug in SWT Wayland with very long hover text?

ericwill commented 6 years ago

Interesting, this definitely sounds SWT related. Please open a ticket against SWT at bugs.eclipse.org (it's under Eclipse -> Platform -> SWT), and add me (my github username @ redhat.com) on CC. Maybe even take a quick screencast of the issue so I can see which widget is causing the trouble. Thanks!

vorburger commented 6 years ago

@ericwill https://bugs.eclipse.org/bugs/show_bug.cgi?id=538545 - with screencast! :smile:

vorburger commented 6 years ago

@thegreystone FYI @ericwill on https://bugs.eclipse.org/bugs/show_bug.cgi?id=538545 states "the root cause of the issue here is a flawed UI design" and offers "a few suggestions" (not sure I agree; see discussion there - just wanted to FYI this here).

thegreystone commented 6 years ago

Hi there! Thanks!

Well, the whole point with tooltips is to quickly use more screen estate to show more information than can be shown in whatever control the user was hovering over. And to crash and burn is a pretty bad response to "you have more information than I can handle" from a framework. It should not be the responsibility of the JMC client to figure the limit for a certain platform, and then write platform specific code for that arbitrary limit. IMHO, the platform should show as much of it as it can, and then gracefully degrade. Not crash.

ericwill commented 6 years ago

@thegreystone I do agree that GTK should not be segfaulting, and I will raise that issue with them upstream. However from SWT's POV there isn't much we can do.

JFace TableViewer tooltips (the ones causing this crash) use CLabel, which is a cross-platform label widget. We can't insert text length checks in these because that code would affect Windows/Mac, meaning we would be introducing Linux specific behaviour into Windows/Mac functionality. Another issue is that this is a label widget, which could potentially have the use case for really long text (and shouldn't really be used as a tooltip, but that's not within your control).

IMO the best suggestion for you right now is to override the useNativeToolTip method, as this will give you true, 100% native tooltips that are not displayed in some emulated label widget.

A better, long-term solution is to re-think the use of tooltips for this case, as I don't think a 2000+ character tooltip is really useful to any user.