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

Exception in spawned stream cancels Stream.never but swallows the exception #3469

Open
lhns opened this issue Aug 30, 2024 · 0 comments
Open
Labels

Comments

@lhns
Copy link
Contributor

lhns commented Aug 30, 2024

Hi, I found an edge case which causes an exception to be swallowed while cancelling the stream.
The following snippet prints () which was pretty unexpected for me. I would have expected the stream to throw the RuntimeException or at least Stream.never to block the stream forever.

import cats.effect.{IO, IOApp}
import fs2.Stream

object Fs2Bug extends IOApp.Simple {
  override def run: IO[Unit] =
    Stream
      .raiseError[IO](new RuntimeException())
      .spawn
      .flatMap(_ => Stream.never[IO])
      .compile
      .resource
      .drain
      .allocated
      .map { case (r, _) => println(r) }
}

I tested this with v3.10.2 and v3.11.0

@lhns lhns added the bug label Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant