Closed taoeffect closed 2 months ago
It looks like this issue was introduced by moving the call to /release
into the leaveChatRoom
file. This is most certainly incorrect, because that function is called 'optimistically' in the side-effect, meaning that it could potentially be called multiple times. In addition, it's better architecturally for the call to /release
to be made by the group contract, as it's the one 'managing' references to the chatroom contract (i.e., the one that called /retain
on it).
I see there were other changes related to reference counting (such as excluding ourselves). I see those were made to fix issues, but I'll investigate further as it shouldn't be needed to check for ourselves. These types of bugs (negative counts) can indicate issues with reference counting in general or faulty reference management logic. I'll be investigating these issues.
Problem
Solution
Don't know how this snuck in...