public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] sync job: pull: avoid blocking future during thread pool completion
@ 2025-10-09  9:20 Christian Ebner
  2025-10-14 11:26 ` Fabian Grünbichler
  2025-10-14 11:55 ` [pbs-devel] superseded: " Christian Ebner
  0 siblings, 2 replies; 4+ messages in thread
From: Christian Ebner @ 2025-10-09  9:20 UTC (permalink / raw)
  To: pbs-devel

Chunk insertion during a pull sync job is performed via a thread pool
to increase performance. The caller waits for all threads to be
completed at the end, relying on the respective associated threads to
return from `std::thread::JoinHandle::join`.

Insertion into the chunk store can however take time, especially
for chunks being uploaded to the object store for datastores with
S3 backend.

To avoid blocking the async runtime, spawn a dedicated task to await
the thread pool completion.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
Encountered while looking for possible causes of proxy hangs as reported
in https://forum.proxmox.com/threads/171422/post-807098

 src/server/pull.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/server/pull.rs b/src/server/pull.rs
index 08e6e6b64..53f1a570d 100644
--- a/src/server/pull.rs
+++ b/src/server/pull.rs
@@ -232,7 +232,7 @@ async fn pull_index_chunks<I: IndexFile>(
 
     drop(verify_and_write_channel);
 
-    verify_pool.complete()?;
+    let _ = tokio::task::spawn_blocking(|| verify_pool.complete()).await?;
 
     let elapsed = start_time.elapsed()?;
 
-- 
2.47.3



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pbs-devel] [PATCH proxmox-backup] sync job: pull: avoid blocking future during thread pool completion
  2025-10-09  9:20 [pbs-devel] [PATCH proxmox-backup] sync job: pull: avoid blocking future during thread pool completion Christian Ebner
@ 2025-10-14 11:26 ` Fabian Grünbichler
  2025-10-14 11:39   ` Christian Ebner
  2025-10-14 11:55 ` [pbs-devel] superseded: " Christian Ebner
  1 sibling, 1 reply; 4+ messages in thread
From: Fabian Grünbichler @ 2025-10-14 11:26 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion

On October 9, 2025 11:20 am, Christian Ebner wrote:
> Chunk insertion during a pull sync job is performed via a thread pool
> to increase performance. The caller waits for all threads to be
> completed at the end, relying on the respective associated threads to
> return from `std::thread::JoinHandle::join`.
> 
> Insertion into the chunk store can however take time, especially
> for chunks being uploaded to the object store for datastores with
> S3 backend.
> 
> To avoid blocking the async runtime, spawn a dedicated task to await
> the thread pool completion.
> 
> Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
> ---
> Encountered while looking for possible causes of proxy hangs as reported
> in https://forum.proxmox.com/threads/171422/post-807098
> 
>  src/server/pull.rs | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/server/pull.rs b/src/server/pull.rs
> index 08e6e6b64..53f1a570d 100644
> --- a/src/server/pull.rs
> +++ b/src/server/pull.rs
> @@ -232,7 +232,7 @@ async fn pull_index_chunks<I: IndexFile>(
>  
>      drop(verify_and_write_channel);
>  
> -    verify_pool.complete()?;
> +    let _ = tokio::task::spawn_blocking(|| verify_pool.complete()).await?;

doesn't this change error handling semantics? the inner Result is no
longer handled, AFAICT..

>  
>      let elapsed = start_time.elapsed()?;
>  
> -- 
> 2.47.3
> 
> 
> 
> _______________________________________________
> pbs-devel mailing list
> pbs-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
> 
> 
> 


_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pbs-devel] [PATCH proxmox-backup] sync job: pull: avoid blocking future during thread pool completion
  2025-10-14 11:26 ` Fabian Grünbichler
@ 2025-10-14 11:39   ` Christian Ebner
  0 siblings, 0 replies; 4+ messages in thread
From: Christian Ebner @ 2025-10-14 11:39 UTC (permalink / raw)
  To: Fabian Grünbichler, Proxmox Backup Server development discussion

On 10/14/25 1:25 PM, Fabian Grünbichler wrote:
> On October 9, 2025 11:20 am, Christian Ebner wrote:
>> Chunk insertion during a pull sync job is performed via a thread pool
>> to increase performance. The caller waits for all threads to be
>> completed at the end, relying on the respective associated threads to
>> return from `std::thread::JoinHandle::join`.
>>
>> Insertion into the chunk store can however take time, especially
>> for chunks being uploaded to the object store for datastores with
>> S3 backend.
>>
>> To avoid blocking the async runtime, spawn a dedicated task to await
>> the thread pool completion.
>>
>> Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
>> ---
>> Encountered while looking for possible causes of proxy hangs as reported
>> in https://forum.proxmox.com/threads/171422/post-807098
>>
>>   src/server/pull.rs | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/server/pull.rs b/src/server/pull.rs
>> index 08e6e6b64..53f1a570d 100644
>> --- a/src/server/pull.rs
>> +++ b/src/server/pull.rs
>> @@ -232,7 +232,7 @@ async fn pull_index_chunks<I: IndexFile>(
>>   
>>       drop(verify_and_write_channel);
>>   
>> -    verify_pool.complete()?;
>> +    let _ = tokio::task::spawn_blocking(|| verify_pool.complete()).await?;
> 
> doesn't this change error handling semantics? the inner Result is no
> longer handled, AFAICT..

Oh, you are right! This now only covers the JoinError... Will send a v2 
fixing this shortly.


_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pbs-devel] superseded: [PATCH proxmox-backup] sync job: pull: avoid blocking future during thread pool completion
  2025-10-09  9:20 [pbs-devel] [PATCH proxmox-backup] sync job: pull: avoid blocking future during thread pool completion Christian Ebner
  2025-10-14 11:26 ` Fabian Grünbichler
@ 2025-10-14 11:55 ` Christian Ebner
  1 sibling, 0 replies; 4+ messages in thread
From: Christian Ebner @ 2025-10-14 11:55 UTC (permalink / raw)
  To: pbs-devel

superseded-by version 2:
https://lore.proxmox.com/pbs-devel/20251014115429.495501-1-c.ebner@proxmox.com/T/


_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-10-14 11:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-09  9:20 [pbs-devel] [PATCH proxmox-backup] sync job: pull: avoid blocking future during thread pool completion Christian Ebner
2025-10-14 11:26 ` Fabian Grünbichler
2025-10-14 11:39   ` Christian Ebner
2025-10-14 11:55 ` [pbs-devel] superseded: " Christian Ebner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal