-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IncrementingUuidGeneratorTest fails intermittently #2851
Comments
@jkronegg do you fancy a look? |
The |
I confirm this is caused by the I reproduced the issue by generating UUIDs with multiple classloaders, in order to determine the collision probability depending on the number of classloaders. When there are 10 classloaders (as in the Note that the cumulated histogram is a bit misleading: it gives the collision rate for the CLASSLOADER_ID property, but of course the collision rate on UUID is much lower due to the other UUID parts (epoch time and counters). I can make the test-case more flexible by checking that the UUID collision rate is lower than a threshold (lets say 1% when there are 10 classloaders), rather to be collision-free as in the current implementation. This would better correspond to the Something like this:
@mpkorstanje what do you think ? (also if you have an idea of a better classloader "quasi-unique" identifier on 12 bits, I'll buy it) |
I made some tests to generate a better One option is to provide a static method I implemented this option, and it works well (the test-case in my previous comment gives 0% collision after 100 trials, but of course must run much longer because it takes 100 x 4097 classloaders to complete the test). I'll provide a PR which corrects the failing test-case and improve the |
Cheers! I'll get back to this. My to-do list just blew up. |
Ensuring that CLASSLOADER_ID has a collision rate lower than 2% for 10 classloaders is not sufficient:
My guess is that, since it's random numbers, you have a "statistical guarantee" to have 1-2% but occasionally (bad luck), you could have a lot of collisions. So the two solutions I see are: increasing the threshold (let's say 5%) or increase the sample size (e.g. 200, but this will increase the test duration). |
How about a retry (max 100) until passed? |
🤔 What's the problem you've observed?
Build 7974811136 failed with:
📚 Any additional context?
The
IncrementingUuidGeneratorTest
was added #2703.cucumber-jvm/cucumber-core/src/test/java/io/cucumber/core/eventbus/IncrementingUuidGeneratorTest.java
Lines 92 to 99 in edf09f1
cucumber-jvm/cucumber-core/src/test/java/io/cucumber/core/eventbus/IncrementingUuidGeneratorTest.java
Lines 163 to 172 in edf09f1
So I'm guessing something is either racing, or not being marked volatile correctly here:
cucumber-jvm/cucumber-core/src/main/java/io/cucumber/core/eventbus/IncrementingUuidGenerator.java
Lines 49 to 56 in edf09f1
The text was updated successfully, but these errors were encountered: