jaamsim / jaamsim

Master repository for Jaamsim source code
Apache License 2.0
155 stars 65 forks source link

Error running on MacOS #32

Open saem opened 1 year ago

saem commented 1 year ago

Built both master and the v2022-07-jogltest1 branches, and ran with the following command: java --add-exports java.desktop/sun.awt=ALL-UNNAMED -jar build/jars/JaamSim2022-07-jogltest1.jar

Got the following errors in the terminal:

2023-01-27 19:44:16.692 java[42476:728243] NSWindow does not support NSWindowCollectionBehaviorFullScreenPrimary for utility windows
2023-01-27 19:44:16.724 java[42476:728243] NSWindow does not support NSWindowCollectionBehaviorFullScreenPrimary for utility windows
2023-01-27 19:44:16.750 java[42476:728243] NSWindow does not support NSWindowCollectionBehaviorFullScreenPrimary for utility windows
2023-01-27 19:44:16.767 java[42476:728243] NSWindow does not support NSWindowCollectionBehaviorFullScreenPrimary for utility windows
com.jogamp.opengl.GLException: Thread[#36,RenderThread,5,main] glGetError() returned the following error codes after a call to glCreateShader(<int> 0x8B31): Unknown glGetError() return value: ( 1286 0x506), 
    at com.jogamp.opengl.DebugGL4bc.writeGLError(DebugGL4bc.java:31781)
    at com.jogamp.opengl.DebugGL4bc.glCreateShader(DebugGL4bc.java:3498)
    at com.jaamsim.render.Shader.<init>(Shader.java:46)
    at com.jaamsim.render.Renderer.createCoreShader(Renderer.java:675)
    at com.jaamsim.render.Renderer.initCoreShaders(Renderer.java:780)
    at com.jaamsim.render.Renderer.initSharedContext(Renderer.java:887)
    at com.jaamsim.render.Renderer.mainRenderLoop(Renderer.java:237)
    at com.jaamsim.render.Renderer.access$000(Renderer.java:91)
    at com.jaamsim.render.Renderer$1.run(Renderer.java:202)
    at java.base/java.lang.Thread.run(Thread.java:1589)

2023-01-27 19:44:18.190 java[42476:728243] NSWindow does not support NSWindowCollectionBehaviorFullScreenPrimary for utility windows

And the following error dialog text:

Thread[#36,RenderState,5,main] glGetError() returned the following error codes after a call to glCreateshader( 0x8B31): Unknown glGetError() return value: ( 1286, 0x506),

Note: I had to type the above by hand as I couldn't copy paste, and the message seems to be cut off.

hharrison commented 1 year ago

Thanks so much for testing, any chance you could try again with the update pushed to the jogl_update branch of the repo? Small additional debug patch included to try and track down the problem by printing on stdout.

hbjorkedal commented 6 months ago

Reopening this thread as it seems OP wont respond. I get the same error when running both the normal and the java --add-exports java.desktop/sun.awt=ALL-UNNAMED -jar JaamSim2023-07.jar command. Tried every version from 2023-06-macfix to the most recent 2024-02

java -jar JaamSim2023-07.jar 2024-02-23 12:38:24.913 java[41230:5646590] WARNING: Secure coding is automatically enabled for restorable state! However, not on all supported macOS versions of this application. Opt-in to secure coding explicitly by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState:. 2024-02-23 12:38:31.807 java[41230:5646590] NSWindow does not support NSWindowCollectionBehaviorFullScreenPrimary for utility windows 2024-02-23 12:38:31.817 java[41230:5646590] NSWindow does not support NSWindowCollectionBehaviorFullScreenPrimary for utility windows 2024-02-23 12:38:31.825 java[41230:5646590] NSWindow does not support NSWindowCollectionBehaviorFullScreenPrimary for utility windows 2024-02-23 12:38:31.855 java[41230:5646590] NSWindow does not support NSWindowCollectionBehaviorFullScreenPrimary for utility windows ^Cjava.lang.ThreadDeath at java.base/java.lang.Thread.stop(Thread.java:937) at com.jogamp.newt.opengl.GLWindow$GLLifecycleHook$1.run(GLWindow.java:762) at java.base/java.security.AccessController.doPrivileged(Native Method) at com.jogamp.common.util.SecurityUtil.doPrivileged(SecurityUtil.java:82) at com.jogamp.newt.opengl.GLWindow$GLLifecycleHook.shutdownRenderingAction(GLWindow.java:757) at jogamp.newt.WindowImpl.shutdown(WindowImpl.java:664) at jogamp.newt.WindowImpl.shutdownAll(WindowImpl.java:128) at jogamp.newt.DisplayImpl$1.run(DisplayImpl.java:77) at com.jogamp.nativewindow.NativeWindowFactory.shutdown(NativeWindowFactory.java:329) at com.jogamp.nativewindow.NativeWindowFactory$1$1.run(NativeWindowFactory.java:234) at java.base/java.lang.Thread.run(Thread.java:829)

java.lang.ThreadDeath at java.base/java.lang.Thread.stop(Thread.java:937) at com.jogamp.newt.opengl.GLWindow$GLLifecycleHook$1.run(GLWindow.java:762) at java.base/java.security.AccessController.doPrivileged(Native Method) at com.jogamp.common.util.SecurityUtil.doPrivileged(SecurityUtil.java:82) at com.jogamp.newt.opengl.GLWindow$GLLifecycleHook.shutdownRenderingAction(GLWindow.java:757) at jogamp.newt.WindowImpl.shutdown(WindowImpl.java:664) at jogamp.newt.WindowImpl.shutdownAll(WindowImpl.java:128) at jogamp.newt.DisplayImpl$1.run(DisplayImpl.java:77) at com.jogamp.nativewindow.NativeWindowFactory.shutdown(NativeWindowFactory.java:329) at com.jogamp.nativewindow.NativeWindowFactory$1$1.run(NativeWindowFactory.java:234) at java.base/java.lang.Thread.run(Thread.java:829)

hharrison commented 6 months ago

Hmmm, the updated JOGL version we pulled in for version 2023-07 generally solved these issues for other Mac users. I'm aware of the NSWindow warnings, but they shouldn't affect the software working as intended. Are you reporting this because of the exception backlog (our shutdown hooks in jaamsim are not the cleanest to be fair and sometimes generates this backtrace but shouldn't have any effect on the functionality) Or is there an actual problem using the software?

hbjorkedal commented 6 months ago

I cant use the software at all. No matter what I try the GUI stops responding after startup. Ive tried jpk 8, 11 and 21 with no success. Ive also tried it with both the commands listed on the download page. Below is a view of how it looks after startup. I can move the windows around, but the second my mouse overs the inside of the windows its starts a spinner on my mouse indicating its not responding. Skjermbilde 2024-02-23 kl  18 37 50

hharrison commented 6 months ago

OK, can you confirm which java version/distribution you're using and what version of MacOS, and I guess any details about what specific machine you have would also be helpful to start narrowing this down.

Harvey

hharrison commented 6 months ago

Complete shot in the dark, but could you add the following to the java commandline on startup, I've seen some other reports on Sonoma that have serious issues in their current releases:

-Dsun.java2d.metal=false -Dsun.java2d.opengl=true

hbjorkedal commented 6 months ago

I'm on a 2020 M1 Macbook Air running Sonoma 14.3.1. Ive tried using both homebrew and downloading directly from java.com. Currently I have Java 8 downloaded from java.com installed. java -jar -Dsun.java2d.metal=false -Dsun.java2d.opengl=true Jaamsim2024-02.jar running this still made no difference. Its still not responding directly after startup.

hbjorkedal commented 6 months ago

Got some more info that might help. Tried to run the dsun commands after the jaapsim.jar and jaapsim tried to load it as configs. Since I didn't have any file named it didn't open any and I got access to the log viewer displaying this: Skjermbilde 2024-02-23 kl  19 25 04 Looks like the initial startup causes no error. When I try to make a New file in the drop down menu it crashes again

hharrison commented 6 months ago

OK, the metal and opengl options are only for java 17 and above and I don't think exist in the java 8 vm. Just to confirm:

(from the logbook you sent it is a Metal backed open GL driver on your machine, which frankly is full of problems and of pretty terrible quality)

FAILS on Java 8 : java -jar JaamSim2024-02.jar

Please try (degrading to the safegraphics option which uses a very limited OpenGL subset) java -jar JaamSim2024-02.jar -sg

On Java 17 (or above), if you can try, would be helpful: java --add-exports java.desktop/sun.awt=ALL-UNNAMED -jar JaamSim2024-02.jar java -Dsun.java2d.metal=false --add-exports java.desktop/sun.awt=ALL-UNNAMED -jar JaamSim2024-02.jar java --add-exports java.desktop/sun.awt=ALL-UNNAMED -jar JaamSim2024-02.jar -sg

hbjorkedal commented 6 months ago

❯ java -Dsun.java2d.metal=false --add-exports java.desktop/sun.awt=ALL-UNNAMED -jar JaamSim2024-02.jar 2024-02-23 19:43:38.881 java[60253:5990569] WARNING: Secure coding is automatically enabled for restorable state! However, not on all supported macOS versions of this application. Opt-in to secure coding explicitly by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState:. 2024-02-23 19:43:43.691 java[60253:5990569] NSWindow does not support NSWindowCollectionBehaviorFullScreenPrimary for utility windows 2024-02-23 19:43:43.711 java[60253:5990569] NSWindow does not support NSWindowCollectionBehaviorFullScreenPrimary for utility windows 2024-02-23 19:43:43.721 java[60253:5990569] NSWindow does not support NSWindowCollectionBehaviorFullScreenPrimary for utility windows 2024-02-23 19:43:43.731 java[60253:5990569] NSWindow does not support NSWindowCollectionBehaviorFullScreenPrimary for utility windows

--add-exports java.desktop/sun.awt=ALL-UNNAMED -jar JaamSim2024-02.jar -sg 2024-02-23 19:44:47.412 java[60324:5991869] WARNING: Secure coding is automatically enabled for restorable state! However, not on all supported macOS versions of this application. Opt-in to secure coding explicitly by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState:. 2024-02-23 19:44:51.229 java[60324:5991869] NSWindow does not support NSWindowCollectionBehaviorFullScreenPrimary for utility windows 2024-02-23 19:44:51.240 java[60324:5991869] NSWindow does not support NSWindowCollectionBehaviorFullScreenPrimary for utility windows 2024-02-23 19:44:51.259 java[60324:5991869] NSWindow does not support NSWindowCollectionBehaviorFullScreenPrimary for utility windows 2024-02-23 19:44:51.274 java[60324:5991869] NSWindow does not support NSWindowCollectionBehaviorFullScreenPrimary for utility windows

Still no success. All of them with the same issue. (Upgraded to : openjdk version "21.0.2" 2024-01-16 OpenJDK Runtime Environment Homebrew (build 21.0.2) OpenJDK 64-Bit Server VM Homebrew (build 21.0.2, mixed mode, sharing))

hharrison commented 6 months ago

The warnings you have there are uninteresting.

When you run the above, essentially the program just freezes after startup? Or can't be interacted with? Or the 3d content window never appears? Can you be a bit more specific on what the problem actually is?

hharrison commented 6 months ago

The contents of the log viewer (if possible) from each of those tests would be interesting.

hbjorkedal commented 6 months ago

Yes, exactly. All of the commands above start the program but freezes on startup. So they all appear as the first screenshot I sent of the open program. But the GUI is not responding. Unfortunately, I cant get access to the logs either as the entire menu freezes as well. The rest of my Mac functions as normal.

hbjorkedal commented 6 months ago

The windows can be moved around though, just the content within that freezes up.

hharrison commented 6 months ago

It's going to be a bit difficult to diagnose further without more information, are you familiar at all with the visualvm or jstack tools that allow a dump of the threadstack to be captured? It appears my Mac pro x86-64 doesn't hit this issue and seems to work just fine.

Here's some high level instructions on how to capture a threadstack from a running java program, if you're able to capture the stack while the program is unresponsive that would really help tracking down the issue.

https://www.mastertheboss.com/java/how-to-capture-a-thread-dump-in-java/

hbjorkedal commented 6 months ago

[ threaddump.txt ]

Here you go!

hbmekki commented 3 weeks ago

I am having the same issue. Here error report. hs_err_pid62030.log