Skip to content
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

Darwin subscribeAttribute APIs leak #22333

Closed
bzbarsky-apple opened this issue Sep 1, 2022 · 2 comments · Fixed by #23061
Closed

Darwin subscribeAttribute APIs leak #22333

bzbarsky-apple opened this issue Sep 1, 2022 · 2 comments · Fixed by #23061

Comments

@bzbarsky-apple
Copy link
Contributor

bzbarsky-apple commented Sep 1, 2022

Problem

See #22323 (comment)

Basically, using the ReadInteraction SubscribeAttribute API (via CHIPCluster in this case) means that there is no way to free the callback context (except on errors), because it never delivers OnDone.

In particular, this means that if you shut down and restart the stack the subscription will be dead in the water but its associated memory will be leaked.

This has been a problem all along, but it got highlighted in #22323 because we started freeing the ReadClient (but not the callback context) and now LSan can detect the leak. I assume that it couldn't before because it can't detect leaks of objects that reference each other; it thinks they are referenced from allocated memory....

Proposed Solution

Either fix the ReadInteraction and CHIPCluster API to allow passing in an OnDone callback for subscriptions or stop using them altogether and use ReadClient directly.

Or remove the Darwin subscribeAttribute APIs.

@bzbarsky-apple
Copy link
Contributor Author

When this is fixed, we should remove the relevant suppression in scripts/tests/chiptest/lsan-mac-suppressions.txt.

@jtung-apple
Copy link
Contributor

Darwin: moving to v1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants