fix: Prevent issues with locks throughout the application #2351
No reviewers
Labels
No labels
Abandoned
Blocked
Bug
Changelog
Added
Changelog
Missing
Changelog
None
Cherry-picking
Compliance
Database
Dependencies
Dependencies/Renovate
Difficulty
Easy
Difficulty
Hard
Difficulty
Medium
Documentation
Enhancement
Good first issue
Help wanted
Inherited
Matrix/Administration
Matrix/Appservices
Matrix/Auth
Matrix/Client
Matrix/Core
Matrix/E2EE
Matrix/Federation
Matrix/Hydra
Matrix/MSC
Matrix/Media
Matrix/T&S
Merge
Merge/Manual
Merge/Squash
Meta
Meta/CI
Meta/Packaging
Priority
Blocking
Priority
High
Priority
Low
Security
Status
Confirmed
Status
Duplicate
Status
Invalid
Status
Needs Investigation
Support
bob the builder
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
continuwuation/continuwuity!2351
Loading…
Reference in a new issue
No description provided.
Delete branch "jade/deadlocks"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This mainly fixes ABBA and reentrant locking in a few places, and also moves some async locks to sync locks where possible for perf reasons. It also fixes a place where erwan used the wrong lock and it got past review.
@ -80,3 +79,3 @@.stream_local_users().filter_map(async |user_id| {if self.services.appservice.is_user_id(&user_id).await {if self.services.appservice.is_user_id(&user_id) {I think this can be refactored into
@ -51,3 +47,3 @@/// Uninstall the admin command handlerpub async fn fini(admin_service: &service::admin::Service) {_ = admin_service.handle.write().await.take();_ = admin_service.handle.write().take();initandfinino longer need to be async@ -619,6 +619,9 @@ pub(crate) async fn upgrade_room_route(.await.ok();drop(old_room_state_lock);drop(new_room_state_lock);These locks are deliberately held until the end of the function from what I can tell? The space upgrade stuff will flake if the room states are mutated while it's in the middle of migrating
One of them shouldn't be acquired in the first place, see like 416, but I'll leave that to you to handle in your lock-free events PR
@ -120,65 +121,68 @@ impl Service {client_secret: &ClientSecret,send_attempt: usize,) -> Result<OwnedSessionId> {let mailer = self.services.mailer.expect_mailer()?;Why was this removed?
It wasn't, it was just moved wayyyy down to the bottom of the function
But doesn't having it right at the start mean we can short-circuit any sort of computational logic? Seems like an anti-optimisation?
Yeah, probably.
772bfdeb3a740f9ef0d6740f9ef0d6d9896d7475WIP: Attempt to fix issues with locks throughout the applicationto Attempt to fix issues with locks throughout the applicationa23c662e71c67bfb48d4c67bfb48d40f62a963d2Attempt to fix issues with locks throughout the applicationto Fix: Prevent issues with locks throughout the applicationFix: Prevent issues with locks throughout the applicationto fix: Prevent issues with locks throughout the applicationRunning in prod on ellis.link, I think this is fine
0f62a963d20ceabb4b3e