typelevel / cats-effect

The pure asynchronous runtime for Scala
https://typelevel.org/cats-effect/
Apache License 2.0
2.02k stars 515 forks source link

Hotswap#get scaladoc/impl mismatch #3840

Closed durban closed 12 months ago

durban commented 1 year ago

The scaladoc of Hotswap#get says that "The returned resource is guaranteed to be available for the duration of the returned resource". I don't think this is true: if the whole Hotswap is finalized, the "returned resource" will be finalized too (here: https://github.com/typelevel/cats-effect/blob/a6c5b155be3b729af49eb26204e101f2d527fa80/std/shared/src/main/scala/cats/effect/std/Hotswap.scala#L116).

I think either the scaladoc or the implementation should be changed. (Probably the scaladoc, although I've never used Hotswap.)

armanbilge commented 1 year ago

Thanks, that's actually a bug. We should make sure to acquire an exclusive lock before finalizing.

durban commented 12 months ago

Fixed by #3841.