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
While going through the tutorial Producer consumer with taking care of cancellation I noticed that the code provided in the example terminates with a java.lang.OutOfMemoryError. The timing of the error's occurrence may vary depending on the XmxVM option, but the error still occurs nonetheless.
I'm trying to understand whether this is the expected behavior and whether I should avoid using IO.uncancelable in recursive code, or if it's a BUG?
If this is the expected behaviour, it seems strange that the Typelevel website showcases an example implementation of a producer and consumer that eventually leads to an out-of-memory error due to memory overflow.
IMHO at least the behaviour should be mentioned in the tutorial.
Below is an example code that includes two programs. badProgram leads to an java.lang.OutOfMemoryError when using IO.uncancelable in recursive function, while the goodProgram works indefinitely without a loss in performance until manually terminated.
Time: 1710428772216. Counter: 33400000
Time: 1710428772267. Counter: 33500000
2024-03-14T15:06:13.650Z [WARNING] Your app's responsiveness to a new asynchronous event (such as a new connection, an upstream response, or a timer) was in excess of 100 milliseconds. Your CPU is probably starving. Consider increasing the granularity of your delays or adding more cedes. This may also be a sign that you are unintentionally running blocking I/O operations (such as File or InetAddress) without the blocking combinator.
java.lang.OutOfMemoryError: Java heap space
at cats.effect.ByteStack$.growIfNeeded(ByteStack.scala:48)
at cats.effect.ByteStack$.push(ByteStack.scala:56)
at cats.effect.IOFiber.runLoop(IOFiber.scala:582)
at cats.effect.IOFiber.autoCedeR(IOFiber.scala:1423)
at cats.effect.IOFiber.run(IOFiber.scala:119)
at cats.effect.unsafe.WorkerThread.run(WorkerThread.scala:743)
The text was updated successfully, but these errors were encountered:
Version of cats-effect: 3.5.4
While going through the tutorial Producer consumer with taking care of cancellation I noticed that the code provided in the example terminates with a
java.lang.OutOfMemoryError
. The timing of the error's occurrence may vary depending on theXmx
VM option, but the error still occurs nonetheless.I'm trying to understand whether this is the expected behavior and whether I should avoid using
IO.uncancelable
in recursive code, or if it's a BUG?If this is the expected behaviour, it seems strange that the Typelevel website showcases an example implementation of a producer and consumer that eventually leads to an out-of-memory error due to memory overflow.
IMHO at least the behaviour should be mentioned in the tutorial.
Below is an example code that includes two programs. badProgram leads to an
java.lang.OutOfMemoryError
when usingIO.uncancelable
in recursive function, while the goodProgram works indefinitely without a loss in performance until manually terminated.Code example - https://scastie.scala-lang.org/bjx9e0WsRq20XTxUprnCsg
Error output:
The text was updated successfully, but these errors were encountered: