fix(service/sending): Restart crashed sender workers and resend queued backlogs #2545
No reviewers
Labels
No labels
Abandoned
Blocked
Bug
Changelog
Added
Changelog
Missing
Changelog
None
Cherry-picking
Compliance
Continuwuity/Web Interface
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
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
continuwuation/continuwuity!2545
Loading…
Reference in a new issue
No description provided.
Delete branch "eleboucher/continuwuity:fix/sender-supervision"
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?
Signed-off-by: Erwan Leboucher erwanleboucher@gmail.com
Restart crashed sender workers with backoff, drop transactions that panic instead of blaming the remote, and resend queued backlogs on startup.
Pull request checklist:
mainbranch, and the branch is named something other thanmain.myself, if applicable. This includes ensuring code compiles.
I've slept since I started this review (oops) but I think this is fine for the most part
@ -88,2 +96,4 @@const EDU_BUF_CAP: usize = 128;const EDU_VEC_CAP: usize = 1;const WORKER_RESTART_DELAY: Duration = Duration::from_millis(2500);const WORKER_RESTART_DELAY_MAX: Duration = Duration::from_secs(300);5 minutes is probably quite high, I think 30 seconds is a good upper bound even if quite tight (keep in mind federation to specific remotes is non-functional if their respective shards are down)
@ -140,0 +171,4 @@failures[shard].saturating_add(1)};let delay = restart_delay(failures[shard]);error!(shard, ?ret, ?delay, "sender worker stopped, restarting");nit: "sender worker crashed" or "sender worker unexpectedly finished" probably conveys that the situation isn't expected better
@ -145,0 +158,4 @@self.handle_response_ok(&dest, futures, statuses).await;},// A bug on our side, not the remote's fault, and resending the same// events would panic again: drop them and move on.I don't like the idea of outright dropping events, there's no guarantee that retrying will panic again. I think we'll need more information on the source of any panics before taking drastic action like this
@ -301,3 +320,2 @@let entry = txns.entry(dest.clone()).or_default();let over_budget =self.server.config.startup_netburst_keep >= 0 && entry.len() >= keep;let over_budget = !restartedngl I think netbursting on worker restart doesn't sound too bad of an idea, I'm not sure it should explicitly be skipped
bdf0adfeacb9b34fed9cI just pushed changes but it should fix some bugs