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

[fix] Switch docker base image to avoid mixing musl & glibc libraries at runtime #23366

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

lhotari
Copy link
Member

@lhotari lhotari commented Sep 28, 2024

Motivation

While testing Pulsar 4.0.0-preview.1, some compatibility issues with the Alpine base image have shown up.
It appears that the solution in the base image is something that will cause further compatibility issues. Mixing musl and glibc at runtime is known to cause compatibility and stability issues.

sgerrand/alpine-pkg-glibc#194 (comment) mentions:
"You really need everything pure musl, or everything musl (but works with gcompat or libc6-compat shim-like tools...) or everything glibc using this package)"

In our case, we are mixing pure musl libraries and glibc compiled libraries with our Alpine base image configuration which should be avoided.

Another reason to switch to a base image that is optimized for running Java JVM applications. The current Alpine image crashes the JVM in unexpected ways. #23348/#23361 is an example of this.

java.lang.OutOfMemoryError: unable to create a native thread: possibly out of memory or process/resource limits reached.

Modifications

Use https://hub.docker.com/r/bellsoft/liberica-runtime-container as the base image. (Apache NiFi uses a bellsoft/liberica-openjdk-debian, so Liberica is already used in ASF.)
It's the Liberica OpenJDK's official base image provided by BellSoft. It uses Alpaquita Linux as the OS, which is similar to Alpine and uses apk as the package manager. Alpaquita Linux is optimized for running JVM applications.

The image size is very similar as before.

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Sep 28, 2024
docker/pulsar/Dockerfile Outdated Show resolved Hide resolved
docker/pulsar/Dockerfile Show resolved Hide resolved
@lhotari lhotari mentioned this pull request Sep 28, 2024
15 tasks
@lhotari
Copy link
Member Author

lhotari commented Sep 28, 2024

It looks like test image building fails due to missing supervisor package. It is available also with pip install: http://supervisord.org/installing.html

lhotari and others added 3 commits September 28, 2024 22:30
… at runtime

Mixing musl & glibc libraries at runtime will result in compatibility issues.
We need a solution with real glibc because of compatibility reasons.
The previous solution with the Alpine base image has a critical issue since
it mixes musl compiled and glibc compiled libraries at runtime while using real glibc.
This is why the switch is needed.

For example, snappy-java and Conscrypt show that this problem occurs.
@lhotari lhotari force-pushed the lh-liberica-alpaquita-glibc-base-image branch from 8cc60d3 to a42afb9 Compare September 28, 2024 19:30
@lhotari
Copy link
Member Author

lhotari commented Sep 28, 2024

It looks like test image building fails due to missing supervisor package. It is available also with pip install: http://supervisord.org/installing.html

supervisor has been installed, but there is some remaining issue.

Unrecognized option: -client
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
@codecov-commenter
Copy link

codecov-commenter commented Sep 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.57%. Comparing base (bbc6224) to head (f6498f5).
Report is 611 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #23366      +/-   ##
============================================
+ Coverage     73.57%   74.57%   +0.99%     
- Complexity    32624    33962    +1338     
============================================
  Files          1877     1934      +57     
  Lines        139502   145132    +5630     
  Branches      15299    15870     +571     
============================================
+ Hits         102638   108231    +5593     
+ Misses        28908    28604     -304     
- Partials       7956     8297     +341     
Flag Coverage Δ
inttests 27.69% <ø> (+3.10%) ⬆️
systests 24.39% <ø> (+0.07%) ⬆️
unittests 73.92% <ø> (+1.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 599 files with indirect coverage changes

@lhotari lhotari marked this pull request as draft September 29, 2024 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-not-needed Your PR changes do not impact docs ready-to-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants