Skip to content

fix(nonce): reject queued entries in NonceManager on reset/destroy to… - #593

Open
martinshub-tech wants to merge 1 commit into
conduit-protocol:mainfrom
martinshub-tech:fix-noncemanager-hang
Open

fix(nonce): reject queued entries in NonceManager on reset/destroy to…#593
martinshub-tech wants to merge 1 commit into
conduit-protocol:mainfrom
martinshub-tech:fix-noncemanager-hang

Conversation

@martinshub-tech

Copy link
Copy Markdown

Closes #511

Fix NonceManager hangs during reset() and destroy()

Description

This PR resolves an issue in NonceManager where calls to reset() or destroy() could leave waiting acquire() calls hanging indefinitely. The previous implementation cleared the lockQueue without rejecting or resolving the queued entries, which orphaned them and caused their promises to never settle. Additionally, reset() employed an unbounded busy-wait, which could hang forever if the current lock holder never released it.

Changes Made

  • destroy(): Now iterates through the lockQueue and explicitly rejects every queued entry with a NonceManager destroyed error before clearing the queue.
  • reset():
    • Added a bounded wait (up to 5 seconds) before proceeding, preventing an infinite loop if the lock is held indefinitely.
    • Iterates through the lockQueue and explicitly rejects every queued entry with a NonceManager reset error before clearing the queue.

Impact

Any caller currently awaiting acquire() will now correctly receive a rejection when the NonceManager is reset or destroyed, rather than hanging forever.

@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@martinshub-tech Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Bug: NonceManager.destroy() / reset() drop queued waiters without settling them

1 participant