[
https://issues.apache.org/jira/browse/IGNITE-2627?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15147723#comment-15147723
]
ASF GitHub Bot commented on IGNITE-2627:
----------------------------------------
GitHub user isapego opened a pull request:
https://github.com/apache/ignite/pull/485
IGNITE-2627: Removed OdbcNioParser. Using GridBufferedParser for message
separation.
Message parsing moved to OdbcNioListener.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/isapego/ignite ignite-2627
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/ignite/pull/485.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #485
----
commit feb8350d0ae40a6e98cf4b911ab16c85ed0f659a
Author: isapego <[email protected]>
Date: 2016-02-15T18:23:31Z
IGNITE-2627: Removed OdbcNioParser. Using GridBufferedParser for message
separation. Message parsing moved to OdbcNioListener.
commit c16549cd8866929b7974c18c867954a4c8c2504a
Author: isapego <[email protected]>
Date: 2016-02-15T19:26:09Z
Merge branch 'ignite-1786' into 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: Igor Sapego
> 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)