Skip to content

Stop DeleteSpammer from freezing the daemon while pausing a running spammer - #275

Draft
damilolaedwards wants to merge 1 commit into
ethpandaops:masterfrom
damilolaedwards:fix/deletespammer-lock-freeze
Draft

Stop DeleteSpammer from freezing the daemon while pausing a running spammer#275
damilolaedwards wants to merge 1 commit into
ethpandaops:masterfrom
damilolaedwards:fix/deletespammer-lock-freeze

Conversation

@damilolaedwards

Copy link
Copy Markdown
Contributor

Summary

  • Deleting a running spammer called Pause while still holding the spammer map lock for write, and Pause can block for up to 10 seconds waiting for the scenario to notice cancellation. Every other reader, including fetching a single spammer or listing all of them, froze for that entire window since they all need the same lock.
  • Released the lock around the Pause call and reacquired it afterward, matching the pattern already used for group deletes. Since the lock is briefly released, a concurrent delete of the same spammer could finish in the meantime, so added a recheck that the entry is still present before continuing.

Test plan

  • Added a test confirming a read no longer blocks while a delete is paused inside Pause.
  • Added a test confirming the reacquire recheck returns cleanly when a concurrent delete already removed the entry.
  • Both verified to fail against the previous behavior and pass with the fix, under -race.

…pammer

Deleting a running spammer called Pause while still holding the
spammerMapMtx write lock, and Pause can block for up to 10 seconds
waiting for the scenario to notice cancellation. Every other reader,
including GetSpammer and GetAllSpammers, would freeze for that entire
window since they all need the same lock.

Release the lock around the Pause call and reacquire it afterward,
mirroring the pattern already used for group deletes. Since the lock
is briefly released, a concurrent delete of the same id could finish
in the meantime, so recheck that the entry is still present before
continuing.

Added tests covering both the freeze itself and the reacquire race.
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