-
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
Fix in-place save for DefaultSessionResumptionStorage #23168
Merged
andy31415
merged 2 commits into
project-chip:v1.0-branch
from
msandstedt:cherry-pick-23062
Oct 13, 2022
Merged
Fix in-place save for DefaultSessionResumptionStorage #23168
andy31415
merged 2 commits into
project-chip:v1.0-branch
from
msandstedt:cherry-pick-23062
Oct 13, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…3062) Nodes that already exist in the DefaultSessionResumptionStorage index are consuming additional entries in the index on save, and aren't cleaned from the link and state tables first. This has the following consequences: 1. If session resumption storage is full, this causes unnecessary eviction of records for other nodes. 2. This pulls the index out of sync from the backing state table because duplicate entries in the index for a given node only map to a single node-id-keyed entry in the state table. 3. An entry in the link table is leaked on each occurrence, as the resumption-id-keyed link entry will be orphaned once its associated state table entry is overwritten. A symptom of this can be seen in the DeleteAll(FabricIndex fabricIndex) method, which will often log errors due to the index being out of sync form the state table. This commit fixes the problem by first deleting the link table entry before saving a record for a node that already exists in the table. Save is also simplified in this case by not rewriting the index, as the node is already in the index. To prevent future problems, unit test code has been added for DefaultSessionResumptionStorage to verify that DeleteAll is completing without errors and that no link or state table entries are leaked. (cherry picked from commit f6d585a)
) Apply suggestions per bzbarsky-apple (cherry picked from commit 2a1cf85)
Damian-Nordic
approved these changes
Oct 13, 2022
PR #23168: Size comparison from 37d5bb9 to 7f8ead5 Increases (30 builds for bl602, bl702, cc13x2_26x2, cyw30739, k32w, linux, mbed, nrfconnect, psoc6, qpg, telink)
Decreases (6 builds for cc13x2_26x2)
Full report (30 builds for bl602, bl702, cc13x2_26x2, cyw30739, k32w, linux, mbed, nrfconnect, psoc6, qpg, telink)
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Nodes that already exist in the DefaultSessionResumptionStorage index
are consuming additional entries in the index on save, and aren't
cleaned from the link and state tables first. This has the following
consequences:
eviction of records for other nodes.
because duplicate entries in the index for a given node only
map to a single node-id-keyed entry in the state table.
resumption-id-keyed link entry will be orphaned once its associated
state table entry is overwritten.
A symptom of this can be seen in the DeleteAll(FabricIndex fabricIndex)
method, which will often log errors due to the index being out of sync
form the state table.
This commit fixes the problem by first deleting the link table entry
before saving a record for a node that already exists in the table.
Save is also simplified in this case by not rewriting the index, as
the node is already in the index.
To prevent future problems, unit test code has been added for
DefaultSessionResumptionStorage to verify that DeleteAll is completing
without errors and that no link or state table entries are leaked.
Fixes #23044