netty: Throwing an exception in case glibc is missing instead of segfaulting the JVM
It seems Netty’s native support depends on glibc (btw is this documented?).
When glibc is missing (for example using vanilla Alpine), the JVM could end up with a crash (SIGSEGV), see details in this issue: https://github.com/micrometer-metrics/micrometer/issues/2776
It also seems that Epoll.isAvailable() returns true even if glibc is missing.
Expected behavior
Throwing an exception
Actual behavior
JVM crash
Steps to reproduce
Using Netty native with an environment that does not have glibc, e.g.: vanilla Alpine
Minimal yet complete reproducer code (or URL to code)
This seems to be a known issue, please let me know if you really need a reproducer.
Netty version
4.1.68 (latest)
JVM version (e.g. java -version)
Latest 11:
❯ docker run --rm 'azul/zulu-openjdk-alpine:11-jre' 'sh' '-c' 'java --version'
openjdk 11.0.12 2021-07-20 LTS
OpenJDK Runtime Environment Zulu11.50+19-CA (build 11.0.12+7-LTS)
OpenJDK 64-Bit Server VM Zulu11.50+19-CA (build 11.0.12+7-LTS, mixed mode)
Or also latest 17:
❯ docker run --rm 'bellsoft/liberica-openjdk-alpine-musl:17' 'sh' '-c' 'java --version'
openjdk 17 2021-09-14 LTS
OpenJDK Runtime Environment (build 17+35-LTS)
OpenJDK 64-Bit Server VM (build 17+35-LTS, mixed mode)
I assume this is an issue in every JRE that is currently supported.
OS version (e.g. uname -a)
Both images above have the same output:
❯ docker run --rm 'azul/zulu-openjdk-alpine:11-jre' 'sh' '-c' 'uname -a'
Linux 1ee8d1090f14 5.10.47-linuxkit #1 SMP Sat Jul 3 21:51:47 UTC 2021 x86_64 Linux
I assume this is an issue in every OS where glibc is missing.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 16 (12 by maintainers)
Commits related to this issue
- Update transport-native-epoll compile flags - Move libraries to LIBS where they should be, avoiding need for -Wl,--no-as-needed. - Use -O2 instead of -O3; there are no tight loops so -O3 just incre... — committed to Hello71/netty by Hello71 2 years ago
- Don't call strdup on packagePrefix. Improves musl compatibility and slightly improves efficiency. Requires https://github.com/netty/netty-jni-util/pull/8. Fixes #11701 properly. — committed to Hello71/netty by Hello71 2 years ago
- Don't call strdup on packagePrefix. Improves musl compatibility and slightly improves efficiency. Requires https://github.com/netty/netty-jni-util/pull/8. Fixes #11701. — committed to Hello71/netty by Hello71 2 years ago
- Don't call strdup on packagePrefix. Improves musl compatibility and slightly improves efficiency. Requires https://github.com/netty/netty-jni-util/pull/8. Together with netty-jni-util#8, fixes #117... — committed to Hello71/netty by Hello71 2 years ago
- Update transport-native-epoll compile flags - Move libraries to LIBS where they should be, avoiding need for -Wl,--no-as-needed. - Use -O2 instead of -O3; there are no tight loops so -O3 just incre... — committed to Hello71/netty by Hello71 2 years ago
- Update transport-native-epoll compile flags (#12272) Motivation: Loading of the native epoll transport might segfault the JVM if musl is used and no glibc-compat is installed: - Move librarie... — committed to netty/netty by Hello71 2 years ago
- Update transport-native-epoll compile flags (#12272) Motivation: Loading of the native epoll transport might segfault the JVM if musl is used and no glibc-compat is installed: Modifications: - Mov... — committed to netty/netty by Hello71 2 years ago
- Update transport-native-epoll compile flags (#12272) (#12313) Motivation: Loading of the native epoll transport might segfault the JVM if musl is used and no glibc-compat is installed: Modifica... — committed to netty/netty by normanmaurer 2 years ago
- Don't call strdup on packagePrefix. Improves musl compatibility and slightly improves efficiency. Requires https://github.com/netty/netty-jni-util/pull/8. Together with netty-jni-util#8, fixes #117... — committed to Hello71/netty by Hello71 2 years ago
- Don't call strdup on packagePrefix. (#12273) Motivation: We should improve must compat by not calling strdup. Motifications: - Update jni-util version and update code for changes - Adjust C... — committed to netty/netty by Hello71 2 years ago
- Don't call strdup on packagePrefix. (#12273) Motivation: We should improve must compat by not calling strdup. Motifications: - Update jni-util version and update code for changes - Adjust CFLAGS ... — committed to netty/netty by Hello71 2 years ago
- Don't call strdup on packagePrefix. (#12273) (#12322) Motivation: We should improve must compat by not calling strdup. Motifications: - Update jni-util version and update code for changes -... — committed to netty/netty by normanmaurer 2 years ago
- Update transport-native-epoll compile flags (#12272) (#12313) Motivation: Loading of the native epoll transport might segfault the JVM if musl is used and no glibc-compat is installed: Modifica... — committed to raidyue/netty by normanmaurer 2 years ago
- Don't call strdup on packagePrefix. (#12273) (#12322) Motivation: We should improve must compat by not calling strdup. Motifications: - Update jni-util version and update code for changes -... — committed to raidyue/netty by normanmaurer 2 years ago
- Update transport-native-epoll compile flags (#12272) (#12313) Motivation: Loading of the native epoll transport might segfault the JVM if musl is used and no glibc-compat is installed: Modifica... — committed to franz1981/netty by normanmaurer 2 years ago
- Don't call strdup on packagePrefix. (#12273) (#12322) Motivation: We should improve must compat by not calling strdup. Motifications: - Update jni-util version and update code for changes -... — committed to franz1981/netty by normanmaurer 2 years ago
- Update transport-native-epoll compile flags (#12272) (#12313) Motivation: Loading of the native epoll transport might segfault the JVM if musl is used and no glibc-compat is installed: Modifica... — committed to franz1981/netty by normanmaurer 2 years ago
reopened
I have updated the documentation on the native transports to note that musl is not officially supported: https://github.com/netty/netty/wiki/Native-transports
I think that’s the best we can do for now.