Skip to content

.NET SDK: stop GetFolders from hanging on a folder parent cycle (KSM-1280) - #1329

Open
stas-schaller wants to merge 1 commit into
release/sdk/dotnet/core/v18.0.0from
feature/KSM-1280-dotnet-folder-parent-cycle
Open

stas-schaller wants to merge 1 commit into
release/sdk/dotnet/core/v18.0.0from
feature/KSM-1280-dotnet-folder-parent-cycle

Conversation

@stas-schaller

Copy link
Copy Markdown
Collaborator

Summary

.NET SDK: GetFolders() no longer hangs when the folder data from the server contains a parent cycle.
Before this change, walking the parent chain of a folder that is its own ancestor never ended.

Changes

Fixed

  • The walk to the shared folder key records each UID it visits. It stops when a UID repeats, for a cycle of any length, including a folder that names itself as its parent (KSM-1280).
  • The folder is skipped, as an undecryptable folder already is, and the call returns the other folders. The line on standard error names only the UID where the cycle closes and says "cycle", so it differs from a missing parent. It holds no folder name or key data (KSM-1280).

A folder tree without a cycle reads as before.

Testing

cd sdk/dotNet && dotnet test SecretsManager.Test.Core --filter "FullyQualifiedName~FolderParentCycle"

The tests cover cycles of length 1, 2 and 3, a missing parent, and a normal tree. Each runs GetFolders with a 5 second limit, so a hang fails the test and does not block it.
Three of the five fail on the unfixed code. Removing the cycle check, treating every parent as a cycle, and dropping the word "cycle" from the message each fail at least one test.

Breaking Changes

None.

Related Issues

  • Jira: KSM-1280

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant