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

[ARM] OpenJDK throws java.lang.StackOverflowError #7214

Closed
ghost opened this issue Jul 30, 2021 · 18 comments
Closed

[ARM] OpenJDK throws java.lang.StackOverflowError #7214

ghost opened this issue Jul 30, 2021 · 18 comments
Labels
arch-arm Issue reproducible on packages compiled for ARM. bug report Something is not working properly. help wanted Help is wanted in order to solve the issue.

Comments

@ghost
Copy link

ghost commented Jul 30, 2021

Problem description

Package openjdk-17 doesn't work on ARM (32 bit) devices. All tools crash with java.lang.StackOverflowError. This issue does not affect AArch64 and x86_64 devices, i686 has another bug.

Screenshot_20210730-062447

Same issue affects https://github.com/PojavLauncherTeam/android-openjdk-build-multiarch/tree/buildjre16 on which the current build is based.

Additional information

Application version:
0.117
Packages CPU architecture:
arm
Subscribed repositories:
# sources.list
deb https://packages.termux.org/apt/termux-main/ stable main
# game-repo (sources.list.d/game.list)
deb https://packages.termux.org/apt/termux-games games stable
# science-repo (sources.list.d/science.list)
deb https://packages.termux.org/apt/termux-science science stable
Updatable packages:
All packages up to date
Android version:
7.1.2
Kernel build information:
Linux localhost 3.1.10-nougat-gd41f42062c6 #1 SMP PREEMPT Sat Mar 13 20:15:57 UTC 2021 armv7l Android
Device manufacturer:
Asus
Device model:
Nexus 7 3G
@ghost ghost added bug report Something is not working properly. help wanted Help is wanted in order to solve the issue. arch-arm Issue reproducible on packages compiled for ARM. labels Jul 30, 2021
@Mhowser
Copy link

Mhowser commented Jul 30, 2021

I can confirm I have the same problem.
Edit: used termux-info to generate the following information:

Application version:
0.117
Packages CPU architecture:
arm
Subscribed repositories:
# sources.list
deb https://packages.termux.org/apt/termux-main/ stable main
# game-repo (sources.list.d/game.list)
deb https://packages.termux.org/apt/termux-games games stable
# science-repo (sources.list.d/science.list)
deb https://packages.termux.org/apt/termux-science science stable
# x11-repo (sources.list.d/x11.list)
deb https://packages.termux.org/apt/termux-x11 x11 main
Updatable packages:
All packages up to date
Android version:
10
Kernel build information:
Linux localhost 4.9.206-perf+ #1 SMP PREEMPT Wed Jun 9 05:43:55 CDT 2021 armv7l Android
Device manufacturer:
motorola
Device model:
moto e

@ghost
Copy link

ghost commented Aug 2, 2021

Same here with me. 😔

@ghost ghost mentioned this issue Aug 3, 2021
@ghost
Copy link

ghost commented Aug 4, 2021

Problem description

Package openjdk-17 doesn't work on ARM (32 bit) devices. All tools crash with java.lang.StackOverflowError. This issue does not affect AArch64 and x86_64 devices, i686 has another bug.

Screenshot_20210730-062447

Same issue affects https://github.com/PojavLauncherTeam/android-openjdk-build-multiarch/tree/buildjre16 on which the current build is based.

Additional information

Application version:
0.117
Packages CPU architecture:
arm
Subscribed repositories:
# sources.list
deb https://packages.termux.org/apt/termux-main/ stable main
# game-repo (sources.list.d/game.list)
deb https://packages.termux.org/apt/termux-games games stable
# science-repo (sources.list.d/science.list)
deb https://packages.termux.org/apt/termux-science science stable
Updatable packages:
All packages up to date
Android version:
7.1.2
Kernel build information:
Linux localhost 3.1.10-nougat-gd41f42062c6 #1 SMP PREEMPT Sat Mar 13 20:15:57 UTC 2021 armv7l Android
Device manufacturer:
Asus
Device model:
Nexus 7 3G

How do you generate these device info?

@ghost
Copy link
Author

ghost commented Aug 4, 2021

termux-info

@Mhowser
Copy link

Mhowser commented Aug 4, 2021

I updated my previous comment to use termux-info

@giuliolunati
Copy link

I confirm the bug.
It's blocking my work, I need a working Java....
Any alternatives?

Application version:
0.108
Packages CPU architecture:
arm
Subscribed repositories:
# sources.list
deb https://deb.kcubeterm.me/termux-main/ stable main
# game-repo (sources.list.d/game.list)
deb https://packages.termux.org/apt/termux-games games stable
# science-repo (sources.list.d/science.list)
deb https://packages.termux.org/apt/termux-science science stable
# unstable-repo (sources.list.d/unstable.list)
deb https://packages.termux.org/apt/termux-unstable unstable main
# root-repo (sources.list.d/root.list)
deb https://packages.termux.org/apt/termux-root root stable
# x11-repo (sources.list.d/x11.list)
deb https://packages.termux.org/apt/termux-x11 x11 main
Updatable packages:
All packages up to date
Android version:
10
Kernel build information:
Linux localhost 3.4.113-lineageos-g36dddde #1 SMP PREEMPT Sun Nov 29 07:32:59 UTC 2020 armv7l Android
Device manufacturer:
samsung
Device model:
SM-G900F

@ghost
Copy link
Author

ghost commented Aug 10, 2021

Alternatives currently ecj + dx packages, for compiling .java sources into .dex and then running with dalvikvm.

@giuliolunati
Copy link

@xeffyr thanks for the tip!
Unfortunately doesn't work for me.

  1. I need apksigner in Termux, but it depends on openjdk-17.
  2. I also tried https://github.com/fornwall/apksigner
    2a) I compiled it on my Linux desktop, then copied the jar in Termux... but obviously can't run it because java is broken
    2b) I tried to convert the jar to dex, but it complains because the jar is java 1.8, while dx wants 1.7
    2c) I wish to recompile the jar as 1.7, but I don't know how to do.

@ghost
Copy link
Author

ghost commented Aug 10, 2021

Try this http://termux.net/dists/stable/main/binary-all/apksigner_0.7-2_all.deb, it's from old Termux.

@giuliolunati
Copy link

@xeffyr Thank you very much!
It only admits keystores generated by itself,
but that's good enough for me :-)

@abdogamerpro
Copy link

@xeffyr
There is any solution for javac and d8 , because I have same problem

@ghost
Copy link

ghost commented Aug 11, 2021

@xeffyr why didn't you add OpenJDK-11 as a package before jumping to OpenJDK-17? 😬

@ghost
Copy link
Author

ghost commented Aug 11, 2021

There is any solution for javac and d8

The only solutions I can suggest are:

  • Prooted environment with JDK
  • ecj + dx

Otherwise notice that issue has this tag:
1~2

why didn't you add OpenJDK-11 as a package before jumping to OpenJDK-17

Because this is literally a copy of https://github.com/PojavLauncherTeam/android-openjdk-build-multiarch. Using what is available and known to build with no issues.

I has been notified about issues on ARM too late, when package has been already added.

@Yisus7u7
Copy link
Contributor

Yisus7u7 commented Aug 23, 2021

@xeffyr And if you try compiling and using an older version of java for arm32?, try using the previous commits of Pojav Launcher.

@w4123
Copy link
Contributor

w4123 commented Aug 25, 2021

Here is a possibility but I haven't tested this yet.

Currently, on ARM, OpenJDK uses explicit register variable to retrieve the value of sp as the current stack location, which is used to detect stack overflow, see https://github.com/termux/openjdk-mobile-termux/blob/master/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp#L87

However, it seems that this feature is not supported by clang. see https://stackoverflow.com/questions/55648274/why-does-clang-behave-weirdly-with-register-variables-compared-to-gcc Thus this may cause wrong stack size detection, leading to a wrong StackOverFlowError.

On bsd aarch64, special code is written for clang in this function, see https://github.com/termux/openjdk-mobile-termux/blob/master/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp#L103

Maybe should change the function in linux_arm and test if it might work.

@w4123
Copy link
Contributor

w4123 commented Aug 25, 2021

Tested and it's now working. PR termux/openjdk-mobile-termux#2

@Grimler91
Copy link
Member

@w4123 Amazing work with investigating both of these java issues!

@ghost ghost closed this as completed in 08b1ffd Aug 25, 2021
@giuliolunati
Copy link

giuliolunati commented Aug 25, 2021 via email

Grimler91 pushed a commit that referenced this issue Aug 27, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-arm Issue reproducible on packages compiled for ARM. bug report Something is not working properly. help wanted Help is wanted in order to solve the issue.
Projects
None yet
Development

No branches or pull requests

6 participants