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

Stream hangs on error with broadcastThrough and readOutputStream #3502

Open
dimitriho opened this issue Nov 19, 2024 · 0 comments · May be fixed by #3505
Open

Stream hangs on error with broadcastThrough and readOutputStream #3502

dimitriho opened this issue Nov 19, 2024 · 0 comments · May be fixed by #3505
Labels

Comments

@dimitriho
Copy link

fs2 version: 3.11.0
scala version: 3.3.4

Scastie

The following code snippet throws a java.util.NoSuchElementException: None.get, which means that the stream is hanging.

I expect it to throw java.lang.Exception: boom instead.

import cats.effect.IO
import cats.effect.unsafe.implicits.global

import scala.concurrent.duration.DurationInt

fs2.Stream
  .emit[IO, Byte](1)
  .evalTap(_ => IO.raiseError(new Exception("boom")))
  .broadcastThrough(in =>
    fs2.io.readOutputStream(1) { out =>
      in.evalMap(b => IO.interruptible(out.write(b))).compile.drain
    }
  )
  .compile
  .drain
  .unsafeRunTimed(2.second)
  .get
@dimitriho dimitriho added the bug label Nov 19, 2024
@dimitriho dimitriho linked a pull request Nov 21, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant