mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-19 00:00:09 +02:00
In some cases, a cycle is created between I/O driver wakers and the I/O driver resource slab. This patch clears stored wakers when an I/O resource is dropped, breaking the cycle. Fixes #3228
22 lines
528 B
Rust
22 lines
528 B
Rust
use futures::future::poll_fn;
|
|
|
|
fn main() {
|
|
let rt = tokio::runtime::Builder::new_multi_thread()
|
|
.worker_threads(1)
|
|
.enable_io()
|
|
.build()
|
|
.unwrap();
|
|
|
|
rt.block_on(async {
|
|
let listener = tokio::net::TcpListener::bind("0.0.0.0:0").await.unwrap();
|
|
tokio::spawn(async move {
|
|
loop {
|
|
poll_fn(|cx| listener.poll_accept(cx)).await.unwrap();
|
|
}
|
|
});
|
|
});
|
|
|
|
std::thread::sleep(std::time::Duration::from_millis(50));
|
|
drop(rt);
|
|
}
|