spark-instrumented-optimizer/common
Shixiong Zhu 5624bfbcfe [SPARK-27275][CORE] Fix potential corruption in EncryptedMessage.transferTo
## What changes were proposed in this pull request?

Right now there are several issues in `EncryptedMessage.transferTo`:

- When the underlying buffer has more than `1024 * 32` bytes (this should be rare but it could happen in error messages that send over the wire), it may just send a partial message as `EncryptedMessage.count` becomes less than `transferred`. This will cause the client hang forever (or timeout) as it will wait until receiving expected length of bytes, or weird errors (such as corruption or silent correctness issue) if the channel is reused by other messages.
- When the underlying buffer is full, it's still trying to write out bytes in a busy loop.

This PR fixes  the issues in `EncryptedMessage.transferTo` and also makes it follow the contract of `FileRegion`:

- `count` should be a fixed value which is just the length of the whole message.
- It should be non-blocking. When the underlying socket is not ready to write, it should give up and give control back.
- `transferTo` should return the length of written bytes.

## How was this patch tested?

The new added tests.

Closes #24211 from zsxwing/fix-enc.

Authored-by: Shixiong Zhu <zsxwing@gmail.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
2019-03-26 15:48:29 -07:00
..
kvstore [SPARK-26090][CORE][SQL][ML] Resolve most miscellaneous deprecation and build warnings for Spark 3 2018-11-19 09:16:42 -06:00
network-common [SPARK-27275][CORE] Fix potential corruption in EncryptedMessage.transferTo 2019-03-26 15:48:29 -07:00
network-shuffle [SPARK-26288][CORE] add initRegisteredExecutorsDB 2019-03-19 16:16:43 -05:00
network-yarn [SPARK-27021][CORE] Cleanup of Netty event loop group for shuffle chunk fetch requests 2019-03-05 12:31:06 -08:00
sketch [SPARK-25956] Make Scala 2.12 as default Scala version in Spark 3.0 2018-11-14 16:22:23 -08:00
tags [SPARK-26026][BUILD] Published Scaladoc jars missing from Maven Central 2018-11-19 08:06:33 -06:00
unsafe [CORE][MINOR] Fix some typos about MemoryMode 2019-01-15 14:40:00 +08:00