Atmosphere / atmosphere

Event Driven WebSockets Framework with Cross-Browser Fallbacks
http://async-io.org/
3.69k stars 749 forks source link

java.nio.ByteBuffer.flip() #2507

Open fcorneli opened 4 months ago

fcorneli commented 4 months ago

Atmosphere version: 2.7.14 Java version: 8 We get the following exception:

15:21:08,709 ERROR [org.atmosphere.cpr.AsynchronousProcessor] (nioEventLoopGroup-3-5) : java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer;
    at org.atmosphere.client.TrackMessageSizeInterceptor$Interceptor.transformPayload(TrackMessageSizeInterceptor.java:173)

This did not happen on Atmosphere versions 2.7.10, 2.7.11.

jfarcand commented 4 months ago

@fcorneli Which jdk8 version exactly? I can't reproduce

java --version
openjdk 21.0.2 2024-01-16 LTS
OpenJDK Runtime Environment Temurin-21.0.2+13 (build 21.0.2+13-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.2+13 (build 21.0.2+13-LTS, mixed mode)
fcorneli commented 4 months ago
java -version
java version "1.8.0_411"
Java(TM) SE Runtime Environment (build 1.8.0_411-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.411-b09, mixed mode)

Running on macOS:

uname -a     
Darwin MacBook-Pro-van-Frank.local 23.5.0 Darwin Kernel Version 23.5.0: Wed May  1 20:17:33 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6031 arm64

The atmosphere runtime is running embedded within a JBoss EAP 7.4.

fcorneli commented 4 months ago

https://github.com/Atmosphere/atmosphere/blob/d931cc1c1ac1ddcc747a87a9aa07cec227f7400f/modules/cpr/src/main/java/org/atmosphere/client/TrackMessageSizeInterceptor.java#L173

See also: https://stackoverflow.com/questions/61267495/exception-in-thread-main-java-lang-nosuchmethoderror-java-nio-bytebuffer-flip

I guess:

((Buffer) bb).flip();

should do the trick?

jfarcand commented 4 months ago

Thanks. When I look at gitblame, I don't see recent changes...

image

Digging!

jfarcand commented 4 months ago

Ah got it. The release has probably been made using jdk 21.

fcorneli commented 4 months ago

Yep. Was just also thinking about this... :)

jfarcand commented 3 months ago

@fcorneli Do you need a new release? I was waiting for a fix or two before re-releasing using jdk8

fcorneli commented 3 months ago

@jfarcand Not urgent from our side.

fcorneli commented 5 days ago

@jfarcand Any news on a release?

jfarcand commented 4 days ago

@fcorneli Today and at worse, tomorrow!