You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@zookeeper.apache.org by "sssdnsy666 (Jira)" <ji...@apache.org> on 2025/07/17 14:07:00 UTC
[jira] [Commented] (ZOOKEEPER-4904) SessionTrackerImpl generates negative session IDs when server ID is larger than 127
[ https://issues.apache.org/jira/browse/ZOOKEEPER-4904?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18007830#comment-18007830 ]
sssdnsy666 commented on ZOOKEEPER-4904:
---------------------------------------
@[~kezhuw]
In this description, the server Id never change ,the initializeNextSessionId method paramter id is always 1 , I find all the all this fuction, it is not from myid file value。 so it not a bug can we close this issue?
> SessionTrackerImpl generates negative session IDs when server ID is larger than 127
> -----------------------------------------------------------------------------------
>
> Key: ZOOKEEPER-4904
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-4904
> Project: ZooKeeper
> Issue Type: Bug
> Reporter: Patrick
> Priority: Trivial
>
> This issue was discovered during a [discussion|https://lists.apache.org/thread/0pwxw1rzdffmbxctdzv2rmplzgwt6lpl] about negative Solr Overseer IDs
> Setting the server ID to a value greater than 127 in the myid file causes the SessionTrackerImpl.initializeNextSessionId function to generate a negative session ID.
>
> {code:java}
> public static long initializeNextSessionId(long id) {
> long nextSid;
> nextSid = (Time.currentElapsedTime() << 24) >>> 8;
> nextSid = nextSid | (id << 56); <------------------------
> if (nextSid == EphemeralType.CONTAINER_EPHEMERAL_OWNER) {
> ++nextSid; // this is an unlikely edge case, but check it just in case
> }
> return nextSid;
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)