which I was able to reproduce quite reliably locally by wrapping the test in an 100.times do block.
Looking at the concurrency tests, I noticed that they are using the same client instance across threads, but the README's Threading section says
memcached is threadsafe, but each thread requires its own Memcached instance. Create a global Memcached, and then call Memcached#clone each time you spawn a thread.
so this is what should be being tested for thread-safety.
Solution
I changed all the ConcurrencyTest methods to use the clone method as recommended in the README and it fixed the flaky test.
Based on https://github.com/arthurnn/memcached/pull/186 to fix CI, see https://github.com/dylanahsmith/memcached/compare/github-actions...fix-concurrency-test for this PRs changesProblem
I've noticed the following flaky test failure
which I was able to reproduce quite reliably locally by wrapping the test in an
100.times do
block.Looking at the concurrency tests, I noticed that they are using the same client instance across threads, but the README's Threading section says
so this is what should be being tested for thread-safety.
Solution
I changed all the ConcurrencyTest methods to use the
clone
method as recommended in the README and it fixed the flaky test.