bneradt opened a new pull request, #12427:
URL: https://github.com/apache/trafficserver/pull/12427

   I noticed the following test failure in a recent CI run:
   
   ```
   SnowflakeID
   
-------------------------------------------------------------------------------
   ../src/tscore/unit_tests/test_SnowflakeID.cc:94
   
...............................................................................
   
   ../src/tscore/unit_tests/test_SnowflakeID.cc:169: FAILED:
     REQUIRE( u1.sequence == 0u )
   with expansion:
     1 == 0
   ```
   
   I realized this can happen if we re-attempt to grab new snowflake IDs in 
what happens to be the same millisecond as the previous attempt. Thus the u1 
from the new attempt will likely be in the same millisecond as the u2 in the 
previous attempt. Thus u1.squence will then be 1 instead of 0. This adds a 2ms 
sleep in the loop to avoid this situation.
   
   Note this is a timing bug in the test. The production code correctly 
assigned in this situation a sequence of 1 since the ID was in the same 
millisecond as the previous one.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to