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

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

ClientMessageWriter throws exception while writing to buffer #15471

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

Comments

@tezc
Copy link
Contributor

@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 :

java.lang.IndexOutOfBoundsException
    at java.nio.Buffer.checkBounds(Buffer.java:567)
    at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:187)
    at com.hazelcast.client.impl.protocol.ClientMessageWriter.writeFrame(ClientMessageWriter.java:88)
    at com.hazelcast.client.impl.protocol.ClientMessageWriter.writeTo(ClientMessageWriter.java:36)
    at com.hazelcast.client.impl.protocol.util.ClientMessageEncoder.onWrite(ClientMessageEncoder.java:58)
    at com.hazelcast.internal.networking.nio.NioOutboundPipeline.process(NioOutboundPipeline.java:276)
    at com.hazelcast.internal.networking.nio.NioThread.processSelectionKey(NioThread.java:369)
    at com.hazelcast.internal.networking.nio.NioThread.processSelectionKeys(NioThread.java:354)
    at com.hazelcast.internal.networking.nio.NioThread.selectLoop(NioThread.java:280)
    at com.hazelcast.internal.networking.nio.NioThread.run(NioThread.java:235)
@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
Projects
None yet
2 participants
You can’t perform that action at this time.