Closed ValdemarGr closed 2 months ago
Thanks! Fix looks good. Would really like a test case for this though. Maybe something based on your minimization?
I've added a test.
I tried to use a seeded TestControl
and make it property based, but it was still flaky and much slower.
I minimized a bug I had to this.
The
Ref
will sometimes not contain 0. I tried the same test with the following fix and it does not occur anymore.Explanation (or rather my hypothesis)
If cancellation of the stream occurs between
state.modify
and the subsequentflatMap
then the scope's state isClosed
, thus when the root scope is cancelled and traverses the scope tree, the node is nowClosed
, but the finalizers for the attached resources were never run.I can't seem to come up with a good test for this.