Skip to content

Java API get negative messageLength #394

@asfimport

Description

@asfimport

when I call  ArrowStreamReader.vectorSchemaRoot(),  

{{: (-520103681 < 0) 2020-11-09 07:09:07,033 ERROR ........MyModule - Error stack trace java.base/java.nio.
Buffer.createCapacityException(Buffer.java:256) java.base/java.nio.ByteBuffer.allocate(ByteBuffer.java:347)
....shaded.arrow.vector.ipc.message.MessageSerializer.readMessage(MessageSerializer.java:692) ....shaded.arrow.vector.ipc.message.MessageChannelReader.readNext(MessageChannelReader.java:57)
....shaded.arrow.vector.ipc.ArrowStreamReader.readSchema(ArrowStreamReader.java:164) ....shaded.arrow.vector.ipc.ArrowReader.initialize(ArrowReader.java:170)
....shaded.arrow.vector.ipc.ArrowReader.ensureInitialized(ArrowReader.java:161)}}

....shaded.arrow.vector.ipc.ArrowReader.getVectorSchemaRoot(ArrowReader.java:63)

 

 

The messageLength is negative, code is in MessageSerializer.java

 

messageLength = MessageSerializer.bytesToInt(buffer.array());``

 

and error is raised in 

 

ByteBuffer messageBuffer = ByteBuffer.allocate(messageLength);``

 

I tried to use minimal reproduce code to reproduce the error but I could not reproduce it. So any ideas that when can it get negative messageLength?  This error occurs occasionally in my program.

Reporter: Litchy Soong

Note: This issue was originally created as ARROW-10555. Please see the migration documentation for further details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions