Skip to content

Conversation

@AkramBitar
Copy link
Contributor

Summary

Fixes resource leak in CollectEndorsementsView by ensuring Done() is called on all external wallet signers even when errors occur during signature collection.

Changes

  • Added defer-based cleanup in Call() method
  • Extracted cleanup logic to CleanupExternalWallets() method
  • Added comprehensive unit tests for cleanup behavior

See #1228

@AkramBitar AkramBitar added this to the Q1/26 milestone Jan 20, 2026
@AkramBitar AkramBitar self-assigned this Jan 20, 2026
@AkramBitar AkramBitar added bug Something isn't working performance labels Jan 20, 2026
@AkramBitar AkramBitar marked this pull request as draft January 20, 2026 11:08
@AkramBitar AkramBitar linked an issue Jan 20, 2026 that may be closed by this pull request
@AkramBitar AkramBitar force-pushed the fix/external-wallet-cleanup branch from adf3ca8 to 2f2a158 Compare January 20, 2026 11:08
Use defer to guarantee that Done() is called on all external wallet signers
regardless of whether errors occur during signature collection, auditing,
or approval phases. This prevents resource leaks when the endorsement
process fails early.

Previously, if requestSignaturesOnIssues or requestSignaturesOnTransfers
returned an error, any external wallets already added to the map would
not have their Done() method called, potentially leaving resources uncleaned.

Signed-off-by: AkramBitar <akram@il.ibm.com>
@AkramBitar AkramBitar force-pushed the fix/external-wallet-cleanup branch from bffa8ba to 3e665a1 Compare January 20, 2026 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CollectEndorsementsView might not release all resources

2 participants