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

Byte buffer initialized with a byte array doesn't return it on subsequent getBytes() call #4531

Open
AlexeyKabelitskiy opened this issue Nov 9, 2022 · 0 comments
Labels

Comments

@AlexeyKabelitskiy
Copy link

Version

vertx-core 4.3.1 - 4.3.4 (netty-buffers 4.1.77.Final - 4.1.82.Final) and GraalVM EE 8/11

This is not reproduced on vertx 4.3.0 (netty-buffers 4.1.76.Final) or GraalVM CE 11 / Oracle JDK 8/11

Context

Byte buffer is always expected to return the data written there.
Arrays.equals(bytes, io.vertx.core.buffer.Buffer.buffer(bytes).getBytes() is supposed to always be true in the absence of modifications of the source array.

However, after certain number of iterations (tens of thousands) the above condition doesn't hold. Steps to reproduce are a bit more complicated, but it boils down to the above comparison.

I believe it has something to do with this commit: netty/netty@f9e765e, at least that change was introduced in netty 4.1.77.Final, and this is the first version of netty when test case started failing.

I would create an issue with netty, however the same test case doesn't fail using pure netty ByteBuf's, without VertxUnsafeHeapByteBuf

Do you have a reproducer?

https://github.com/AlexeyKabelitskiy/vertx-byte-buffer-test

Steps to reproduce

  1. Build: mvn install
  2. Run on GraalVM EE: java -jar target/vertx-byte-buffer-test-1.0.jar

Extra

  • JVM version
java -version
java version "11.0.16.1" 2022-08-18 LTS
Java(TM) SE Runtime Environment GraalVM EE 22.2.0.1 (build 11.0.16.1+1-LTS-jvmci-22.2-b08)
Java HotSpot(TM) 64-Bit Server VM GraalVM EE 22.2.0.1 (build 11.0.16.1+1-LTS-jvmci-22.2-b08, mixed mode, sharing)
  • OS - MacOS Monterey
uname -a
Darwin akabelyt-mac.local 21.6.0 Darwin Kernel Version 21.6.0: Mon Aug 22 20:17:10 PDT 2022; root:xnu-8020.140.49~2/RELEASE_X86_64 x86_64 i386 Darwin
  • Anything that can be relevant such as OS version, JVM version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant