cats-effect
cats-effect copied to clipboard
Racing Resource causes exception to be printed in standard error
Reproduction script (scala-cli):
//> using lib "org.typelevel::cats-effect:3.3.13"
import cats.effect.*
object Main extends IOApp.Simple:
def run =
Resource
.eval(IO.raiseError(new Exception("Boom")))
.race(Resource.never)
.attempt
.use(_ =>
IO.println("Done")
)
Running scala-cli run main.scala gives the following output:
java.lang.Exception: Boom
at Main$.run(main.scala:9)
at run$ @ Main$.run(main.scala:5)
Done
where exception stacktrace comes from standard error.
Thanks for reporting. I think this may be related to https://github.com/typelevel/cats-effect/issues/2962 and https://github.com/typelevel/cats-effect/issues/3085.
This still seems to be a problem as of 3.4.2. Maybe we can fix it as part of https://github.com/typelevel/cats-effect/pull/3226.
@armanbilge Did we work around this with the specialized race implementation?
Yup! Tried the reproducer with 3.4.2 and 3.4.3 when the new race implementation landed. The fix happened between there anyway :)