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][ci] Fix snappy-java native lib fails to load in x86 alpine #22804

Merged
merged 9 commits into from
Jun 3, 2024

Conversation

yaalsn
Copy link
Contributor

@yaalsn yaalsn commented May 30, 2024

Motivation

From branch-3.3, pulsar starts to use alpine as base image, but it throws exception when using snappy-java lib.

Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.UnsatisfiedLinkError: /tmp/snappy-1.1.10-4b05b6fe-7374-45fc-b770-7e3728aa63de-libsnappyjava.so: Error relocating /lib/ld-linux-x86-64.so.2: unsupported relocation type 37 [in thread "pulsar-offload-write-OrderedExecutor-1-0"]

The reason is that alpine is musl-based OS while snappy-java lib built-in libsnappyjava.so is compiled with glibc.

In order to fix this issue, we need to re-compile the snappy-java native lib in alpine docker.

Modifications

Verifying this change

  • Make sure that the change passes the CI checks.

Documentation

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

Matching PR in forked repository

PR in forked repository: yaalsn#2

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label May 30, 2024
@coderzc coderzc self-assigned this May 30, 2024
@coderzc coderzc assigned yaalsn and unassigned coderzc May 30, 2024
@coderzc
Copy link
Member

coderzc commented May 30, 2024

I verified this PR and it works fine.

docker run -it \
-e PULSAR_STANDALONE_USE_ZOOKEEPER=1 \
-e PULSAR_EXTRA_OPTS="-Dzookeeper.snapshot.compression.method=snappy" \
--platform=linux/amd64 \
czcoder/pulsar:3.3.0-66baa8d \
bin/pulsar standalone

@coderzc coderzc closed this May 30, 2024
@coderzc coderzc reopened this May 30, 2024
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.22%. Comparing base (bbc6224) to head (dff4565).
Report is 319 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #22804      +/-   ##
============================================
- Coverage     73.57%   73.22%   -0.35%     
+ Complexity    32624    32617       -7     
============================================
  Files          1877     1890      +13     
  Lines        139502   141644    +2142     
  Branches      15299    15541     +242     
============================================
+ Hits         102638   103721    +1083     
- Misses        28908    29917    +1009     
- Partials       7956     8006      +50     
Flag Coverage Δ
inttests 27.37% <ø> (+2.79%) ⬆️
systests 24.75% <ø> (+0.43%) ⬆️
unittests 72.22% <ø> (-0.62%) ⬇️

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

see 364 files with indirect coverage changes

docker/pulsar/Dockerfile Outdated Show resolved Hide resolved
Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, left some minor comments. Good work @yaalsn

bin/pulsar Outdated Show resolved Hide resolved
Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please find another solution than modifying the default bin/pulsar script

@zymap
Copy link
Member

zymap commented May 31, 2024

I don't think that this should be done for the default bin/pulsar script. There should be another way.

We don't need to add that in the OPTS by default. We can add a comment to say if you need snappy, add this -Dorg.xerial.snappy.use.systemlib=true to the PULSAR_EXTRA_OPTS

@yaalsn

@yaalsn
Copy link
Contributor Author

yaalsn commented May 31, 2024

We don't need to add that in the OPTS by default. We can add a comment to say if you need snappy, add this -Dorg.xerial.snappy.use.systemlib=true to the PULSAR_EXTRA_OPTS

Nice! This way is better.

@coderzc
Copy link
Member

coderzc commented May 31, 2024

@lhotari @zymap PTAL

@lhotari
Copy link
Member

lhotari commented May 31, 2024

We don't need to add that in the OPTS by default. We can add a comment to say if you need snappy, add this -Dorg.xerial.snappy.use.systemlib=true to the PULSAR_EXTRA_OPTS

I don't think that this is a good idea to have more configuration options to tweak. It's better to handle this in the Dockerfile building phase as I suggested by simply appending OPTS="$OPTS -Dorg.xerial.snappy.use.systemlib=true" to the /pulsar/conf/bkenv.sh file.

@coderzc
Copy link
Member

coderzc commented May 31, 2024

I don't think that this is a good idea to have more configuration options to tweak. It's better to handle this in the Dockerfile building phase as I suggested by simply appending OPTS="$OPTS -Dorg.xerial.snappy.use.systemlib=true" to the /pulsar/conf/bkenv.sh file.

I also prefer this solution.

@zymap
Copy link
Member

zymap commented May 31, 2024

both ok to me.

@coderzc coderzc added the release/blocker Indicate the PR or issue that should block the release until it gets resolved label May 31, 2024
@nodece
Copy link
Member

nodece commented May 31, 2024

One problem is that building snappy may take a lot of time.

I haven't tested it yet.

@lhotari
Copy link
Member

lhotari commented May 31, 2024

One problem is that building snappy may take a lot of time.

I haven't tested it yet.

It doesn't take long to build.

@coderzc
Copy link
Member

coderzc commented Jun 2, 2024

@lhotari PTAL

@coderzc coderzc merged commit 7b8f4a9 into apache:master Jun 3, 2024
47 of 49 checks passed
coderzc pushed a commit that referenced this pull request Jun 3, 2024
@coderzc coderzc added cherry-picked/branch-3.3 and removed release/blocker Indicate the PR or issue that should block the release until it gets resolved labels Jun 3, 2024
@lhotari lhotari added this to the 4.0.0 milestone Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants