You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This might be specific to unsafeToFuture, but closing a Dispatcher runs all queued tasks and does so concurrently, which was even more alarming for sequential, as seen below.
val (dispatcher, cancel) = Dispatcher.sequential[IO].allocated.unsafeRunSync()
val buffer = ArrayBuffer[Int]()
for (i <- 0 to 99) {
dispatcher.unsafeToFuture(IO(buffer += i))
}
cancel.unsafeRunSync() // buffer stays ordered if this line is removed (or the dispatcher finished already)
A test case in my code that initially hinted at this unexpected behavior was the following:
val (dispatcher, cancel) = Dispatcher.sequential[IO].allocated.unsafeRunSync()
dispatcher.unsafeToFuture(IO.never)
dispatcher.unsafeToFuture(IO.println("this runs when the dispatcher is closed"))
cancel.unsafeToFuture()
3.4.8 is the last version that behaves as expected.
This seems similar to #3945, but the problem seemed to go farther back, possibly to #3510.
The text was updated successfully, but these errors were encountered:
Thanks for reporting! Note that we've got a significant rewrite of Dispatcher in flight which should hopefully fix this and many other bugs (but I have not verified this yet).
Wow this is amazing. I don't have any intuition about how this is happening, and I kinda don't want to. :P The rewrite definitely doesn't have this issue.
This might be specific to
unsafeToFuture
, but closing aDispatcher
runs all queued tasks and does so concurrently, which was even more alarming forsequential
, as seen below.A test case in my code that initially hinted at this unexpected behavior was the following:
3.4.8 is the last version that behaves as expected.
This seems similar to #3945, but the problem seemed to go farther back, possibly to #3510.
The text was updated successfully, but these errors were encountered: