Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/352.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
JavaFX应用程序在调用Stage.ShowAndWait()方法时导致Ubuntu 14.04上的Java VM崩溃,框架有问题:C[libc.so.6+;0x3c10d]_Java_Javafx_Jvm - Fatal编程技术网

JavaFX应用程序在调用Stage.ShowAndWait()方法时导致Ubuntu 14.04上的Java VM崩溃,框架有问题:C[libc.so.6+;0x3c10d]

JavaFX应用程序在调用Stage.ShowAndWait()方法时导致Ubuntu 14.04上的Java VM崩溃,框架有问题:C[libc.so.6+;0x3c10d],java,javafx,jvm,Java,Javafx,Jvm,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.su

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();
        }
    }

}
下面是一个完整的日志示例。 但是不同的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
或者像这样:

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应用程序运行很长时间之后。
环境是一样的:Ubuntu14.04和Java 1.8(Java HotSpot(TM)64位服务器VM(25.171-b11)用于linux-amd64 JRE(1.8.0_171-b11))

这是一个已知的错误,特定于linux:

不幸的是,还没有计划解决这个问题

我在RHEL6.5上也遇到过同样的问题,但在RHEL7.2和RHEL6.9上都没有遇到过。
要么它依赖于GNOME版本,要么我在其他平台上很幸运……

这仍然存在。受启发,使用
stage.show();stage.setOnHidden(e->{dosomething after stage is hidder.})
以避免此错误。