* [pdm-devel] [PATCH] api server: make incoming connection handling robust
@ 2025-08-08 8:26 Fabian Grünbichler
2025-08-08 11:11 ` [pdm-devel] applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Fabian Grünbichler @ 2025-08-08 8:26 UTC (permalink / raw)
To: pdm-devel
breaking from this loop when encountering an error means no longer accepting
new connections, and must be avoided at all costs.
this matches the changes in proxmox-backup-server for the same issue.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
server/src/bin/proxmox-datacenter-api/main.rs | 16 ++++++++++------
.../bin/proxmox-datacenter-privileged-api.rs | 18 ++++++++++++++----
2 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/server/src/bin/proxmox-datacenter-api/main.rs b/server/src/bin/proxmox-datacenter-api/main.rs
index e92232e..db6b258 100644
--- a/server/src/bin/proxmox-datacenter-api/main.rs
+++ b/server/src/bin/proxmox-datacenter-api/main.rs
@@ -278,13 +278,17 @@ async fn run(debug: bool) -> 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 insecure connection: {err:?}"); }
+ Err(err) => { log::warn!("Failed to accept secure connection: {err:?}"); }
}
},
_shutdown = proxmox_daemon::shutdown_future() => {
diff --git a/server/src/bin/proxmox-datacenter-privileged-api.rs b/server/src/bin/proxmox-datacenter-privileged-api.rs
index b62f4ea..66033eb 100644
--- a/server/src/bin/proxmox-datacenter-privileged-api.rs
+++ b/server/src/bin/proxmox-datacenter-privileged-api.rs
@@ -181,10 +181,20 @@ async fn run() -> Result<(), Error> {
loop {
tokio::select! {
incoming = listener.accept() => {
- let (conn, _) = incoming?;
- let api_service = rest_server.api_service(&conn)?;
- let watcher = graceful.watcher();
- tokio::spawn(async move { api_service.serve(conn, Some(watcher)).await });
+ match incoming {
+ Ok((conn, _)) => {
+ 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:?}"),
+ };
},
_shutdown = proxmox_daemon::shutdown_future() => {
break;
--
2.47.2
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* [pdm-devel] applied: [PATCH] api server: make incoming connection handling robust
2025-08-08 8:26 [pdm-devel] [PATCH] api server: make incoming connection handling robust Fabian Grünbichler
@ 2025-08-08 11:11 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2025-08-08 11:11 UTC (permalink / raw)
To: pdm-devel, Fabian Grünbichler
On Fri, 08 Aug 2025 10:26:26 +0200, Fabian Grünbichler wrote:
> breaking from this loop when encountering an error means no longer accepting
> new connections, and must be avoided at all costs.
>
> this matches the changes in proxmox-backup-server for the same issue.
>
>
Applied, thanks!
[1/1] api server: make incoming connection handling robust
commit: 66eb9a0514fc368dc914e89606ba2d9bebd700e8
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-08 11:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-08 8:26 [pdm-devel] [PATCH] api server: make incoming connection handling robust Fabian Grünbichler
2025-08-08 11:11 ` [pdm-devel] applied: " Thomas Lamprecht
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.