-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ExchangeContext dispatch leak for non-application exchanges #9380
Comments
I think the intent is that the dispatch objects have some sort of "CHIP stack" lifetime, pretty much. That said, the We need to either move to a setup where dispatches are in fact singletons with "CHIP stack" lifetime or we need to figure out how to clean them up properly. That said, the quoted changes above aren't quite right either. Nulling things out in We should add a test for this. Something where an exchange that was used to send the last message of a CASE or PASE handshake is still around when the ack for that handshake comes in, but the CASESession/PASESession has been destroyed... |
You seemed to understand the problem I had laid out pretty clearly. I was actually relaying this report from somebody else. Do you know if this is still a problem? A lot of the code in this area has changed significantly for the better. |
I believe at this point the expectation is that the dispatch objects have infinite lifetime, so we can rely on them not dying. And the ones in the Matter SDK itself do that. |
Definitely can't have any known leaks in v1, so removing tag |
OK, we will review and see if we can justify closing this. Thanks @turon and @bzbarsky-apple for the input. |
Confirmed this is fixed with #12794. |
Problem
ExchangeContext::ExchangeContext() -- mDispatch is derived from mDelegate with mDelegate being set via an input argument. When exchanges are destroyed, the ExchangeContext's mDelegate is set to nullptr, but mDispatch is untouched. This will result in a crash since in all likelihood, when mDelegate is set to nullptr, it can be assumed the derived mDispatch is also destroyed as a result, but not updated.
Proposed Solution
The following workaround is effective, but the real solution is probably some generally improved lifecycle management in and around the ExchangeContext object.
This was most recently tested when applied to this rev:
The text was updated successfully, but these errors were encountered: