Skip to content

Change xid computation logic#101

Open
lobachpavel wants to merge 1 commit intoalexguan:masterfrom
lobachpavel:feature/xidfix
Open

Change xid computation logic#101
lobachpavel wants to merge 1 commit intoalexguan:masterfrom
lobachpavel:feature/xidfix

Conversation

@lobachpavel
Copy link
Copy Markdown

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

Comment thread lib/ConnectionManager.js
header.type !== jute.OP_CODES.PING &&
header.type !== jute.OP_CODES.AUTH) {

this.xid = (this.xid % 2147483647) + 1;
Copy link
Copy Markdown

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
Copy Markdown

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