[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-1485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15302771#comment-15302771
 ] 

Martin Kuchta commented on ZOOKEEPER-1485:
------------------------------------------

I have multiple cases of this causing cores on long-running clients. See 
[ZOOKEEPER-2318|https://issues.apache.org/jira/browse/ZOOKEEPER-2318] for an 
example of what this looks like.

I'm not convinced that the bin-compat option above would solve the issue, at 
least for the C client as it's currently implemented. The client uses a static 
variable to track the XID, so expiring the session doesn't seem like it would 
reset it, and the client would keep trying negative XIDs.

Simply wrapping the XID to 0 after it hits INT32_MAX seems like it would fix 
the issue, since as far as I can tell, the client XID is only used for equality 
comparisons to match server responses to pending completions.

> client xid overflow is not handled
> ----------------------------------
>
>                 Key: ZOOKEEPER-1485
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1485
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: c client, java client
>    Affects Versions: 3.4.3, 3.3.5
>            Reporter: Michi Mutsuzaki
>            Assignee: Bruce Gao
>
> Both Java and C clients use signed 32-bit int as XIDs. XIDs are assumed to be 
> non-negative, and zookeeper uses some negative values as special XIDs (e.g. 
> -2 for ping, -4 for auth). However, neither Java nor C client ensures the 
> XIDs it generates are non-negative, and the server doesn't reject negative 
> XIDs.
> Pat had some suggestions on how to fix this:
> - (bin-compat) Expire the session when the client sends a negative XID.
> - (bin-incompat) In addition to expiring the session, use 64-bit int for XID 
> so that overflow will practically never happen.
> --Michi



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to