Support Article
How to ensure that process Id is unique
SA-19757
Summary
User requires to know how to ensure that processEngine is generating a unique Id for every process.
Error Messages
Not Applicable.
Steps to Reproduce
Not Applicable.
Root Cause
How to question on PID generation.
Resolution
PID is calculated as shown below:
- newPid = staticPidBaseSeqNum * 1000L + staticPidCntNum;
- staticPidCntNum += 1L;
- newPid *= -1L;
When SEEDNUMSEQ is less than 2147483:
In any point of time , staticPidBaseSeqNum holds the current SEEDNUMSEQ sequence value. On the first call to getNextStaticPID(), after the server restart, SEEDNUMSEQ will be incremented.
Starting from zero, staticPidCntNum will be incremented by 1 for every invocation of getNextStaticPID(). Once it reaches 999, SEEDNUMSEQ will be incremented and staticPidCntNum will reset to zero.
When SEEDNUMSEQ reaches 2147483:
- staticPidBaseSeqNum will be rolled over to zero and will not hold the current SEEDNUMSEQ sequence value.
- Then on, the first call to getNextStaticPID() after the server restart or staticPidCntNum reaches 999, staticPidBaseSeqNum will be incremented.
Note: SEEDNUMSEQ will be incremented too. - Starting from zero, staticPidCntNum will be incremented by 1 for every invocation of getNextStaticPID().
- staticPidBaseSeqNum will be rolled over to zero again, once it reaches 2147483L.
User can see duplicate PIDs once SEEDNUMSEQ exceeds 2147483 and triplicate PIDS once SEEDNUMSEQ exceeds 4294966(2147483*2).
Tags:
Published March 1, 2016 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.