[
https://issues.apache.org/jira/browse/IGNITE-2627?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Vladimir Ozerov closed IGNITE-2627.
-----------------------------------
> 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: Vladimir Ozerov
> Priority: Critical
> 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" fields.
> 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 result:
> {code}
> int msgLen = reader.readInt();
> {code}
> 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
(v6.3.4#6332)