Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some context to start: Cats Effects has been having memory leaks in CallbackStack since version 3.4.3. See for example: typelevel/cats-effect#3935 I've been facing this memory leak in an application using fs2-kafka, and found that I'm not the only one (typelevel/cats-effect#3973). Using a simple consumer > produce stream application, I monitored the size of the CallbackStack using the following command: ``` while sleep 1; do jcmd <pid> GC.class_histogram | grep 'cats.effect.CallbackStack$Node' ; done ``` I found that swapping the `F.race(shutdown, fetch)` for `fetch` stops the memory leak. This should not be an issue because the Stream is anyway interrupted on `.interruptWhen(F.race(shutdown, stopReqs.get).void.attempt)`, but I'm not 100% convinced of this.
- Loading branch information