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

ClientMessageWriter throws exception while writing to buffer #15471

tezc opened this issue Aug 20, 2019 · 0 comments · Fixed by #15472

ClientMessageWriter throws exception while writing to buffer #15471

tezc opened this issue Aug 20, 2019 · 0 comments · Fixed by #15472


Copy link

@tezc tezc commented Aug 20, 2019

if (writeOffset == -1 && bytesWritable >= SIZE_OF_FRAME_LENGTH_AND_FLAGS) {

If writeOffset== -1 and bytesWritable < SIZE_OF_FRAME_LENGTH_AND_FLAGS, we don't enter if case, writeOffset is still -1

        if (writeOffset == -1 && bytesWritable >= SIZE_OF_FRAME_LENGTH_AND_FLAGS) {
            Bits.writeIntL(dst, dst.position(), frameContentLength + SIZE_OF_FRAME_LENGTH_AND_FLAGS);
            dst.position(dst.position() + Bits.INT_SIZE_IN_BYTES);

            if (isLastFrame) {
                Bits.writeShortL(dst, dst.position(), (short) (frame.flags | IS_FINAL_FLAG));
            } else {
                Bits.writeShortL(dst, dst.position(), (short) frame.flags);
            dst.position(dst.position() + Bits.SHORT_SIZE_IN_BYTES);
            writeOffset = 0;

Then it throws exception on line :

    at java.nio.Buffer.checkBounds(
    at java.nio.HeapByteBuffer.put(
    at com.hazelcast.client.impl.protocol.ClientMessageWriter.writeFrame(
    at com.hazelcast.client.impl.protocol.ClientMessageWriter.writeTo(
    at com.hazelcast.client.impl.protocol.util.ClientMessageEncoder.onWrite(
    at com.hazelcast.internal.networking.nio.NioOutboundPipeline.process(
    at com.hazelcast.internal.networking.nio.NioThread.processSelectionKey(
    at com.hazelcast.internal.networking.nio.NioThread.processSelectionKeys(
    at com.hazelcast.internal.networking.nio.NioThread.selectLoop(
@tezc tezc added the Team: Client label Aug 20, 2019
@tezc tezc added this to the 4.0 milestone Aug 20, 2019
@tezc tezc added the Type: Defect label Aug 20, 2019
@sancar sancar self-assigned this Aug 20, 2019
sancar added a commit to sancar/hazelcast that referenced this issue Aug 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.