Suhas Dantkale created ZOOKEEPER-3426:
-----------------------------------------
Summary: ZK prime_connection(the Handshake) can complete without
reading all the payload.
Key: ZOOKEEPER-3426
URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3426
Project: ZooKeeper
Issue Type: Bug
Components: c client
Reporter: Suhas Dantkale
/* returns:
* -1 if recv call failed,
* 0 if recv would block,
* 1 if success
*/
static int recv_buffer(zhandle_t *zh, buffer_list_t *buff)
{
int off = buff->curr_offset;
int rc = 0;
[................]
if (buff == &zh->primer_buffer && rc == buff->len - 1) ++rc; <====== Handshake
prematurely complete.
On non-blocking socket, it's possible that socket has exactly "buff->len - 1"
bytes to read.
Because of the above line, the Handshake is prematurely completed.
What this can lead to is:
There will be one outstanding byte left on the socket and it might go as part
of next message which could get corrupted.
I think this can lead to ZRUNTIMEINCONSISTENCY issues later.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)