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

JVM crash due to inconsistent stackmap frames #443

Open
mipastgt opened this issue Oct 18, 2024 · 2 comments
Open

JVM crash due to inconsistent stackmap frames #443

mipastgt opened this issue Oct 18, 2024 · 2 comments

Comments

@mipastgt
Copy link

I am currently suffering from a JVM crash in production code. In general my Compose desktop app works fine until I perform a specific action. Then I get the following error:

Inconsistent stackmap frames at branch target 1938
Exception Details:
  Location:
    net/sf/geographiclib/Geodesic.InverseInt(DDDDI)Lnet/sf/geographiclib/Geodesic$InverseData; @1938: iconst_0
  Reason:
    Type top (current frame, locals[67]) is not assignable to double (stack map, locals[67])
...

The problem only occurs when I create a release build of the app where ProGuards gets activated and not when I just run it in the IDE. It happens on both Mac and Windows (haven’t tested Linux). The relevant code where the crash happens is from a numerical Java library which I have converted to Kotlin but I doubt that anything is wrong with the code because it works perfectly from the IDE. It’s just pure Kotlin number-crunshing.

I tried to create a simple reproducer for this problem but that did not work. So, I can only
provide the crash.log as an attachement.

I am wondering why this happens although I have switched off ProGuard optimizations.

buildTypes.release {
    proguard {
        version.set("7.6.0")
        isEnabled.set(true)
        optimize.set(false)
        obfuscate.set(false)
        configurationFiles.from(project.file("compose-desktop.pro"))
    }
}

See also: https://kotlinlang.slack.com/archives/C01D6HTPATV/p1728663588032589

crash.log.zip
Geodesic.kt.zip

@mrjameshamilton
Copy link
Contributor

Hi @mipastgt !

Could you provide the net/sf/geographiclib/Geodesic.class file before and after ProGuard?

As a workaround, you can try adding a keep rule for the specific method / class e.g. it looks like this is the problem method from the stacktrace:

-keep class net.sf.geographiclib.Geodesic {
    net.sf.geographiclib.Geodesic$InverseData InverseInt(double,double,double,double,int);
}

@mipastgt
Copy link
Author

mipastgt commented Oct 18, 2024

Hi @mrjameshamilton

I have created two builds. One with PG disabled (No-PG) and one with PG enabled but optimizations switched off (PG-keep). For that build I also added the keep rule which I generalized to all classes because due to some refactorings in that code I wasn't sure whether just one class would catch it all. See details in the attached ZIP file. The first build works without error and the second one crashes as before. See AIPBrowserDE.log. The ZIP file also contains the processed JAR file of the geographic library. I hope that helps.

ReportAttachements.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants