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 NoClassDefFoundError - io.airlift.compress.lz4.UnsafeUtil #10983

Merged
merged 3 commits into from
Jun 20, 2021

Conversation

newur
Copy link
Contributor

@newur newur commented Jun 19, 2021

Motivation

Java client fails with Java 16 while receiving a message. Error:

[org.apa.pul.cli.imp.ClientCnx] (pulsar-client-io-2-1) [localhost/127.0.0.1:6650] Got exception java.lang.NoClassDefFoundError: Could not initialize class io.airlift.compress.lz4.UnsafeUtil
	at io.airlift.compress.lz4.Lz4RawDecompressor.decompress(Lz4RawDecompressor.java:60)
	at org.apache.pulsar.common.compression.CompressionCodecLZ4.decode(CompressionCodecLZ4.java:91)
	at org.apache.pulsar.client.impl.ConsumerImpl.uncompressPayloadIfNeeded(ConsumerImpl.java:1507)
	at org.apache.pulsar.client.impl.ConsumerImpl.messageReceived(ConsumerImpl.java:1037)
	at org.apache.pulsar.client.impl.ClientCnx.handleMessage(ClientCnx.java:447)
	at org.apache.pulsar.common.protocol.PulsarDecoder.channelRead(PulsarDecoder.java:186)
...

Can be reproduced with the official example for Java Client from the docu while using JDK 16.

Workaround

Locally I use pulsar-client-original, and exclude the aircompressor 16. Example:

<dependency>
  <groupId>org.apache.pulsar</groupId>
  <artifactId>pulsar-client-original</artifactId>
  <version>${pulsar.version}</version>
  <exclusions>
    <exclusion>
      <groupId>io.airlift</groupId>
      <artifactId>aircompressor</artifactId>
    </exclusion>
  </exclusions>
</dependency>

<!-- https://mvnrepository.com/artifact/io.airlift/aircompressor -->
<dependency>
  <groupId>io.airlift</groupId>
  <artifactId>aircompressor</artifactId>
  <version>0.19</version>
</dependency>

Modifications

Upgrade io.airlift.aircompressor to version 19.

Does this pull request potentially affect one of the following parts:

  • Dependencies yes upgrade

Reading a message fails with

[org.apa.pul.cli.imp.ClientCnx] (pulsar-client-io-2-1) [localhost/127.0.0.1:6650] Got exception java.lang.NoClassDefFoundError: Could not initialize class io.airlift.compress.lz4.UnsafeUtil
	at io.airlift.compress.lz4.Lz4RawDecompressor.decompress(Lz4RawDecompressor.java:60)
	at org.apache.pulsar.common.compression.CompressionCodecLZ4.decode(CompressionCodecLZ4.java:91)
@merlimat merlimat added this to the 2.9.0 milestone Jun 20, 2021
@merlimat merlimat self-assigned this Jun 20, 2021
@merlimat
Copy link
Contributor

@newur We also need to update the version in the license files:

Run src/check-binary-license ./distribution/server/target/apache-pulsar-*-bin.tar.gz
io.airlift-aircompressor-0.19.jar unaccounted for in LICENSE
io.airlift-aircompressor-0.16.jar mentioned in LICENSE, but not bundled
aircompressor-0.19.jar unaccounted for in lib/presto/LICENSE
aircompressor-0.19.jar unaccounted for in lib/presto/LICENSE
aircompressor-0.16.jar mentioned in lib/presto/LICENSE, but not bundled
src/check-binary-license: line 120: echo: write error: Broken pipe

It looks like there are issues with the LICENSE/NOTICE.
Error: Process completed with exit code 2.

You can find them at:

  • distribution/server/src/assemble/LICENSE.bin.txt
  • pulsar-sql/presto-distribution/LICENSE

@newur
Copy link
Contributor Author

newur commented Jun 20, 2021

For the record: deep down the following error is thrown when using JDK 16 and aircompressor <19:

Unable to make field long java.nio.Buffer.address accessible: module java.base does not "opens java.nio" to unnamed module

Could not make it work with VM parameters like --add-opens java.base/java.nio=ALL-UNNAMED.

Also see: airlift/aircompressor#125

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

LGTM

@newur
Copy link
Contributor Author

newur commented Jun 20, 2021

I cannot reproduce the failing unit tests locally. Checkout tag v2.8.0, changed the the aircompressor version and looks okay...

@eolivelli
Copy link
Contributor

It is a flaky test.
I restarted the job. Don't worry

@merlimat merlimat merged commit 2ea1ce6 into apache:master Jun 20, 2021
yangl pushed a commit to yangl/pulsar that referenced this pull request Jun 23, 2021
…#10983)

* fix NoClassDefFoundError - io.airlift.compress.lz4.UnsafeUtil

Reading a message fails with

[org.apa.pul.cli.imp.ClientCnx] (pulsar-client-io-2-1) [localhost/127.0.0.1:6650] Got exception java.lang.NoClassDefFoundError: Could not initialize class io.airlift.compress.lz4.UnsafeUtil
	at io.airlift.compress.lz4.Lz4RawDecompressor.decompress(Lz4RawDecompressor.java:60)
	at org.apache.pulsar.common.compression.CompressionCodecLZ4.decode(CompressionCodecLZ4.java:91)

* update aircompressor license file

* update aircompressor license file
codelipenghui pushed a commit that referenced this pull request Jun 25, 2021
* fix NoClassDefFoundError - io.airlift.compress.lz4.UnsafeUtil

Reading a message fails with

[org.apa.pul.cli.imp.ClientCnx] (pulsar-client-io-2-1) [localhost/127.0.0.1:6650] Got exception java.lang.NoClassDefFoundError: Could not initialize class io.airlift.compress.lz4.UnsafeUtil
	at io.airlift.compress.lz4.Lz4RawDecompressor.decompress(Lz4RawDecompressor.java:60)
	at org.apache.pulsar.common.compression.CompressionCodecLZ4.decode(CompressionCodecLZ4.java:91)

* update aircompressor license file

* update aircompressor license file

(cherry picked from commit 2ea1ce6)
@codelipenghui codelipenghui added the cherry-picked/branch-2.8 Archived: 2.8 is end of life label Jun 25, 2021
bharanic-dev pushed a commit to bharanic-dev/pulsar that referenced this pull request Mar 18, 2022
…#10983)

* fix NoClassDefFoundError - io.airlift.compress.lz4.UnsafeUtil

Reading a message fails with

[org.apa.pul.cli.imp.ClientCnx] (pulsar-client-io-2-1) [localhost/127.0.0.1:6650] Got exception java.lang.NoClassDefFoundError: Could not initialize class io.airlift.compress.lz4.UnsafeUtil
	at io.airlift.compress.lz4.Lz4RawDecompressor.decompress(Lz4RawDecompressor.java:60)
	at org.apache.pulsar.common.compression.CompressionCodecLZ4.decode(CompressionCodecLZ4.java:91)

* update aircompressor license file

* update aircompressor license file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-picked/branch-2.8 Archived: 2.8 is end of life release/2.8.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants