Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on new Mac OS and JRE install #441

Open
ffolkes opened this issue Dec 16, 2024 · 11 comments
Open

Crash on new Mac OS and JRE install #441

ffolkes opened this issue Dec 16, 2024 · 11 comments
Labels
bug something isn't working fixed issue has been fixed but may not be released yet. mac macOS specific issue

Comments

@ffolkes
Copy link

ffolkes commented Dec 16, 2024

Thank you for this amazing app! After reinstalling Mac OS with the latest version and installing a JRE, Strongbox is crashing at startup. I ran it via shell which shows this error:

java -jar /Applications/strongbox-7.5.0-standalone.jar 
02:06:38.349 [report] [app] refresh
02:06:38.871 [info] [app] loading 'short' catalogue.
02:06:39.004 [info] [app] 3608 addons in final catalogue.
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '0x0 is an invalid NSTrackingRectTag. Common possible reasons for this are: 1. already removed this trackingRectTag, 2. Truncated the NSTrackingRectTag to 32bit at some point.'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007ff8174ee326 __exceptionPreprocess + 242
	1   libobjc.A.dylib                     0x00007ff816fd3bd0 objc_exception_throw + 62
	2   Foundation                          0x00007ff818574a31 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 362
	3   AppKit                              0x00007ff81b6f8a52 -[_NSTrackingAreaAKViewHelper removeTrackingRect:] + 199
	4   libglass.dylib                      0x0000000127979449 Java_com_sun_glass_ui_mac_MacApplication__1getMacKey + 3593
	5   libglass.dylib                      0x000000012797e038 Java_com_sun_glass_ui_mac_MacApplication__1getMacKey + 23032
	6   AppKit                              0x00007ff81ae12723 -[NSView setFrame:] + 347
	7   libglass.dylib                      0x000000012797e095 Java_com_sun_glass_ui_mac_MacApplication__1getMacKey + 23125
	8   AppKit                              0x00007ff81ae2201b -[NSView resizeWithOldSuperviewSize:] + 816
	9   AppKit                              0x00007ff81ae2181c -[NSView resizeSubviewsWithOldSize:] + 499
	10  AppKit                              0x00007ff81ae02ee7 -[NSView setFrameSize:] + 1198
	11  AppKit                              0x00007ff81ae12723 -[NSView setFrame:] + 347
	12  AppKit                              0x00007ff81ae2201b -[NSView resizeWithOldSuperviewSize:] + 816
	13  AppKit                              0x00007ff81ae2181c -[NSView resizeSubviewsWithOldSize:] + 499
	14  AppKit                              0x00007ff81ae02ee7 -[NSView setFrameSize:] + 1198
	15  AppKit                              0x00007ff81ae20226 -[NSThemeFrame setFrameSize:] + 466
	16  AppKit                              0x00007ff81ae1f937 -[NSWindow _oldPlaceWindow:fromServer:] + 822
	17  AppKit                              0x00007ff81ae1e239 -[NSWindow _setFrameCommon:display:fromServer:] + 1899
	18  libglass.dylib                      0x000000012797127f getImage + 6799
	19  libglass.dylib                      0x0000000127970cec getImage + 5372
	20  libglass.dylib                      0x0000000127970f59 getImage + 5993
	21  libglass.dylib                      0x00000001279882ce Java_com_sun_glass_ui_mac_MacWindow__1setBounds2 + 446
	22  ???                                 0x0000000114a9d9c0 0x0 + 4641642944
)
libc++abi: terminating due to uncaught exception of type NSException
zsh: abort      java -jar /Applications/strongbox-7.5.0-standalone.jar
@ffolkes ffolkes added the bug something isn't working label Dec 16, 2024
@torkus
Copy link
Contributor

torkus commented Dec 16, 2024

hi there. Thank you for opening a ticket and for the kind words.

Let's start with the version of java installed:

java -version

For example, mine looks like:

$ java -version
openjdk version "11.0.24" 2024-07-16
OpenJDK Runtime Environment (build 11.0.24+8)
OpenJDK 64-Bit Server VM (build 11.0.24+8, mixed mode)

@ffolkes
Copy link
Author

ffolkes commented Dec 16, 2024

Here it is:

java -version
openjdk version "21.0.5" 2024-10-15 LTS
OpenJDK Runtime Environment Temurin-21.0.5+11 (build 21.0.5+11-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.5+11 (build 21.0.5+11-LTS, mixed mode)

@torkus
Copy link
Contributor

torkus commented Dec 16, 2024

Could be a bit too recent version, I've only tested against the 11 and 17 releases.

Are you able to downgrade to version 17 and try that?

Version 21 appears to be another LTS release so that will be supported, too, I just haven't tried it yet.

@ffolkes
Copy link
Author

ffolkes commented Dec 16, 2024

I tried with 17, but that doesn't seem to have helped.

java -jar /Applications/strongbox-7.5.0-standalone.jar 
12:49:59.890 [report] [app] refresh
12:49:59.943 [info] [app] loading 'short' catalogue.
12:50:00.075 [info] [app] 3608 addons in final catalogue.
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '0x0 is an invalid NSTrackingRectTag. Common possible reasons for this are: 1. already removed this trackingRectTag, 2. Truncated the NSTrackingRectTag to 32bit at some point.'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007ff8174ee326 __exceptionPreprocess + 242
	1   libobjc.A.dylib                     0x00007ff816fd3bd0 objc_exception_throw + 62
	2   Foundation                          0x00007ff818574a31 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 362
	3   AppKit                              0x00007ff81b6f8a52 -[_NSTrackingAreaAKViewHelper removeTrackingRect:] + 199
	4   libglass.dylib                      0x000000011063c449 Java_com_sun_glass_ui_mac_MacApplication__1getMacKey + 3593
	5   libglass.dylib                      0x0000000110641038 Java_com_sun_glass_ui_mac_MacApplication__1getMacKey + 23032
	6   AppKit                              0x00007ff81ae12723 -[NSView setFrame:] + 347
	7   libglass.dylib                      0x0000000110641095 Java_com_sun_glass_ui_mac_MacApplication__1getMacKey + 23125
	8   AppKit                              0x00007ff81ae2201b -[NSView resizeWithOldSuperviewSize:] + 816
	9   AppKit                              0x00007ff81ae2181c -[NSView resizeSubviewsWithOldSize:] + 499
	10  AppKit                              0x00007ff81ae02ee7 -[NSView setFrameSize:] + 1198
	11  AppKit                              0x00007ff81ae12723 -[NSView setFrame:] + 347
	12  AppKit                              0x00007ff81ae2201b -[NSView resizeWithOldSuperviewSize:] + 816
	13  AppKit                              0x00007ff81ae2181c -[NSView resizeSubviewsWithOldSize:] + 499
	14  AppKit                              0x00007ff81ae02ee7 -[NSView setFrameSize:] + 1198
	15  AppKit                              0x00007ff81ae20226 -[NSThemeFrame setFrameSize:] + 466
	16  AppKit                              0x00007ff81ae1f937 -[NSWindow _oldPlaceWindow:fromServer:] + 822
	17  AppKit                              0x00007ff81ae1e239 -[NSWindow _setFrameCommon:display:fromServer:] + 1899
	18  libglass.dylib                      0x000000011063427f getImage + 6799
	19  libglass.dylib                      0x0000000110633cec getImage + 5372
	20  libglass.dylib                      0x0000000110633f59 getImage + 5993
	21  libglass.dylib                      0x000000011064b2ce Java_com_sun_glass_ui_mac_MacWindow__1setBounds2 + 446
	22  ???                                 0x000000011e6ab5da 0x0 + 4805277146
	23  ???                                 0x000000011e6a745e 0x0 + 4805260382
	24  ???                                 0x000000011e6a745e 0x0 + 4805260382
	25  ???                                 0x000000011e6a745e 0x0 + 4805260382
	26  ???                                 0x000000011e6a78e4 0x0 + 4805261540
)
libc++abi: terminating due to uncaught exception of type NSException
zsh: abort      java -jar /Applications/strongbox-7.5.0-standalone.jar
matrix@Matrixs-MacBook-Pro ~ % java --version                                         
openjdk 17.0.13 2024-10-15
OpenJDK Runtime Environment Temurin-17.0.13+11 (build 17.0.13+11)
OpenJDK 64-Bit Server VM Temurin-17.0.13+11 (build 17.0.13+11, mixed mode)

@torkus
Copy link
Contributor

torkus commented Dec 17, 2024

Looks like this is a bug with versions of OpenJDK built on older versions of Xcode (or something):
https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8297131

Regardless of the version of Xcode / MacOSX SDK that JavaFX is built on, all JavaFX applications will start crashing when run on a JDK that is built with Xcode 14.1 + MacOSX SDK 13.

With lots of duplicate/related issues:
https://bugs.java.com/bugdatabase/view_bug?bug_id=8296654

The first link mentions a way to reproduce this using any old JDK version:

To reproduce this bug there are two approaches:

1. The obvious way: compile an OpenJDK from scratch on macOS Ventura.
2. The smart way: grab an existing JDK and use the 'vtool' command to edit the Mach-O version header that contains what SDK version the binary targets. This header is what controls the extra assertions.

How to do it with vtool:

cd $JAVA_HOME/bin
vtool -set-version-min macos 10.12 13 -output ./java ./java
codesign --remove-signature ./java

Now try running any JavaFX app and you'll get the following crash

I'll give that a shot on the weekend with my (ancient) mac. It might help me come up with a fix.

If there is information in those tickets that helps with your own debugging please let me know!

@ffolkes
Copy link
Author

ffolkes commented Dec 17, 2024

Thanks for looking into this! I'll let you know if I figure anything out.

I tried installing the (old) JRE Oracle suggests, but that brings up a different error:

java -version 
java version "1.8.0_431"
Java(TM) SE Runtime Environment (build 1.8.0_431-b10)

java -jar /Applications/strongbox-7.5.0-standalone.jar 
          strongbox.main.main              :     
                          ...                   
         strongbox.main/-main      main.clj:  176
         strongbox.main/-main      main.clj:  180
         strongbox.main/start      main.clj:   61
           strongbox.main/jfx      main.clj:   26
         clojure.core/require      core.clj: 6039
           clojure.core/apply      core.clj:  669
                          ...                   
       clojure.core/load-libs      core.clj: 6001
       clojure.core/load-libs      core.clj: 6017
           clojure.core/apply      core.clj:  669
                          ...                   
        clojure.core/load-lib      core.clj: 5954
        clojure.core/load-lib      core.clj: 5975
     clojure.core/load-lib/fn      core.clj: 5976
        clojure.core/load-one      core.clj: 5934
                          ...                   
            clojure.core/load      core.clj: 6145
            clojure.core/load      core.clj: 6161
         clojure.core/load/fn      core.clj: 6162
                          ...                   
      java.lang.Class.forName    Class.java:  348
     java.lang.Class.forName0    Class.java:     
 strongbox.jfx__init.<clinit>              :     
     strongbox.jfx__init.load              :    1
strongbox.jfx/loading--auto--       jfx.clj:    1
         clojure.core/require      core.clj: 6039
           clojure.core/apply      core.clj:  669
                          ...                   
       clojure.core/load-libs      core.clj: 6001
       clojure.core/load-libs      core.clj: 6017
           clojure.core/apply      core.clj:  669
                          ...                   
        clojure.core/load-lib      core.clj: 5954
        clojure.core/load-lib      core.clj: 5975
     clojure.core/load-lib/fn      core.clj: 5976
        clojure.core/load-one      core.clj: 5934
                          ...                   
            clojure.core/load      core.clj: 6145
            clojure.core/load      core.clj: 6161
         clojure.core/load/fn      core.clj: 6162
                          ...                   
      java.lang.Class.forName    Class.java:  348
     java.lang.Class.forName0    Class.java:     
     cljfx.api__init.<clinit>              :     
         cljfx.api__init.load              :   76
                 cljfx.api/fn       api.clj:   88
    cljfx.platform/initialize  platform.clj:   29
cljfx.jdk.platform/initialize  platform.clj:   12
java.lang.NoSuchMethodError: javafx.application.Platform.startup(Ljava/lang/Runnable;)V


13:08:47.948 [error] [app] unexpected error on thread main: javafx.application.Platform.startup(Ljava/lang/Runnable;)V
          strongbox.main.main              :     
                          ...                   
         strongbox.main/-main      main.clj:  176
         strongbox.main/-main      main.clj:  180
         strongbox.main/start      main.clj:   61
           strongbox.main/jfx      main.clj:   26
         clojure.core/require      core.clj: 6039
           clojure.core/apply      core.clj:  669
                          ...                   
       clojure.core/load-libs      core.clj: 6001
       clojure.core/load-libs      core.clj: 6017
           clojure.core/apply      core.clj:  669
                          ...                   
        clojure.core/load-lib      core.clj: 5954
        clojure.core/load-lib      core.clj: 5975
     clojure.core/load-lib/fn      core.clj: 5976
        clojure.core/load-one      core.clj: 5934
                          ...                   
            clojure.core/load      core.clj: 6145
            clojure.core/load      core.clj: 6161
         clojure.core/load/fn      core.clj: 6162
                          ...                   
      java.lang.Class.forName    Class.java:  348
     java.lang.Class.forName0    Class.java:     
 strongbox.jfx__init.<clinit>              :     
     strongbox.jfx__init.load              :    1
strongbox.jfx/loading--auto--       jfx.clj:    1
         clojure.core/require      core.clj: 6039
           clojure.core/apply      core.clj:  669
                          ...                   
       clojure.core/load-libs      core.clj: 6001
       clojure.core/load-libs      core.clj: 6017
           clojure.core/apply      core.clj:  669
                          ...                   
        clojure.core/load-lib      core.clj: 5954
        clojure.core/load-lib      core.clj: 5975
     clojure.core/load-lib/fn      core.clj: 5976
        clojure.core/load-one      core.clj: 5934
                          ...                   
            clojure.core/load      core.clj: 6145
            clojure.core/load      core.clj: 6161
         clojure.core/load/fn      core.clj: 6162
                          ...                   
      java.lang.Class.forName    Class.java:  348
     java.lang.Class.forName0    Class.java:     
     cljfx.api__init.<clinit>              :     
         cljfx.api__init.load              :   76
                 cljfx.api/fn       api.clj:   88
    cljfx.platform/initialize  platform.clj:   29
cljfx.jdk.platform/initialize  platform.clj:   12
java.lang.ExceptionInInitializerError: Exception java.lang.NoSuchMethodError: javafx.application.Platform.startup(Ljava/lang/Runnable;)V [in thread "main"]
       java.lang.NoClassDefFoundError: Could not initialize class strongbox.jfx__init


13:08:48.005 [error] [app] unexpected error on thread Thread-3: Could not initialize class strongbox.jfx__init

@torkus torkus added the mac macOS specific issue label Dec 20, 2024
@ffolkes
Copy link
Author

ffolkes commented Dec 22, 2024

Just wanted to let you know Strongbox seems to work when using "jdk-17.jdk" (in /Library/Java/JavaVirtualMachines/) from an old backup. Apparently that was what was being used before I had to reinstall MacOS last week. Any of the Temurin builds fail with the error above.

@torkus
Copy link
Contributor

torkus commented Dec 22, 2024

That's very interesting to know, thanks! Without a new mac this is difficult to fix.

@torkus
Copy link
Contributor

torkus commented Dec 28, 2024

Sorry for the delay in investigating this, I've been on holiday.

So, from the bug reports I linked above it seems the problem is the version of JavaFX Strongbox bundles in the standalone .jar file - it fails with:

reason: '0x0 is an invalid NSTrackingRectTag

on Macs using JDKs built using newer versions of XTools.

It looks like they patched and released this in newer versions of JavaFX 20, however Strongbox is using an older version of JavaFX 20 because, for some reason, they did an initial JavaFX 20 release (20-ea+1) that worked on JDK 11 but all subsequent updates require JDK 17+.

Screenshot at 2024-12-28 11-41-41

I have a PR to drop JDK11 support here (EOL 1+ year ago) and I've uploaded a build of strongbox using these updated versions of JavaFX:

https://ogri.la/static/strongbox/releases/branch--jdk-17/strongbox-7.6.0-unreleased-standalone.jar
https://ogri.la/static/strongbox/releases/branch--jdk-17/strongbox-7.6.0-unreleased-standalone.jar.sha256

If you could please:

  1. switch your JDK to 17
  2. download and run that .jar file and record any failures (or successes!)

and then

  1. switch back to the original JDK you were using (21.0.5)
  2. run that .jar file and record any failures (or successes!)

I'd be grateful.

@ffolkes
Copy link
Author

ffolkes commented Dec 29, 2024

Success! Thank you so much! It now works fine with 21.0.5. I also confirmed 7.5 still fails, so you definitely fixed it. :)

Thanks again for all your work on this project, and happy new year!

@torkus
Copy link
Contributor

torkus commented Dec 29, 2024

Ah, that's great news. Thanks for testing.

I'll do a proper release in the next or day two.

@torkus torkus added the fixed issue has been fixed but may not be released yet. label Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something isn't working fixed issue has been fixed but may not be released yet. mac macOS specific issue
Projects
None yet
Development

No branches or pull requests

2 participants