From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [RFC proxmox-backup] proxy: avoid exiting connection acceptor loop in error case
Date: Thu, 7 Aug 2025 17:41:30 +0200 [thread overview]
Message-ID: <20250807154130.130646-1-c.ebner@proxmox.com> (raw)
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@proxmox.com>
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Tested-by: Stefan Hanreich <s.hanreich@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
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
next reply other threads:[~2025-08-07 15:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-07 15:41 Christian Ebner [this message]
2025-08-07 16:58 ` [pbs-devel] applied: " Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250807154130.130646-1-c.ebner@proxmox.com \
--to=c.ebner@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox