Compare commits

..

10 commits

Author SHA1 Message Date
Jade Ellis
95610499c7
chore: Disable direnv's nix flake interfering with cargo cache
Some checks failed
Release Docker Image / build-image (linux/amd64, release, linux-amd64, base) (push) Has been skipped
Release Docker Image / build-image (linux/arm64, release, linux-arm64, base) (push) Has been skipped
Release Docker Image / merge (push) Has been skipped
Documentation / Build and Deploy Documentation (push) Has been skipped
Checks / Prefligit / prefligit (push) Failing after 5s
Release Docker Image / define-variables (push) Failing after 3s
Checks / Rust / Format (push) Failing after 5s
Checks / Rust / Clippy (push) Failing after 30s
Checks / Rust / Cargo Test (push) Failing after 28s
2025-07-20 16:36:01 +01:00
Jade Ellis
f593cac58a
feat: Enable hardware-lock-elision and deadlock_detection 2025-07-20 16:35:59 +01:00
Jade Ellis
1c985c59f5
refactor: Allow with_lock to return data and take an async closure 2025-07-20 16:34:48 +01:00
Jade Ellis
b635e825d2
refactor: Implement with_lock for lock_api 2025-07-20 16:34:36 +01:00
Jade Ellis
6d29098d1a
refactor: Replace remaining std RwLocks 2025-07-20 16:33:36 +01:00
Jade Ellis
374fb2745c
refactor: Replace remaining std Mutexes 2025-07-20 16:32:48 +01:00
Jade Ellis
a1d616e3e3
refactor: Replace std RwLock with parking_lot 2025-07-20 16:31:55 +01:00
Jade Ellis
30a8c06fd9
refactor: Replace std Mutex with parking_lot 2025-07-20 16:31:02 +01:00
rooot
0631094350
docs(config): warn about federation key query timeout caveat
Signed-off-by: rooot <hey@rooot.gay>
2025-07-20 16:24:56 +01:00
rooot
9051ce63f7
feat(config): introduce federation connection timeout setting
fixes #906

Signed-off-by: rooot <hey@rooot.gay>
2025-07-20 16:24:26 +01:00
3 changed files with 25 additions and 0 deletions

View file

@ -325,6 +325,15 @@
# #
#well_known_timeout = 10 #well_known_timeout = 10
# Federation client connection timeout (seconds). You should not set this
# to high values, as dead homeservers can significantly slow down
# federation, specifically key retrieval, which will take roughly the
# amount of time you configure here given that a homeserver doesn't
# respond. This will cause most clients to time out /keys/query, causing
# E2EE and device verification to fail.
#
#federation_conn_timeout = 10
# Federation client request timeout (seconds). You most definitely want # Federation client request timeout (seconds). You most definitely want
# this to be high to account for extremely large room joins, slow # this to be high to account for extremely large room joins, slow
# homeservers, your own resources etc. # homeservers, your own resources etc.

View file

@ -412,6 +412,17 @@ pub struct Config {
#[serde(default = "default_well_known_timeout")] #[serde(default = "default_well_known_timeout")]
pub well_known_timeout: u64, pub well_known_timeout: u64,
/// Federation client connection timeout (seconds). You should not set this
/// to high values, as dead homeservers can significantly slow down
/// federation, specifically key retrieval, which will take roughly the
/// amount of time you configure here given that a homeserver doesn't
/// respond. This will cause most clients to time out /keys/query, causing
/// E2EE and device verification to fail.
///
/// default: 10
#[serde(default = "default_federation_conn_timeout")]
pub federation_conn_timeout: u64,
/// Federation client request timeout (seconds). You most definitely want /// Federation client request timeout (seconds). You most definitely want
/// this to be high to account for extremely large room joins, slow /// this to be high to account for extremely large room joins, slow
/// homeservers, your own resources etc. /// homeservers, your own resources etc.
@ -2193,6 +2204,8 @@ fn default_well_known_conn_timeout() -> u64 { 6 }
fn default_well_known_timeout() -> u64 { 10 } fn default_well_known_timeout() -> u64 { 10 }
fn default_federation_conn_timeout() -> u64 { 10 }
fn default_federation_timeout() -> u64 { 25 } fn default_federation_timeout() -> u64 { 25 }
fn default_federation_idle_timeout() -> u64 { 25 } fn default_federation_idle_timeout() -> u64 { 25 }

View file

@ -66,6 +66,7 @@ impl crate::Service for Service {
federation: base(config)? federation: base(config)?
.dns_resolver(resolver.resolver.hooked.clone()) .dns_resolver(resolver.resolver.hooked.clone())
.connect_timeout(Duration::from_secs(config.federation_conn_timeout))
.read_timeout(Duration::from_secs(config.federation_timeout)) .read_timeout(Duration::from_secs(config.federation_timeout))
.pool_max_idle_per_host(config.federation_idle_per_host.into()) .pool_max_idle_per_host(config.federation_idle_per_host.into())
.pool_idle_timeout(Duration::from_secs(config.federation_idle_timeout)) .pool_idle_timeout(Duration::from_secs(config.federation_idle_timeout))
@ -74,6 +75,7 @@ impl crate::Service for Service {
synapse: base(config)? synapse: base(config)?
.dns_resolver(resolver.resolver.hooked.clone()) .dns_resolver(resolver.resolver.hooked.clone())
.connect_timeout(Duration::from_secs(config.federation_conn_timeout))
.read_timeout(Duration::from_secs(305)) .read_timeout(Duration::from_secs(305))
.pool_max_idle_per_host(0) .pool_max_idle_per_host(0)
.redirect(redirect::Policy::limited(3)) .redirect(redirect::Policy::limited(3))
@ -81,6 +83,7 @@ impl crate::Service for Service {
sender: base(config)? sender: base(config)?
.dns_resolver(resolver.resolver.hooked.clone()) .dns_resolver(resolver.resolver.hooked.clone())
.connect_timeout(Duration::from_secs(config.federation_conn_timeout))
.read_timeout(Duration::from_secs(config.sender_timeout)) .read_timeout(Duration::from_secs(config.sender_timeout))
.timeout(Duration::from_secs(config.sender_timeout)) .timeout(Duration::from_secs(config.sender_timeout))
.pool_max_idle_per_host(1) .pool_max_idle_per_host(1)