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

Update to Cats Effect v3.5.0-RC2 #3142

Merged
merged 21 commits into from
Feb 20, 2023

Conversation

armanbilge
Copy link
Member

@armanbilge armanbilge commented Feb 14, 2023

  1. Fixes for new async cancellation semantics. Also plug some resource leaks.
  2. Prefer performance-enhanced Mutex to Semaphore(1)
  3. Prefer flatModify to modify(...).flatten, fixes at least a few cancellation-related bugs

@armanbilge
Copy link
Member Author

Some possibly concerning, non-deterministic JVM failures.

==> X fs2.StreamInterruptSuite.3 - constant stream  31.001s java.util.concurrent.TimeoutException: test timed out after 31 seconds
==> X fs2.StreamInterruptSuite.4 - interruption of constant stream with a flatMap  31.001s java.util.concurrent.TimeoutException: test timed out after 31 seconds
==> X fs2.StreamInterruptSuite.5 - interruption of an infinitely recursive stream  31.002s java.util.concurrent.TimeoutException: test timed out after 31 seconds
  + 6 - interruption of an infinitely recursive stream that never emits 0.582s
==> X fs2.StreamInterruptSuite.7 - interruption of an infinitely recursive stream that never emits and has no eval  31.0s java.util.concurrent.TimeoutException: test timed out after 31 seconds
  + 8 - interruption of a stream that repeatedly evaluates 0.505s
==> X fs2.StreamInterruptSuite.9 - interruption of the constant drained stream  31.001s java.util.concurrent.TimeoutException: test timed out after 31 seconds

https://github.com/typelevel/fs2/actions/runs/4176988548/jobs/7234274942#step:11:1431

Those tests look like this:

test("3 - constant stream") {
val interruptSoon = Stream.sleep_[IO](20.millis).compile.drain.attempt
Stream
.constant(true)
.interruptWhen(interruptSoon)
.compile
.drain
.replicateA(interruptRepeatCount)
}

So basically they are testing the ability for concurrent interruption of CPU-bound work.

@armanbilge
Copy link
Member Author

I was able to replicate locally by adding Test / javaOptions += "-XX:ActiveProcessorCount=2" so that it's like CI ...

@djspiewak
Copy link
Member

Hmm…

@armanbilge
Copy link
Member Author

armanbilge commented Feb 15, 2023

Update to those following along here: we've traced this to a bug in WorkerThread, where after a timer fires and re-enqueues a fiber in the local queue, the worker still assumes its local queue is empty and continues trying to (unsuccessfully) steal work from elsewhere.

Breadcrumbs:

build.sbt Outdated Show resolved Hide resolved
build.sbt Outdated Show resolved Hide resolved