-
Notifications
You must be signed in to change notification settings - Fork 605
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
parEvalMap* runs resource finaliser before usage #3076
Comments
@diesalbla identified the issue to here: fs2/core/shared/src/main/scala/fs2/Stream.scala Line 2201 in 57032ff
The problem is if the I am not sure if there is Stream.resource(background.compile.resource.something).flatMap { _ =>
foreground ...
} The precise details are a bit fuzzy :) |
@armanbilge If possible, I would like to work on this issue. |
Unfortunately, I haven't been able to make any noticable progression with the ticket since I picked it up. This is why I will unassign myself from it. |
another incarnation of the problem is fs2.Stream.bracket {
IO.println("making resource").as("TempFile")
} { res =>
IO.println(s"!! releasing resource: $res")
}
.broadcastThrough[IO, Unit](
(s: fs2.Stream[IO, String]) => s.evalMap(s => IO.sleep(20.millis) *> IO.println(s"1 using $s")),
(s: fs2.Stream[IO, String]) => s.evalMap(s => IO.sleep(30.millis) *> IO.println(s"2 using $s")),
)
.compile
.drain
.unsafeRunSync()
|
Updates parEvalMap* and broadcastThrough to extend the resource scope past the channel/topic used to implement concurrency for these operators.
Updates parEvalMap* and broadcastThrough to extend the resource scope past the channel/topic used to implement concurrency for these operators.
Found by: @lavrov
Original message
Example:
Expected logs:
Actual logs:
The text was updated successfully, but these errors were encountered: