Azure / azure-sdk-for-rust

This repository is for active development of the *unofficial* Azure SDK for Rust. This repository is *not* supported by the Azure SDK team.
MIT License
692 stars 237 forks source link

sleep method in azure-core has a race and causes deadlock #1515

Closed msabansal closed 8 months ago

msabansal commented 8 months ago

The sleep method can be better written and it currently suffers from a race that causes a deadlock.

Minimal repro

tracing::info!("Starting tasks"); let mut join_set = JoinSet::default(); for _i in 0..50 { join_set.spawn(async move { for _i in 0..10 { azure_core::sleep(Duration::from_millis(100)).await; } }); } while let Some(_) = join_set.join_next().await { } tracing::info!("Tasks done");