* [pbs-devel] [RFC proxmox-backup] proxy: avoid exiting connection acceptor loop in error case
@ 2025-08-07 15:41 Christian Ebner
2025-08-07 16:58 ` [pbs-devel] applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Christian Ebner @ 2025-08-07 15:41 UTC (permalink / raw)
To: pbs-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* [pbs-devel] applied: [RFC proxmox-backup] proxy: avoid exiting connection acceptor loop in error case
2025-08-07 15:41 [pbs-devel] [RFC proxmox-backup] proxy: avoid exiting connection acceptor loop in error case Christian Ebner
@ 2025-08-07 16:58 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2025-08-07 16:58 UTC (permalink / raw)
To: pbs-devel, Christian Ebner
On Thu, 07 Aug 2025 17:41:30 +0200, Christian Ebner wrote:
> 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.
>
> [...]
Applied, great work to all involved, thanks!
[1/1] proxy: avoid exiting connection acceptor loop in error case
commit: 9cf80dc6db539a45b9160153b96d8d56427ec06e
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-07 16:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-07 15:41 [pbs-devel] [RFC proxmox-backup] proxy: avoid exiting connection acceptor loop in error case Christian Ebner
2025-08-07 16:58 ` [pbs-devel] applied: " Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox