JavaFX 应用程序不时导致 Java VM 崩溃。 根据崩溃日志,Java 帧是不同的,但有问题的帧与"C [libc.so.6+0x3c10d]"相同
其中一个与我的应用程序 Java 代码相关,如下所示:
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j com.sun.glass.ui.gtk.GtkApplication.enterNestedEventLoopImpl()V+0
J 23330 C1 com.sun.glass.ui.gtk.GtkApplication._enterNestedEventLoop()Ljava/lang/Object; (63 bytes) @ 0x00007f98c4e114f4 [0x00007f98c4e11160+0x394]
J 23329 C1 com.sun.glass.ui.Application.enterNestedEventLoop()Ljava/lang/Object; (39 bytes) @ 0x00007f98c2855f14 [0x00007f98c2855da0+0x174]
J 23326 C1 com.sun.glass.ui.EventLoop.enter()Ljava/lang/Object; (260 bytes) @ 0x00007f98c4e08a24 [0x00007f98c4e08760+0x2c4]
J 22177 C1 com.sun.javafx.tk.quantum.QuantumToolkit.enterNestedEventLoop(Ljava/lang/Object;)Ljava/lang/Object; (124 bytes) @ 0x00007f98c4bc387c [0x00007f98c4bc2660+0x121c]
J 22176 C1 javafx.stage.Stage.showAndWait()V (98 bytes) @ 0x00007f98c4b44c2c [0x00007f98c4b442a0+0x98c]
j com.testin.itestin.manual.ui.TasksList.showDialog(Lcom/testin/itestin/manual/ui/Receiver;)V+138
j com.testin.itestin.manual.ui.TasksList$1.run()V+4
J 13612 C2 com.sun.javafx.application.PlatformImpl$$Lambda$53.run()Ljava/lang/Object; (8 bytes) @ 0x00007f98c3227228 [0x00007f98c32271e0+0x48]
v ~StubRoutines::call_stub
J 2098 java.security.AccessController.doPrivileged(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;)Ljava/lang/Object; (0 bytes) @ 0x00007f98c16aef33 [0x00007f98c16aeec0+0x73]
J 13517 C2 com.sun.javafx.application.PlatformImpl$$Lambda$51.run()V (12 bytes) @ 0x00007f98c2475904 [0x00007f98c2475860+0xa4]
J 8909 C2 com.sun.glass.ui.InvokeLaterDispatcher$Future.run()V (91 bytes) @ 0x00007f98c16bf72c [0x00007f98c16bf6e0+0x4c]
v ~StubRoutines::call_stub
j com.sun.glass.ui.gtk.GtkApplication._runLoop(Ljava/lang/Runnable;Z)V+0
j com.sun.glass.ui.gtk.GtkApplication.lambda$null$48(Ljava/lang/Runnable;Z)V+7
j com.sun.glass.ui.gtk.GtkApplication$$Lambda$41.run()V+12
j java.lang.Thread.run()V+11
v ~StubRoutines::call_stub
这似乎是在调用 Stage.ShowAndWait(( 方法时发生的。 以下是相关代码:
public static void showDialog(final Receiver receiver) {
String fxml = "/com/testin/itestin/manual/ui/TasksList.fxml";
FXMLLoader loader = new FXMLLoader();
InputStream in = TasksList.class.getResourceAsStream(fxml);
loader.setBuilderFactory(new JavaFXBuilderFactory());
loader.setLocation(TasksList.class.getResource(fxml));
BorderPane page;
try {
page = (BorderPane) loader.load(in);
Stage stage = new Stage();
stage.initModality(Modality.APPLICATION_MODAL);//APPLICATION_MODAL);
stage.initOwner(TestinStage.getPrimaryStage());
stage.initStyle(StageStyle.UNDECORATED);
stage.setResizable(false);
Scene scene = new Scene(page);
stage.setScene(scene);
TasksListController controller = (TasksListController) loader
.getController();
controller.setStage(stage);
ThreadPool.cachedThreadPoolExecute(() -> controller.refreshData(TaskService.getInstance()
.getNativeAdaptList()));
TasksHelper.setTaskListShown(true);
stage.showAndWait();
receiver.response = controller.getValue();
receiver.exit = true;
} catch (IOException e) {
Log.error("showDialog", e.toString());
} finally {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
下面是hs_err2986.log的完整日志示例。 但是有不同的 Java 框架的崩溃日志,
如:
Stack: [0x00007f9e120d8000,0x00007f9e121d9000], sp=0x00007f9e121d7660, free space=1021k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libc.so.6+0x3c10d]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j com.sun.glass.ui.gtk.GtkApplication._runLoop(Ljava/lang/Runnable;Z)V+0
j com.sun.glass.ui.gtk.GtkApplication.lambda$null$48(Ljava/lang/Runnable;Z)V+7
j com.sun.glass.ui.gtk.GtkApplication$$Lambda$41.run()V+12
j java.lang.Thread.run()V+11
v ~StubRoutines::call_stub
或者像这样:
Stack: [0x00007ff43c982000,0x00007ff43ca83000], sp=0x00007ff43ca81410, free space=1021k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libc.so.6+0x3c10d]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
J 6094 com.sun.prism.es2.GLContext.nClearBuffers(JFFFFZZZ)V (0 bytes) @ 0x00007ff44e186e9a [0x00007ff44e186e40+0x5a]
J 21673 C2 com.sun.javafx.tk.quantum.ViewPainter.paintImpl(Lcom/sun/prism/Graphics;)V (1457 bytes) @ 0x00007ff450842ee8 [0x00007ff450841d40+0x11a8]
J 21890 C2 com.sun.javafx.tk.quantum.PresentingPainter.run()V (675 bytes) @ 0x00007ff44d2b22c8 [0x00007ff44d2b2060+0x268]
J 20694 C2 com.sun.javafx.tk.RenderJob.run()V (105 bytes) @ 0x00007ff44f94358c [0x00007ff44f9434c0+0xcc]
J 21698% C2 java.util.concurrent.ThreadPoolExecutor.runWorker(Ljava/util/concurrent/ThreadPoolExecutor$Worker;)V (225 bytes) @ 0x00007ff44e675f1c [0x00007ff44e675d40+0x1dc]
j java.util.concurrent.ThreadPoolExecutor$Worker.run()V+5
j com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run()V+8
j java.lang.Thread.run()V+11
v ~StubRoutines::call_stub
或者像这样:
Stack: [0x00007f3748a60000,0x00007f3748b61000], sp=0x00007f3748b5f780, free space=1021k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libc.so.6+0x3c10d]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
J 6014 sun.awt.X11.XlibWrapper.XEventsQueued(JI)I (0 bytes) @ 0x00007f37c20ccad4 [0x00007f37c20cca80+0x54]
j sun.awt.X11.XToolkit.run(Z)V+63
j sun.awt.X11.XToolkit.run()V+5
j java.lang.Thread.run()V+11
v ~StubRoutines::call_stub
任何建议都非常感谢。
大多数崩溃发生在 JavaFX 应用程序长时间运行之后。 环境是相同的:Ubuntu 14.04 with Java 1.8,(Java HotSpot(TM( 64-Bit Server VM (25.171-b11( for linux-amd64 JRE (1.8.0_171-b11((
这是一个已知的错误,特定于Linux:https://bugs.openjdk.java.net/browse/JDK-8087368
不幸的是,它还没有计划解决。
我在 RHEL6.5 上遇到了同样的问题,但从未在 RHEL 7.2 上发生过,RHEL 6.9 也没有。 要么它依赖于 GNOME 版本,要么我在其他平台上很幸运......