Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pack full messages before sending in Bolt server
Previously Bolt server wrote messages (like RECORD) directly into the outgoing buffer and flushed it when size limit was reached. This could result in half-written messages be send back to the client when packing failed. Observer failure scenario: transaction terminated while node is being streamed back to the client. This caused Bolt server to fail while reading node's labels/properties but after RECORD and NODE struct headers have already been written. Next, server tried to stream FAILURE back while resulting buffer already contained rouge struct headers. This caused client to misinterpret the response and fail with protocol violation errors. This commit fixes the problem by making Bolt server write full messages to the buffer before flushing it. Buffer can also be truncated when message serialization fails half-way. So that all rogue bytes are removed. Buffer will only be written to the network channel when it contains a complete message. `BoltProceduresIT` is the integration test that reproduces the described failure scenario.
- Loading branch information
Showing
21 changed files
with
1,380 additions
and
398 deletions.
There are no files selected for viewing
27 changes: 0 additions & 27 deletions
27
...unity/bolt/src/main/java/org/neo4j/bolt/v1/messaging/BoltResponseMessageBoundaryHook.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.