[pbs-devel] [RFC proxmox-backup] proxy: avoid exiting connection acceptor loop in error case
Christian Ebner
c.ebner at proxmox.com
Thu Aug 7 17:41:30 CEST 2025
The proxy waits for incoming connections passed along from the REST
server inside a loop. If the REST server api_service call however
failed with error, the loop was incorrectly exited. Therefore no
further connections could be accepted.
To fix this, handle the error case gracefully and avoid exiting the
loop.
The error case can be easily triggered by a HAProxy health check
using the following backend config.
```
backend pbs
server pbs <PBS-IP>:8007 check ssl verify none
```
Fixes: https://forum.proxmox.com/threads/169313/
Co-Developed-by: Stefan Hanreich <s.hanreich at proxmox.com>
Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
Tested-by: Stefan Hanreich <s.hanreich at proxmox.com>
---
Sending this as RFC as it is a rather critical issue and therefore
warrants some more feedback. Also, it is not totally clear to me if
this fixes all the issues as repoted by the users in the community
forum.
src/bin/proxmox-backup-proxy.rs | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/bin/proxmox-backup-proxy.rs b/src/bin/proxmox-backup-proxy.rs
index 22b545571..cfd93f928 100644
--- a/src/bin/proxmox-backup-proxy.rs
+++ b/src/bin/proxmox-backup-proxy.rs
@@ -306,11 +306,15 @@ async fn run() -> Result<(), Error> {
Some(conn) = secure_connections.next() => {
match conn {
Ok(conn) => {
- let api_service = rest_server.api_service(&conn)?;
- let watcher = graceful.watcher();
- tokio::spawn(async move {
- api_service.serve(conn, Some(watcher)).await
- });
+ match rest_server.api_service(&conn) {
+ Ok(api_service) => {
+ let watcher = graceful.watcher();
+ tokio::spawn(async move {
+ api_service.serve(conn, Some(watcher)).await
+ });
+ }
+ Err(err) => log::warn!("Failed to get api service: {err:?}"),
+ }
},
Err(err) => { log::warn!("Failed to accept secure connection: {err:?}"); }
}
--
2.47.2
More information about the pbs-devel
mailing list