ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vladimir Ozerov (JIRA)" <j...@apache.org>
Subject [jira] [Created] (IGNITE-2627) ODBC: OdbcNioParser is implemented incorrectly.
Date Thu, 11 Feb 2016 14:03:18 GMT
Vladimir Ozerov created IGNITE-2627:

             Summary: ODBC: OdbcNioParser is implemented incorrectly.
                 Key: IGNITE-2627
                 URL: https://issues.apache.org/jira/browse/IGNITE-2627
             Project: Ignite
          Issue Type: Sub-task
          Components: odbc
    Affects Versions: 1.5.0.final
            Reporter: Vladimir Ozerov
            Assignee: Igor Sapego
             Fix For: 1.6

There are number of problem with OdbcNioParser which makes it usable only in single-threaded
application when no TCP messages are batched together:

1) Parser is not thread-safe and hence cannot have any state like "leftToReceive" of "curMsg"
Instead, you should rely on meta assigned to GridNioSession. See GridDirectParser as example.

This will make the parser thread-safe.

2) Message is decoded incorrectly. When "decode" is called, you cannot rely on buf.array(),
as this array could contain multiple requests. Moreover, there are no guarantees that current
message is started from the beginning of this array. So, the following line might return incorrect
int msgLen = reader.readInt();

Instead, you should follow common practice:
1) Always rely on ByteBuffer.remaining()
2) Read message byte-by-byte until all 4 bytes are read.
3) Then read message body into separate byte[] until all data is ready.
4) And only then you can create BinaryHeapInputStream and deserialize the stuff.

This message was sent by Atlassian JIRA

View raw message