Patrick created ZOOKEEPER-4904:
----------------------------------

             Summary: 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


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)

Reply via email to