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

[BUG] DefaultSessionResumptionStorage::Save does not reuse index locations to save data for the same node #23044

Closed
msandstedt opened this issue Oct 6, 2022 · 3 comments · Fixed by #23062
Assignees
Labels
leak Memory leak bug

Comments

@msandstedt
Copy link
Contributor

msandstedt commented Oct 6, 2022

Reproduction steps

DefaultSessionResumptionStorage::Save does not reuse index locations to save data for the same node. This has a few consequences:

  1. Each subsequent session resumption write for a given node will unnecessarily evict entries for other nodes.
  2. Backing storage in the state table won't ever have more than one entry for the given node. This leaves it out of sync with the index.
  3. Most seriously, entries in the link table are leaked at each occurrence.

The leak is specifically here:

ReturnErrorOnFailure(SaveState(node, resumptionId, sharedSecret, peerCATs));

Note that the fact Delete always returns CHIP_NO_ERROR keeps eviction working. But the leak remains and is serious.

Bug prevalence

Always

GitHub hash of the SDK that was being used

fa8db56

Platform

core

Platform Version(s)

No response

Anything else?

No response

@msandstedt msandstedt self-assigned this Oct 6, 2022
@msandstedt
Copy link
Contributor Author

Oops, I think we may also be leaking storage here:

ReturnErrorOnFailure(SaveState(node, resumptionId, sharedSecret, peerCATs));

The link path is /g/s/<resumptionId>. If we delete the state entry first, the link entry is orphaned. That's pretty serious.

@bzbarsky-apple
Copy link
Contributor

We definitely leak g/s/* entries, in our testing....

@msandstedt
Copy link
Contributor Author

Yup. We do. This will slowly kill nodes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
leak Memory leak bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants