-
Notifications
You must be signed in to change notification settings - Fork 186
Open
Labels
A-coreArea: Core / deadpoolArea: Core / deadpoolenhancementNew feature or requestNew feature or requestquality of lifeImprovements to the API resulting in a better quality of life for the users of deadpool.Improvements to the API resulting in a better quality of life for the users of deadpool.
Description
Hi, small modification of retain function can lead to dead-lock.
let interval = Duration::from_secs(30);
let max_age = Duration::from_secs(60);
tokio::spawn(async move {
loop {
tokio::time::sleep(interval).await;
pool.retain(|_, metrics| {
let should_be_remove = pool.status().size > 1 && metrics.last_used() > max_age;
!should_be_removed
});
}
});Above calls self.inner.slots.lock().unwrap() twice in retain function because status() also blocks. The easiest way would be to make status lock-free. Status is already documented as not consistent so I think it should be possible to achieve.
Metadata
Metadata
Assignees
Labels
A-coreArea: Core / deadpoolArea: Core / deadpoolenhancementNew feature or requestNew feature or requestquality of lifeImprovements to the API resulting in a better quality of life for the users of deadpool.Improvements to the API resulting in a better quality of life for the users of deadpool.