Skip to content
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

Make RWLock Write-Preferring #6

Merged
merged 2 commits into from
Dec 28, 2021
Merged

Make RWLock Write-Preferring #6

merged 2 commits into from
Dec 28, 2021

Conversation

CMCDragonkai
Copy link
Member

@CMCDragonkai CMCDragonkai commented Dec 28, 2021

Description

Right now the RWLock based on https://gist.github.com/CMCDragonkai/4de5c1526fc58dac259e321db8cf5331 is read-preferring.

This means on blocking methods, such as the compose method in the networking domain, concurrent pressure can starve the stop operation.

Changing to write-preferring RWLock allows us to ensure that we can call stop and interrupt any of the blocking decorated methods. This is more robust for denial of service and preventing long-shutdowns.

Any other concurrent calls should then throw an exception once stop has interrupted them.

Note that this is not the same as the abort signal. Calling stop cannot abort asynchronous operations atm. Any locked async operation is still waited to be completed.

Aborting would require more study and research in MatrixAI/Polykey#297

Issues Fixed

Tasks

  1. Upgraded the RWLock to write-preferring
  2. Tested the RWLock
  3. Added stop or destroy interruption tests to class decorators

Final checklist

  • Domain specific tests
  • Full tests
  • Updated inline-comment documentation
  • Lint fixed
  • Squash and rebased
  • Sanity check the final build

@CMCDragonkai CMCDragonkai self-assigned this Dec 28, 2021
@CMCDragonkai CMCDragonkai merged commit 893998c into master Dec 28, 2021
@CMCDragonkai CMCDragonkai deleted the rwlock-writer-biased branch December 28, 2021 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant