-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fix DHT tests failing because of repeated addresses #2855
Conversation
Due to SO_REUSE_PORT it is possible for a localhost:0 address to repeat. This causes failure in DHT tests where we spun up a lot of nodes inside test. As for a birthday paradox it is enough to use 140 ports to get 20% chance for collision which was causing failure in our case. The fix is to disable REUSE_PORT routine for the tests and leave it running for sharness tests where not that many addresses are used at the same time. License: MIT Signed-off-by: Jakub Sztandera <[email protected]>
Awesome job catching this, yet another |
|
|
||
test_sharness_expensive: | ||
cd test/sharness/ && TEST_EXPENSIVE=1 make | ||
TEST_EXPENSIVE=1 make -C test/sharness/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chriscool was there a reason to do the make
after a cd
? pls confirm this change is perfectly fine with you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's fine. One could also use make -C test/sharness/ TEST_EXPENSIVE=1
. It's a matter of preference whether one wants the shell or make
to do the cd
and to set the environment variable.
Hold up, this disabled |
Some smarter way of allocating ports would be the best solution, unfortunately it is hard to do without race of conditions (I don't know if there is a way at all to do it 100% correctly). The go-reuseport is very deep in the stack so disabling it only locally would require some refactors, that is why I decided to disable it globally. Also any test that would stress go-reuseport would have quite a high change of triggering the collision. I am all for re-enabling the go-reuseport in tests but we need to work on smart port selection first (0.0.0.0/0 is just not working with SO_REUSEPORT set). |
Due to SO_REUSEPORT it is possible for a localhost:0
address to repeat. This causes failure in DHT tests
where we spun up a lot of nodes inside test.
As for a birthday paradox it is enough to use 140
ports to get 20% chance for collision which was causing
failure in our case.
The fix is to disable REUSE_PORT routine for the
tests and leave it running for sharness tests where
not that many addresses are used at the same time.
Resolves #2745 #2809 #188