diff --git a/README.md b/README.md index a06d873ed..80f75be74 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ Make sure you activated the full features of the tokio crate on Cargo.toml: ```toml [dependencies] -tokio = { version = "1.10.0", features = ["full"] } +tokio = { version = "1.10.1", features = ["full"] } ``` Then, on your main.rs: diff --git a/tokio/CHANGELOG.md b/tokio/CHANGELOG.md index 55b120fdd..3b419570b 100644 --- a/tokio/CHANGELOG.md +++ b/tokio/CHANGELOG.md @@ -1,3 +1,11 @@ +# 1.10.1 (August 24, 2021) + +### Fixed + + - runtime: fix leak in UnownedTask ([#4063]) + +[#4063]: https://github.com/tokio-rs/tokio/pull/4063 + # 1.10.0 (August 12, 2021) ### Added diff --git a/tokio/Cargo.toml b/tokio/Cargo.toml index da8e4b694..90455fb9e 100644 --- a/tokio/Cargo.toml +++ b/tokio/Cargo.toml @@ -7,7 +7,7 @@ name = "tokio" # - README.md # - Update CHANGELOG.md. # - Create "v1.0.x" git tag. -version = "1.10.0" +version = "1.10.1" edition = "2018" authors = ["Tokio Contributors "] license = "MIT" diff --git a/tokio/README.md b/tokio/README.md index a06d873ed..80f75be74 100644 --- a/tokio/README.md +++ b/tokio/README.md @@ -56,7 +56,7 @@ Make sure you activated the full features of the tokio crate on Cargo.toml: ```toml [dependencies] -tokio = { version = "1.10.0", features = ["full"] } +tokio = { version = "1.10.1", features = ["full"] } ``` Then, on your main.rs: diff --git a/tokio/src/runtime/task/mod.rs b/tokio/src/runtime/task/mod.rs index cc3910d4b..5f0d5aba1 100644 --- a/tokio/src/runtime/task/mod.rs +++ b/tokio/src/runtime/task/mod.rs @@ -369,10 +369,16 @@ impl UnownedTask { let raw = self.raw; mem::forget(self); - // Poll the task + // Transfer one ref-count to a Task object. + let task = Task:: { + raw, + _p: PhantomData, + }; + + // Use the other ref-count to poll the task. raw.poll(); // Decrement our extra ref-count - raw.header().state.ref_dec(); + drop(task); } pub(crate) fn shutdown(self) { diff --git a/tokio/src/runtime/tests/task.rs b/tokio/src/runtime/tests/task.rs index e93a1efe6..04e1b56e7 100644 --- a/tokio/src/runtime/tests/task.rs +++ b/tokio/src/runtime/tests/task.rs @@ -111,6 +111,12 @@ fn create_shutdown2() { drop(join); } +#[test] +fn unowned_poll() { + let (task, _) = unowned(async {}, NoopSchedule); + task.run(); +} + #[test] fn schedule() { with(|rt| {