[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-3426?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated ZOOKEEPER-3426:
--------------------------------------
    Labels: pull-request-available  (was: )

> 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
>            Assignee: Damien Diederen
>            Priority: Blocker
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> /* 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
(v8.3.4#803005)

Reply via email to