mirror of
https://github.com/rkivalin/certforge.git
synced 2026-10-12 16:00:45 +00:00
Fix solver startup race condition with Notify
The HTTP-01 and TLS-ALPN-01 solvers used tokio::sync::Notify to signal that the server task had started. If the spawned task called notify_waiters() before the caller registered with notified(), the notification was lost and the solver would hang indefinitely. Fix by creating the Notified future before spawning the task. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
2e2cabe19d
commit
ff83ce0ca1
@@ -6,6 +6,8 @@
|
||||
|
||||
### Fixes
|
||||
|
||||
- Fix HTTP-01 and TLS-ALPN-01 solvers sometimes hanging on startup due to a `Notify` race condition
|
||||
|
||||
### Changes
|
||||
|
||||
## 0.7.0 (2026-04-17)
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
certforge (0.8.0-1) unstable; urgency=low
|
||||
|
||||
* No changes
|
||||
* Fix HTTP-01 and TLS-ALPN-01 solvers hanging on startup
|
||||
|
||||
-- Roman Kivalin <roman@shl.dev> Thu, 17 Apr 2026 00:00:00 +0000
|
||||
|
||||
|
||||
@@ -61,6 +61,9 @@ impl Http01StandaloneSolver {
|
||||
let tokens = self.tokens.clone();
|
||||
let started = self.server_started.clone();
|
||||
|
||||
// Register the listener before spawning so we don't miss the notification
|
||||
let notified = self.server_started.notified();
|
||||
|
||||
let handle = tokio::spawn(async move {
|
||||
started.notify_waiters();
|
||||
// Spawn an accept loop for each bound listener
|
||||
@@ -93,7 +96,7 @@ impl Http01StandaloneSolver {
|
||||
}
|
||||
});
|
||||
|
||||
self.server_started.notified().await;
|
||||
notified.await;
|
||||
|
||||
Ok::<_, Error>(handle)
|
||||
}).await;
|
||||
|
||||
@@ -77,6 +77,9 @@ impl TlsAlpn01Solver {
|
||||
|
||||
let acceptor = TlsAcceptor::from(tls_config);
|
||||
|
||||
// Register the listener before spawning so we don't miss the notification
|
||||
let notified = self.server_started.notified();
|
||||
|
||||
let handle = tokio::spawn(async move {
|
||||
started.notify_waiters();
|
||||
let mut handles = Vec::new();
|
||||
@@ -99,7 +102,7 @@ impl TlsAlpn01Solver {
|
||||
}
|
||||
});
|
||||
|
||||
self.server_started.notified().await;
|
||||
notified.await;
|
||||
|
||||
Ok::<_, Error>(handle)
|
||||
}).await;
|
||||
|
||||
Reference in New Issue
Block a user