Skip to content
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

Flakiness in IOSpec #3985

Open
durban opened this issue Jan 31, 2024 · 1 comment
Open

Flakiness in IOSpec #3985

durban opened this issue Jan 31, 2024 · 1 comment

Comments

@durban
Copy link
Contributor

durban commented Jan 31, 2024

https://github.com/typelevel/cats-effect/actions/runs/7732197317/job/21083847462#step:24:3685

...
[error]     x not lose cedeing threads from the bypass when blocker transitioning
[error]      List(3714008, 3714008, 3714008) == 'List(3714008, 3714008, 3714008)' (IOPlatformSpecification.scala:459)
...
[info] Total for specification IOSpec
[info] Finished in 17 seconds, 346 ms
[info] 346 examples, 13123 expectations, 1 failure, 0 error
@djspiewak
Copy link
Member

List(3714008, 3714008, 3714008) == 'List(3714008, 3714008, 3714008)'

image

Oh the assertion is as follows:

results must not[List[Long]](beEqualTo(List.fill(3)(results.head)))

Technically this is a fairly timing-sensitive test. The assertion is right here:

            val results = 0.until(3).toList map { _ =>
              Thread.sleep(100L)
              ctr.get()
            }

Specifically, we're sampling ctr (an AtomicLong) once every 100ms and asserting that it's changing. The changes are happening here:

val tsk1 = IO { ctr.incrementAndGet() }.foreverM

So the idea is that we're asserting that this fiber is still running somewhere by observing the changes it is making to the counter. The timing sensitivity is, if the fiber is in fact still running but somehow doesn't get scheduled even once in 300ms of wall clock time, we won't see ctr change and we'll have a spurious failure. We can either increase the sample iteration count or increase the sleep within the sample iterations. Also it's not totally clear to me why we need more than two samples, so that might be a nice simplification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants