Closed chrisdembia closed 6 years ago
When the GUI hangs, this is the bottom of the log:
12:20:59 INFO: Starting IPC...
12:20:59 INFO: Starting IPC Server...
12:20:59 INFO: Starting socket server
12:20:59 INFO: Starting socket server at port 1101...
12:20:59 INFO: Starting IPC Process...
12:20:59 INFO: /var/folders/cw/sf048g251sn1pcsvvv9vj3tr0000gn/T/jxbrowser-chromium-49.0.2623.110.6.4/jxbrowser.app/Contents/MacOS/jxbrowser 1101 5824 --disable-remote-core-animation --disable-surfaces
The log in the NetBeans, when the app launches successfully, contains the following:
12:23:02 INFO: OS name: Mac OS X
12:23:02 INFO: JRE version: 1.8.0_45 64-bit
12:23:02 INFO: JxBrowser version: 6.4
12:23:02 INFO: The '/var/folders/cw/sf048g251sn1pcsvvv9vj3tr0000gn/T/jxbrowser-chromium-49.0.2623.110.6.4/jxbrowser.app' file doesn't exist.
12:23:02 INFO: Extracting Chromium binaries to '/var/folders/cw/sf048g251sn1pcsvvv9vj3tr0000gn/T/jxbrowser-chromium-49.0.2623.110.6.4'
12:23:02 INFO: The '/chromium-mac.zip' JAR resource URL is jar:file:/Users/chris/repos/opensim-gui/5/opensim-gui/Gui/opensim/build/cluster/modules/ext/jxbrowser-mac-6.4.jar!/chromium-mac.zip
[warn] kq_init: detected broken kqueue; not using.: Undefined error: 0
[warn] kq_init: detected broken kqueue; not using.: Undefined error: 0
[warn] kq_init: detected broken kqueue; not using.: Undefined error: 0
[warn] kq_init: detected broken kqueue; not using.: Undefined error: 0
[warn] kq_init: detected broken kqueue; not using.: Undefined error: 0
[warn] kq_init: detected broken kqueue; not using.: Undefined error: 0
12:23:03 INFO: Chromium binaries are extracted to '/var/folders/cw/sf048g251sn1pcsvvv9vj3tr0000gn/T/jxbrowser-chromium-49.0.2623.110.6.4'
12:23:03 INFO: Restore permissions for file: /var/folders/cw/sf048g251sn1pcsvvv9vj3tr0000gn/T/jxbrowser-chromium-49.0.2623.110.6.4/jxbrowser.app/Contents/MacOS/jxbrowser
12:23:03 INFO: Restore permissions for file: /var/folders/cw/sf048g251sn1pcsvvv9vj3tr0000gn/T/jxbrowser-chromium-49.0.2623.110.6.4/jxbrowser.app/Contents/Frameworks/jxbrowser-helper.app/Contents/MacOS/jxbrowser-helper
12:23:03 INFO: Restore permissions for file: /var/folders/cw/sf048g251sn1pcsvvv9vj3tr0000gn/T/jxbrowser-chromium-49.0.2623.110.6.4/jxbrowser.app/Contents/Frameworks/jxbrowser-helper NP.app/Contents/MacOS/jxbrowser-helper NP
12:23:03 INFO: Restore permissions for file: /var/folders/cw/sf048g251sn1pcsvvv9vj3tr0000gn/T/jxbrowser-chromium-49.0.2623.110.6.4/jxbrowser.app/Contents/Frameworks/jxbrowser-helper EH.app/Contents/MacOS/jxbrowser-helper EH
12:23:03 INFO: Starting IPC...
12:23:03 INFO: Starting IPC Server...
12:23:03 INFO: Starting socket server
12:23:04 INFO: Starting socket server at port 1101...
12:23:04 INFO: Starting IPC Process...
12:23:04 INFO: /var/folders/cw/sf048g251sn1pcsvvv9vj3tr0000gn/T/jxbrowser-chromium-49.0.2623.110.6.4/jxbrowser.app/Contents/MacOS/jxbrowser 1101 6096 --disable-remote-core-animation --disable-surfaces
The issue could be the setting of permissions (see here) or the difference between 6096
and 5824
.
Related: https://stackoverflow.com/questions/37795754/jxbrowser-doesnt-start. Browser functionality should be started in a non-UI thread; I don't know if this is relevant for us.
Deleting testuserdir
when running the GUI from NetBeans caused a launched GUI to stop hanging, and generated this log:
[0706/130059:INFO:main-delegate.cpp(65)] Executable name: /private/var/folders/cw/sf048g251sn1pcsvvv9vj3tr0000gn/T/jxbrowser-chromium-55.0.2883.87.6.14.2/jxbrowser-chromium.app/Contents/MacOS/jxbrowser-chromium
[0706/130059:INFO:main-delegate.cpp(73)] Frameworks path: /private/var/folders/cw/sf048g251sn1pcsvvv9vj3tr0000gn/T/jxbrowser-chromium-55.0.2883.87.6.14.2/jxbrowser-chromium.app/Contents/Frameworks
[0706/130059:INFO:main-delegate.cpp(65)] Executable name: /private/var/folders/cw/sf048g251sn1pcsvvv9vj3tr0000gn/T/jxbrowser-chromium-55.0.2883.87.6.14.2/jxbrowser-chromium.app/Contents/MacOS/jxbrowser-chromium
[0706/130059:INFO:main-delegate.cpp(73)] Frameworks path: /private/var/folders/cw/sf048g251sn1pcsvvv9vj3tr0000gn/T/jxbrowser-chromium-55.0.2883.87.6.14.2/jxbrowser-chromium.app/Contents/Frameworks
[0706/130059:INFO:main-delegate.cpp(65)] Executable name: /private/var/folders/cw/sf048g251sn1pcsvvv9vj3tr0000gn/T/jxbrowser-chromium-55.0.2883.87.6.14.2/jxbrowser-chromium.app/Contents/MacOS/jxbrowser-chromium
[0706/130059:INFO:main-delegate.cpp(73)] Frameworks path: /private/var/folders/cw/sf048g251sn1pcsvvv9vj3tr0000gn/T/jxbrowser-chromium-55.0.2883.87.6.14.2/jxbrowser-chromium.app/Contents/Frameworks
[0706/130059:INFO:main-delegate.cpp(65)] Executable name: /private/var/folders/cw/sf048g251sn1pcsvvv9vj3tr0000gn/T/jxbrowser-chromium-55.0.2883.87.6.14.2/jxbrowser-chromium.app/Contents/Frameworks/jxbrowser-chromium-helper.app/Contents/MacOS/jxbrowser-chromium-helper
[0706/130059:INFO:main-delegate.cpp(80)] Frameworks path: /private/var/folders/cw/sf048g251sn1pcsvvv9vj3tr0000gn/T/jxbrowser-chromium-55.0.2883.87.6.14.2/jxbrowser-chromium.app/Contents/Frameworks
[0706/130059:INFO:main-delegate.cpp(65)] Executable name: /private/var/folders/cw/sf048g251sn1pcsvvv9vj3tr0000gn/T/jxbrowser-chromium-55.0.2883.87.6.14.2/jxbrowser-chromium.app/Contents/Frameworks/jxbrowser-chromium-helper.app/Contents/MacOS/jxbrowser-chromium-helper
[0706/130059:INFO:main-delegate.cpp(80)] Frameworks path: /private/var/folders/cw/sf048g251sn1pcsvvv9vj3tr0000gn/T/jxbrowser-chromium-55.0.2883.87.6.14.2/jxbrowser-chromium.app/Contents/Frameworks
[0706/130059:INFO:main-delegate.cpp(65)] Executable name: /private/var/folders/cw/sf048g251sn1pcsvvv9vj3tr0000gn/T/jxbrowser-chromium-55.0.2883.87.6.14.2/jxbrowser-chromium.app/Contents/Frameworks/jxbrowser-chromium-helper.app/Contents/MacOS/jxbrowser-chromium-helper
[0706/130059:INFO:main-delegate.cpp(80)] Frameworks path: /private/var/folders/cw/sf048g251sn1pcsvvv9vj3tr0000gn/T/jxbrowser-chromium-55.0.2883.87.6.14.2/jxbrowser-chromium.app/Contents/Frameworks
Loading plugins from directory /Users/chris/repos/opensim-gui/6/opensim-gui/Gui/opensim/plugins
INFO [org.netbeans.core.windows.persistence]: [PersistenceManager.getTopComponentForID] Problem when deserializing TopComponent for tcID:'jxBrowserTopComponent'. Reason: null
Content:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE settings PUBLIC "-//NetBeans//DTD Session settings 1.0//EN" "http://www.netbeans.org/dtds/sessionsettings-1_0.dtd">
<settings version="1.0">
<instance class="org.opensim.javabrowser.jxBrowserTopComponent"/>
</settings>
Class: class org.opensim.javabrowser.jxBrowserTopComponent
Source: MultiFileObject@d74f3f9[Windows2Local/Components/jxBrowserTopComponent.settings]
Content:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE settings PUBLIC "-//NetBeans//DTD Session settings 1.0//EN" "http://www.netbeans.org/dtds/sessionsettings-1_0.dtd">
<settings version="1.0">
<instance class="org.opensim.javabrowser.jxBrowserTopComponent"/>
</settings>
Class: class org.opensim.javabrowser.jxBrowserTopComponent
Source: MultiFileObject@d74f3f9[Windows2Local/Components/jxBrowserTopComponent.settings]
Caused: com.teamdev.jxbrowser.chromium.internal.ipc.IPCException: Failed to initialize IPC. Remote process doesn't respond.
at com.teamdev.jxbrowser.chromium.internal.ipc.IPC.a(SourceFile:175)
at com.teamdev.jxbrowser.chromium.internal.ipc.IPC.start(SourceFile:144)
at com.teamdev.jxbrowser.chromium.Browser.<init>(SourceFile:384)
at com.teamdev.jxbrowser.chromium.Browser.<init>(SourceFile:337)
at com.teamdev.jxbrowser.chromium.Browser.<init>(SourceFile:317)
at org.opensim.javabrowser.jxBrowserTopComponent.<init>(jxBrowserTopComponent.java:55)
Caused: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.netbeans.modules.settings.convertors.XMLSettingsSupport.newInstance(XMLSettingsSupport.java:100)
at org.netbeans.modules.settings.convertors.XMLSettingsSupport$SettingsRecognizer.instanceCreate(XMLSettingsSupport.java:628)
Caused: java.io.IOException
at org.netbeans.modules.settings.convertors.XMLSettingsSupport$SettingsRecognizer.instanceCreate(XMLSettingsSupport.java:630)
at org.netbeans.modules.settings.convertors.SerialDataConvertor$SettingsInstance.instanceCreate(SerialDataConvertor.java:426)
[catch] at org.netbeans.core.windows.persistence.PersistenceManager.getTopComponentPersistentForID(PersistenceManager.java:571)
at org.netbeans.core.windows.persistence.PersistenceManager.getTopComponentForID(PersistenceManager.java:681)
at org.netbeans.core.windows.PersistenceHandler.getTopComponentForID(PersistenceHandler.java:478)
at org.netbeans.core.windows.LazyLoader.loadNow(LazyLoader.java:158)
at org.netbeans.core.windows.LazyLoader.access$400(LazyLoader.java:62)
at org.netbeans.core.windows.LazyLoader$2.run(LazyLoader.java:129)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Content:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE settings PUBLIC "-//NetBeans//DTD Session settings 1.0//EN" "http://www.netbeans.org/dtds/sessionsettings-1_0.dtd">
<settings version="1.0">
<instance class="org.opensim.javabrowser.jxBrowserTopComponent"/>
</settings>
ALL [null]: Class: class org.opensim.javabrowser.jxBrowserTopComponent
ALL [null]: Source: MultiFileObject@d74f3f9[Windows2Local/Components/jxBrowserTopComponent.settings]
WARNING [org.openide.filesystems.Ordering]: Not all children in Menu/Window/ marked with the position attribute: [org-netbeans-core-windows-actions-GlobalPropertiesAction.shadow, org-opensim-console-ScriptingShellTopComponent.shadow, org-opensim-coordinateviewer-CoordinateViewerAction.shadow, org-opensim-graphlEditor-topologyEditorTopComponent.shadow, org-opensim-javabrowser-jxBrowserTopComponent.shadow, org-opensim-logger-LoggerAction.shadow], but some are: [org-opensim-view-ExplorerAction.instance, org-opensim-view-actions-ViewAddNewAction.shadow, org-opensim-threejs-VisualizerWindow.shadow, ConfigureWindow]
WARNING [org.openide.filesystems.Ordering]: Found same position 500 for both Menu/Help/Separator1.instance and Menu/Help/org-opensim-plotter-separatorBefore.instance
However, the jxBrowser did not launch.
The specific folder that, when deleted, causes the hang is ~/Library/Application Support/OpenSim/4.0.Beta/config/Windows2Local/Modes
.
After I delete all the *.wsmodes
files in Modes
, I can start the GUI about 3 times, after which the GUI will hang.
I wonder if this is related to the need to start JxBrowser in a non-UI thread when using JavaFX (https://jxbrowser.support.teamdev.com/support/solutions/articles/9000013071-using-jxbrowser-in-javafx, https://www.teamdev.com/downloads/jxbrowser/javadoc/com/teamdev/jxbrowser/chromium/BrowserCore.html).
Sometimes, adding <active-tc id="jxBrowserTopComponent" />
to ~/Library/Application Support/OpenSim/4.0.Beta/config/Windows2Local/Modes/editor.wsmode
causes the GUI to no longer hang the next time it's loaded. Removing this line from editor.wsmode
can cause the GUI to hang (the next time it's loaded).
This page looks promising: https://stackoverflow.com/questions/41557279/jxbrowser-java-ipc-external-true-vm-argument
By default, on macOS JxBrowser initializes Chromium engine in Java process. It's required to support heavyweight rendering mode when Chromium window is embedded into Java frame. In macOS native window from one process (Chromium) cannot be embedded into a native window from another process (Java). Initializing Chromium in Java process might cause deadlock issues on macOS. It's because SWT, JavaFX, and Chromium share the same Cocoa native thread in Java process. The java.ipc.external=true VM option tells JxBrowser to initialize and run Chromium engine in separate native process. In this case Java and Chromium don't share Cocoa native thread. It allows solving deadlock issues on macOS platform. As you may see, in this case heavyweight rendering mode cannot be used. So, in this case only lightweight rendering mode is used. This is the only downside of using this VM option.
For some reason, the mac build I made earlier this week does not have this issue.
I edited the installer to contain a postinstall script that writes the necessary file to the Application Support directory (on this branch: submodules_refine_mac_packaging_isb_beta_20170705). Though my recent testing on a fresh mac VM indicates that this postinstall script is not necessary for the first launch of the GUI to succeed.
The recent changes @aymanhab made to when the visualizer server is launched does not fix this issue. However, changing jxBrowserTopComponent.java:30 from
@TopComponent.Registration(mode = "editor", openAtStartup = true)
to
@TopComponent.Registration(mode = "editor", openAtStartup = false)
seems to fix the issue / deadlock.
Is there a way to delay loading of the visualizer component until the model is done loading?
I am running into the situation very frequently where the GUI, on macs, will freeze right after launching. The beachball appears, and the lower status bar of the GUI never appears.
The crash sometimes happens when launching the GUI from NetBeans, but not regularly.
I am able to cause the crash by deleting the "userdir" (either
Gui/opensim/build/testuserdir
or~/Library/Application Support/OpenSim
) and then launching the GUI.My sense is that it has something to do with jxbrowser.
Here's a stack trace obtained with
jstack
while the GUI is hanging: