Skip to content

Conversation

@lobachpavel
Copy link

Zookeeper doesn't handle xid = 0 properly, so change logic to start xid from 1 and properly handle integer overflow

see #100 for detailed explanation

header.type !== jute.OP_CODES.PING &&
header.type !== jute.OP_CODES.AUTH) {

this.xid = (this.xid % 2147483647) + 1;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we just need to set the initial value of XID to 1.

because
a: The role of xid is to ensure the order of requests, so we should not break its meaning.
b: 2 ** 32 -1 I believe this value can meet most needs

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With a continuously running application doing on average 100 requests per second (mine, which is not a huge one, already does way more), that would break after 248.5 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants