-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sync: make notify_waiters
calls atomic
#5458
Conversation
fix features CI and wasi CI replace brittle test with a loom test format feature list fix a bug in counter increment 💀 fix a bug storing an old counter value add loom test to check poll consistency fix a typo add loom test for polling between batches add polling consistency between batches remove magic constant add test variant with different poll order test atomicity when used with notify_one take atomically entire list in `notify_waiters` fix clippy errors with potential ub decouple the list only if with multiple batches add test for linked list iter apply review suggestions
tokio/src/util/linked_list.rs
Outdated
/// `self` or not contained by any other list. | ||
/// The caller **must** ensure that exactly one of the following is true: | ||
/// - `node` is currently contained by `self` | ||
/// - `node` is currently contained by some other list, but `node` is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that this is a very specific requirement, maybe include a note saying that this is for the Notify
LL and why it relies on it (in a few words). Otherwise, if I were reading this without the necessary context, I would find it very strange.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is looking good. I really like the guarded linked list approach here. I left some comments inline. I also am going to spend a bit more time thinking about whether moving the state atomic store matters.
|
||
let decoupled_list = std::mem::take(&mut *waiters); | ||
|
||
let guard = UnsafeCell::new(Waiter::new()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably want to pin guard
to ensure it doesn't accidentally move (the pin!
macro might work here). Also, could you add a big comment saying it is critical for safety that guard
does not move and is not dropped until the guarded list is dropped?
// transition **out** of `WAITING`. | ||
// Increment the number of times this method was called | ||
// and transition to empty. | ||
let new_state = set_state(inc_num_notify_waiters_calls(curr), EMPTY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this moved up? I'm not sure it matters, but it is not apparent it does not matter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code is correct as long as the store happens while the mutex is held. Moving the store up increases the odds of a poll_notified
succeeding early in some rare concurrent conditions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was moved up for correctness. If we allowed to poll a pending future between chunks and observe the old counter value, then it would be possible to observe the inconsistency from the description (number 2.). This is because such future would return Pending
, even though other waiters from the decoupled list could be already notified. notify_waiters_poll_consistency_many
checks such scenarios.
I applied suggestions from the review. I also removed unnecessary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I'll let @Darksonn take a look as well. Thanks!
@@ -540,6 +567,8 @@ impl Notify { | |||
} | |||
} | |||
|
|||
// Release the lock before notifying. | |||
// `guarded_list` is no longer used. | |||
drop(waiters); | |||
|
|||
wakers.wake_all(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We must clean up the linked list even if this call panics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good catch. I moved the list to a new struct, which makes sure the list is cleaned up on drop.
fn drop(&mut self) { | ||
// If the list is not empty, we unlink all waiters from it. | ||
// We do not wake the waiters to avoid double panics. | ||
if !self.is_empty { | ||
let _lock_guard = self.notify.waiters.lock(); | ||
while let Some(mut waiter) = self.list.pop_back() { | ||
// Safety: we hold the lock. | ||
let waiter = unsafe { waiter.as_mut() }; | ||
waiter.notified = Some(NotificationType::AllWaiters); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this destructor does not call waker.wake()
, which means the remaining waiters will never be woken up unless manually polled. However, this is already the case in the current code because one panicking waker from a batch can result in the whole batch never being notified, see the discussion linked in #4069.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Looks good to me.
# 1.26.0 (March 1st, 2023) ### Fixed - sync: don't leak tracing spans in mutex guards ([#5469]) - sync: drop wakers after unlocking the mutex in Notify ([#5471]) - sync: drop wakers outside lock in semaphore ([#5475]) - macros: fix empty `join!` and `try_join!` ([#5504]) ### Added - fs: add `fs::try_exists` ([#4299]) - net: add types for named unix pipes ([#5351]) - sync: add `MappedOwnedMutexGuard` ([#5474]) ### Documented - task: clarify what happens to spawned work during runtime shutdown ([#5394]) - task: clarify `process::Command` docs (#5406) ([#5413]) - sync: add doc aliases for `blocking_*` methods ([#5448]) - task: fix wording with 'unsend' ([#5452]) - signal: updated Documentation for Signals ([#5459]) - sync: fix docs for Send/Sync bounds in broadcast ([#5480]) - io: improve AsyncFd example ([#5481]) - tokio: document supported platforms ([#5483]) - runtime: document the nature of the main future ([#5494]) - sync: document drop behavior for channels ([#5497]) - time: document immediate completion guarantee for timeouts ([#5509]) - runtime: remove extra period in docs ([#5511]) ### Changed - net: use Message Read Mode for named pipes ([#5350]) - chore: update windows-sys to 0.45 ([#5386]) - sync: mark lock guards with `#[clippy::has_significant_drop]` ([#5422]) - sync: reduce contention in watch channel ([#5464]) - time: remove cache padding in timer entries ([#5468]) - time: Improve `Instant::now()` perf with test-util ([#5513]) ### Internal Changes - tests: port proptest fuzz harnesses to use cargo-fuzz ([#5392]) - time: don't store deadline twice in sleep entries ([#5410]) - rt: remove Arc from Clock ([#5434]) - sync: make `notify_waiters` calls atomic ([#5458]) - net: refactor named pipe builders to not use bitfields ([#5477]) - io: use `poll_fn` in `copy_bidirectional` ([#5486]) - fs: add more tests for filesystem functionality ([#5493]) - net: fix test compilation failure ([#5506]) - io: ignore SplitByUtf8BoundaryIfWindows test on miri ([#5507]) ### Unstable - metrics: add a new metric for budget exhaustion yields ([#5517]) [#4299]: #4299 [#5350]: #5350 [#5351]: #5351 [#5386]: #5386 [#5392]: #5392 [#5394]: #5394 [#5410]: #5410 [#5413]: #5413 [#5422]: #5422 [#5434]: #5434 [#5448]: #5448 [#5452]: #5452 [#5458]: #5458 [#5459]: #5459 [#5464]: #5464 [#5468]: #5468 [#5469]: #5469 [#5471]: #5471 [#5474]: #5474 [#5475]: #5475 [#5477]: #5477 [#5480]: #5480 [#5481]: #5481 [#5483]: #5483 [#5486]: #5486 [#5493]: #5493 [#5494]: #5494 [#5497]: #5497 [#5504]: #5504 [#5506]: #5506 [#5507]: #5507 [#5509]: #5509 [#5511]: #5511 [#5513]: #5513 [#5517]: #5517
# 1.26.0 (March 1st, 2023) ### Fixed - macros: fix empty `join!` and `try_join!` ([#5504]) - sync: don't leak tracing spans in mutex guards ([#5469]) - sync: drop wakers after unlocking the mutex in Notify ([#5471]) - sync: drop wakers outside lock in semaphore ([#5475]) ### Added - fs: add `fs::try_exists` ([#4299]) - net: add types for named unix pipes ([#5351]) - sync: add `MappedOwnedMutexGuard` ([#5474]) ### Changed - chore: update windows-sys to 0.45 ([#5386]) - net: use Message Read Mode for named pipes ([#5350]) - sync: mark lock guards with `#[clippy::has_significant_drop]` ([#5422]) - sync: reduce contention in watch channel ([#5464]) - time: remove cache padding in timer entries ([#5468]) - time: Improve `Instant::now()` perf with test-util ([#5513]) ### Internal Changes - io: use `poll_fn` in `copy_bidirectional` ([#5486]) - net: refactor named pipe builders to not use bitfields ([#5477]) - rt: remove Arc from Clock ([#5434]) - sync: make `notify_waiters` calls atomic ([#5458]) - time: don't store deadline twice in sleep entries ([#5410]) ### Unstable - metrics: add a new metric for budget exhaustion yields ([#5517]) ### Documented - io: improve AsyncFd example ([#5481]) - runtime: document the nature of the main future ([#5494]) - runtime: remove extra period in docs ([#5511]) - signal: updated Documentation for Signals ([#5459]) - sync: add doc aliases for `blocking_*` methods ([#5448]) - sync: fix docs for Send/Sync bounds in broadcast ([#5480]) - sync: document drop behavior for channels ([#5497]) - task: clarify what happens to spawned work during runtime shutdown ([#5394]) - task: clarify `process::Command` docs ([#5413]) - task: fix wording with 'unsend' ([#5452]) - time: document immediate completion guarantee for timeouts ([#5509]) - tokio: document supported platforms ([#5483]) [#4299]: #4299 [#5350]: #5350 [#5351]: #5351 [#5386]: #5386 [#5394]: #5394 [#5410]: #5410 [#5413]: #5413 [#5422]: #5422 [#5434]: #5434 [#5448]: #5448 [#5452]: #5452 [#5458]: #5458 [#5459]: #5459 [#5464]: #5464 [#5468]: #5468 [#5469]: #5469 [#5471]: #5471 [#5474]: #5474 [#5475]: #5475 [#5477]: #5477 [#5480]: #5480 [#5481]: #5481 [#5483]: #5483 [#5486]: #5486 [#5494]: #5494 [#5497]: #5497 [#5504]: #5504 [#5509]: #5509 [#5511]: #5511 [#5513]: #5513 [#5517]: #5517
# 1.26.0 (March 1st, 2023) ### Fixed - macros: fix empty `join!` and `try_join!` ([#5504]) - sync: don't leak tracing spans in mutex guards ([#5469]) - sync: drop wakers after unlocking the mutex in Notify ([#5471]) - sync: drop wakers outside lock in semaphore ([#5475]) ### Added - fs: add `fs::try_exists` ([#4299]) - net: add types for named unix pipes ([#5351]) - sync: add `MappedOwnedMutexGuard` ([#5474]) ### Changed - chore: update windows-sys to 0.45 ([#5386]) - net: use Message Read Mode for named pipes ([#5350]) - sync: mark lock guards with `#[clippy::has_significant_drop]` ([#5422]) - sync: reduce contention in watch channel ([#5464]) - time: remove cache padding in timer entries ([#5468]) - time: Improve `Instant::now()` perf with test-util ([#5513]) ### Internal Changes - io: use `poll_fn` in `copy_bidirectional` ([#5486]) - net: refactor named pipe builders to not use bitfields ([#5477]) - rt: remove Arc from Clock ([#5434]) - sync: make `notify_waiters` calls atomic ([#5458]) - time: don't store deadline twice in sleep entries ([#5410]) ### Unstable - metrics: add a new metric for budget exhaustion yields ([#5517]) ### Documented - io: improve AsyncFd example ([#5481]) - runtime: document the nature of the main future ([#5494]) - runtime: remove extra period in docs ([#5511]) - signal: updated Documentation for Signals ([#5459]) - sync: add doc aliases for `blocking_*` methods ([#5448]) - sync: fix docs for Send/Sync bounds in broadcast ([#5480]) - sync: document drop behavior for channels ([#5497]) - task: clarify what happens to spawned work during runtime shutdown ([#5394]) - task: clarify `process::Command` docs ([#5413]) - task: fix wording with 'unsend' ([#5452]) - time: document immediate completion guarantee for timeouts ([#5509]) - tokio: document supported platforms ([#5483]) [#4299]: #4299 [#5350]: #5350 [#5351]: #5351 [#5386]: #5386 [#5394]: #5394 [#5410]: #5410 [#5413]: #5413 [#5422]: #5422 [#5434]: #5434 [#5448]: #5448 [#5452]: #5452 [#5458]: #5458 [#5459]: #5459 [#5464]: #5464 [#5468]: #5468 [#5469]: #5469 [#5471]: #5471 [#5474]: #5474 [#5475]: #5475 [#5477]: #5477 [#5480]: #5480 [#5481]: #5481 [#5483]: #5483 [#5486]: #5486 [#5494]: #5494 [#5497]: #5497 [#5504]: #5504 [#5509]: #5509 [#5511]: #5511 [#5513]: #5513 [#5517]: #5517
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [tokio](https://tokio.rs) ([source](https://togithub.com/tokio-rs/tokio)) | dev-dependencies | minor | `1` -> `1.37.0` | | [tokio](https://tokio.rs) ([source](https://togithub.com/tokio-rs/tokio)) | dependencies | minor | `1` -> `1.37.0` | --- ### Release Notes <details> <summary>tokio-rs/tokio (tokio)</summary> ### [`v1.37.0`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.37.0): Tokio v1.37.0 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.36.0...tokio-1.37.0) ### 1.37.0 (March 28th, 2024) ##### Added - fs: add `set_max_buf_size` to `tokio::fs::File` ([#​6411]) - io: add `try_new` and `try_with_interest` to `AsyncFd` ([#​6345]) - sync: add `forget_permits` method to semaphore ([#​6331]) - sync: add `is_closed`, `is_empty`, and `len` to mpsc receivers ([#​6348]) - sync: add a `rwlock()` method to owned `RwLock` guards ([#​6418]) - sync: expose strong and weak counts of mpsc sender handles ([#​6405]) - sync: implement `Clone` for `watch::Sender` ([#​6388]) - task: add `TaskLocalFuture::take_value` ([#​6340]) - task: implement `FromIterator` for `JoinSet` ([#​6300]) ##### Changed - io: make `io::split` use a mutex instead of a spinlock ([#​6403]) ##### Fixed - docs: fix docsrs build without net feature ([#​6360]) - macros: allow select with only else branch ([#​6339]) - runtime: fix leaking registration entries when os registration fails ([#​6329]) ##### Documented - io: document cancel safety of `AsyncBufReadExt::fill_buf` ([#​6431]) - io: document cancel safety of `AsyncReadExt`'s primitive read functions ([#​6337]) - runtime: add doc link from `Runtime` to `#[tokio::main]` ([#​6366]) - runtime: make the `enter` example deterministic ([#​6351]) - sync: add Semaphore example for limiting the number of outgoing requests ([#​6419]) - sync: fix missing period in broadcast docs ([#​6377]) - sync: mark `mpsc::Sender::downgrade` with `#[must_use]` ([#​6326]) - sync: reorder `const_new` before `new_with` ([#​6392]) - sync: update watch channel docs ([#​6395]) - task: fix documentation links ([#​6336]) ##### Changed (unstable) - runtime: include task `Id` in taskdumps ([#​6328]) - runtime: panic if `unhandled_panic` is enabled when not supported ([#​6410]) [#​6300]: https://togithub.com/tokio-rs/tokio/pull/6300 [#​6326]: https://togithub.com/tokio-rs/tokio/pull/6326 [#​6328]: https://togithub.com/tokio-rs/tokio/pull/6328 [#​6329]: https://togithub.com/tokio-rs/tokio/pull/6329 [#​6331]: https://togithub.com/tokio-rs/tokio/pull/6331 [#​6336]: https://togithub.com/tokio-rs/tokio/pull/6336 [#​6337]: https://togithub.com/tokio-rs/tokio/pull/6337 [#​6339]: https://togithub.com/tokio-rs/tokio/pull/6339 [#​6340]: https://togithub.com/tokio-rs/tokio/pull/6340 [#​6345]: https://togithub.com/tokio-rs/tokio/pull/6345 [#​6348]: https://togithub.com/tokio-rs/tokio/pull/6348 [#​6351]: https://togithub.com/tokio-rs/tokio/pull/6351 [#​6360]: https://togithub.com/tokio-rs/tokio/pull/6360 [#​6366]: https://togithub.com/tokio-rs/tokio/pull/6366 [#​6377]: https://togithub.com/tokio-rs/tokio/pull/6377 [#​6388]: https://togithub.com/tokio-rs/tokio/pull/6388 [#​6392]: https://togithub.com/tokio-rs/tokio/pull/6392 [#​6395]: https://togithub.com/tokio-rs/tokio/pull/6395 [#​6403]: https://togithub.com/tokio-rs/tokio/pull/6403 [#​6405]: https://togithub.com/tokio-rs/tokio/pull/6405 [#​6410]: https://togithub.com/tokio-rs/tokio/pull/6410 [#​6411]: https://togithub.com/tokio-rs/tokio/pull/6411 [#​6418]: https://togithub.com/tokio-rs/tokio/pull/6418 [#​6419]: https://togithub.com/tokio-rs/tokio/pull/6419 [#​6431]: https://togithub.com/tokio-rs/tokio/pull/6431 ### [`v1.36.0`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.36.0): Tokio v1.36.0 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.35.1...tokio-1.36.0) ### 1.36.0 (February 2nd, 2024) ##### Added - io: add `tokio::io::Join` ([#​6220]) - io: implement `AsyncWrite` for `Empty` ([#​6235]) - net: add support for anonymous unix pipes ([#​6127]) - net: add `UnixSocket` ([#​6290]) - net: expose keepalive option on `TcpSocket` ([#​6311]) - sync: add `{Receiver,UnboundedReceiver}::poll_recv_many` ([#​6236]) - sync: add `Sender::{try_,}reserve_many` ([#​6205]) - sync: add `watch::Receiver::mark_unchanged` ([#​6252]) - task: add `JoinSet::try_join_next` ([#​6280]) ##### Changed - io: make `copy` cooperative ([#​6265]) - io: make `repeat` and `sink` cooperative ([#​6254]) - io: simplify check for empty slice ([#​6293]) - process: use pidfd on Linux when available ([#​6152]) - sync: use AtomicBool in broadcast channel future ([#​6298]) ##### Documented - io: clarify `clear_ready` docs ([#​6304]) - net: document that `*Fd` traits on `TcpSocket` are unix-only ([#​6294]) - sync: document FIFO behavior of `tokio::sync::Mutex` ([#​6279]) - chore: typographic improvements ([#​6262]) - runtime: remove obsolete comment ([#​6303]) - task: fix typo ([#​6261]) [#​6220]: https://togithub.com/tokio-rs/tokio/pull/6220 [#​6235]: https://togithub.com/tokio-rs/tokio/pull/6235 [#​6127]: https://togithub.com/tokio-rs/tokio/pull/6127 [#​6290]: https://togithub.com/tokio-rs/tokio/pull/6290 [#​6311]: https://togithub.com/tokio-rs/tokio/pull/6311 [#​6236]: https://togithub.com/tokio-rs/tokio/pull/6236 [#​6205]: https://togithub.com/tokio-rs/tokio/pull/6205 [#​6252]: https://togithub.com/tokio-rs/tokio/pull/6252 [#​6280]: https://togithub.com/tokio-rs/tokio/pull/6280 [#​6265]: https://togithub.com/tokio-rs/tokio/pull/6265 [#​6254]: https://togithub.com/tokio-rs/tokio/pull/6254 [#​6293]: https://togithub.com/tokio-rs/tokio/pull/6293 [#​6238]: https://togithub.com/tokio-rs/tokio/pull/6238 [#​6152]: https://togithub.com/tokio-rs/tokio/pull/6152 [#​6298]: https://togithub.com/tokio-rs/tokio/pull/6298 [#​6262]: https://togithub.com/tokio-rs/tokio/pull/6262 [#​6303]: https://togithub.com/tokio-rs/tokio/pull/6303 [#​6261]: https://togithub.com/tokio-rs/tokio/pull/6261 [#​6304]: https://togithub.com/tokio-rs/tokio/pull/6304 [#​6294]: https://togithub.com/tokio-rs/tokio/pull/6294 [#​6279]: https://togithub.com/tokio-rs/tokio/pull/6279 ### [`v1.35.1`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.35.1): Tokio v1.35.1 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.35.0...tokio-1.35.1) ### 1.35.1 (December 19, 2023) This is a forward part of a change that was backported to 1.25.3. ##### Fixed - io: add budgeting to `tokio::runtime::io::registration::async_io` ([#​6221]) [#​6221]: https://togithub.com/tokio-rs/tokio/pull/6221 ### [`v1.35.0`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.35.0): Tokio v1.35.0 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.34.0...tokio-1.35.0) ### 1.35.0 (December 8th, 2023) ##### Added - net: add Apple watchOS support ([#​6176]) ##### Changed - io: drop the `Sized` requirements from `AsyncReadExt.read_buf` ([#​6169]) - runtime: make `Runtime` unwind safe ([#​6189]) - runtime: reduce the lock contention in task spawn ([#​6001]) - tokio: update nix dependency to 0.27.1 ([#​6190]) ##### Fixed - chore: make `--cfg docsrs` work without net feature ([#​6166]) - chore: use relaxed load for `unsync_load` on miri ([#​6179]) - runtime: handle missing context on wake ([#​6148]) - taskdump: fix taskdump cargo config example ([#​6150]) - taskdump: skip notified tasks during taskdumps ([#​6194]) - tracing: avoid creating resource spans with current parent, use a None parent instead ([#​6107]) - tracing: make task span explicit root ([#​6158]) ##### Documented - io: flush in `AsyncWriteExt` examples ([#​6149]) - runtime: document fairness guarantees and current behavior ([#​6145]) - task: document cancel safety of `LocalSet::run_until` ([#​6147]) [#​6001]: https://togithub.com/tokio-rs/tokio/pull/6001 [#​6107]: https://togithub.com/tokio-rs/tokio/pull/6107 [#​6144]: https://togithub.com/tokio-rs/tokio/pull/6144 [#​6145]: https://togithub.com/tokio-rs/tokio/pull/6145 [#​6147]: https://togithub.com/tokio-rs/tokio/pull/6147 [#​6148]: https://togithub.com/tokio-rs/tokio/pull/6148 [#​6149]: https://togithub.com/tokio-rs/tokio/pull/6149 [#​6150]: https://togithub.com/tokio-rs/tokio/pull/6150 [#​6158]: https://togithub.com/tokio-rs/tokio/pull/6158 [#​6166]: https://togithub.com/tokio-rs/tokio/pull/6166 [#​6169]: https://togithub.com/tokio-rs/tokio/pull/6169 [#​6176]: https://togithub.com/tokio-rs/tokio/pull/6176 [#​6179]: https://togithub.com/tokio-rs/tokio/pull/6179 [#​6189]: https://togithub.com/tokio-rs/tokio/pull/6189 [#​6190]: https://togithub.com/tokio-rs/tokio/pull/6190 [#​6194]: https://togithub.com/tokio-rs/tokio/pull/6194 ### [`v1.34.0`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.34.0): Tokio v1.34.0 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.33.0...tokio-1.34.0) ##### Fixed - io: allow `clear_readiness` after io driver shutdown ([#​6067]) - io: fix integer overflow in `take` ([#​6080]) - io: fix I/O resource hang ([#​6134]) - sync: fix `broadcast::channel` link ([#​6100]) ##### Changed - macros: use `::core` qualified imports instead of `::std` inside `tokio::test` macro ([#​5973]) ##### Added - fs: update cfg attr in `fs::read_dir` to include `aix` ([#​6075]) - sync: add `mpsc::Receiver::recv_many` ([#​6010]) - tokio: added vita target support ([#​6094]) [#​5973]: https://togithub.com/tokio-rs/tokio/pull/5973 [#​6067]: https://togithub.com/tokio-rs/tokio/pull/6067 [#​6080]: https://togithub.com/tokio-rs/tokio/pull/6080 [#​6134]: https://togithub.com/tokio-rs/tokio/pull/6134 [#​6100]: https://togithub.com/tokio-rs/tokio/pull/6100 [#​6075]: https://togithub.com/tokio-rs/tokio/pull/6075 [#​6010]: https://togithub.com/tokio-rs/tokio/pull/6010 [#​6094]: https://togithub.com/tokio-rs/tokio/pull/6094 ### [`v1.33.0`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.33.0): Tokio v1.33.0 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.32.1...tokio-1.33.0) ### 1.33.0 (October 9, 2023) ##### Fixed - io: mark `Interest::add` with `#[must_use]` ([#​6037]) - runtime: fix cache line size for RISC-V ([#​5994]) - sync: prevent lock poisoning in `watch::Receiver::wait_for` ([#​6021]) - task: fix `spawn_local` source location ([#​5984]) ##### Changed - sync: use Acquire/Release orderings instead of SeqCst in `watch` ([#​6018]) ##### Added - fs: add vectored writes to `tokio::fs::File` ([#​5958]) - io: add `Interest::remove` method ([#​5906]) - io: add vectored writes to `DuplexStream` ([#​5985]) - net: add Apple tvOS support ([#​6045]) - sync: add `?Sized` bound to `{MutexGuard,OwnedMutexGuard}::map` ([#​5997]) - sync: add `watch::Receiver::mark_unseen` ([#​5962], [#​6014], [#​6017]) - sync: add `watch::Sender::new` ([#​5998]) - sync: add const fn `OnceCell::from_value` ([#​5903]) ##### Removed - remove unused `stats` feature ([#​5952]) ##### Documented - add missing backticks in code examples ([#​5938], [#​6056]) - fix typos ([#​5988], [#​6030]) - process: document that `Child::wait` is cancel safe ([#​5977]) - sync: add examples for `Semaphore` ([#​5939], [#​5956], [#​5978], [#​6031], [#​6032], [#​6050]) - sync: document that `broadcast` capacity is a lower bound ([#​6042]) - sync: document that `const_new` is not instrumented ([#​6002]) - sync: improve cancel-safety documentation for `mpsc::Sender::send` ([#​5947]) - sync: improve docs for `watch` channel ([#​5954]) - taskdump: render taskdump documentation on docs.rs ([#​5972]) ##### Unstable - taskdump: fix potential deadlock ([#​6036]) [#​5903]: https://togithub.com/tokio-rs/tokio/pull/5903 [#​5906]: https://togithub.com/tokio-rs/tokio/pull/5906 [#​5938]: https://togithub.com/tokio-rs/tokio/pull/5938 [#​5939]: https://togithub.com/tokio-rs/tokio/pull/5939 [#​5947]: https://togithub.com/tokio-rs/tokio/pull/5947 [#​5952]: https://togithub.com/tokio-rs/tokio/pull/5952 [#​5954]: https://togithub.com/tokio-rs/tokio/pull/5954 [#​5956]: https://togithub.com/tokio-rs/tokio/pull/5956 [#​5958]: https://togithub.com/tokio-rs/tokio/pull/5958 [#​5960]: https://togithub.com/tokio-rs/tokio/pull/5960 [#​5962]: https://togithub.com/tokio-rs/tokio/pull/5962 [#​5971]: https://togithub.com/tokio-rs/tokio/pull/5971 [#​5972]: https://togithub.com/tokio-rs/tokio/pull/5972 [#​5977]: https://togithub.com/tokio-rs/tokio/pull/5977 [#​5978]: https://togithub.com/tokio-rs/tokio/pull/5978 [#​5984]: https://togithub.com/tokio-rs/tokio/pull/5984 [#​5985]: https://togithub.com/tokio-rs/tokio/pull/5985 [#​5988]: https://togithub.com/tokio-rs/tokio/pull/5988 [#​5994]: https://togithub.com/tokio-rs/tokio/pull/5994 [#​5997]: https://togithub.com/tokio-rs/tokio/pull/5997 [#​5998]: https://togithub.com/tokio-rs/tokio/pull/5998 [#​6002]: https://togithub.com/tokio-rs/tokio/pull/6002 [#​6014]: https://togithub.com/tokio-rs/tokio/pull/6014 [#​6017]: https://togithub.com/tokio-rs/tokio/pull/6017 [#​6018]: https://togithub.com/tokio-rs/tokio/pull/6018 [#​6021]: https://togithub.com/tokio-rs/tokio/pull/6021 [#​6030]: https://togithub.com/tokio-rs/tokio/pull/6030 [#​6031]: https://togithub.com/tokio-rs/tokio/pull/6031 [#​6032]: https://togithub.com/tokio-rs/tokio/pull/6032 [#​6036]: https://togithub.com/tokio-rs/tokio/pull/6036 [#​6037]: https://togithub.com/tokio-rs/tokio/pull/6037 [#​6042]: https://togithub.com/tokio-rs/tokio/pull/6042 [#​6045]: https://togithub.com/tokio-rs/tokio/pull/6045 [#​6050]: https://togithub.com/tokio-rs/tokio/pull/6050 [#​6056]: https://togithub.com/tokio-rs/tokio/pull/6056 [#​6058]: https://togithub.com/tokio-rs/tokio/pull/6058 ### [`v1.32.1`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.32.1): Tokio v1.32.1 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.32.0...tokio-1.32.1) ### 1.32.1 (December 19, 2023) This is a forward part of a change that was backported to 1.25.3. ##### Fixed - io: add budgeting to `tokio::runtime::io::registration::async_io` ([#​6221]) [#​6221]: https://togithub.com/tokio-rs/tokio/pull/6221 ### [`v1.32.0`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.32.0): Tokio v1.32.0 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.31.0...tokio-1.32.0) ##### Fixed - sync: fix potential quadratic behavior in `broadcast::Receiver` ([#​5925]) ##### Added - process: stabilize `Command::raw_arg` ([#​5930]) - io: enable awaiting error readiness ([#​5781]) ##### Unstable - rt(alt): improve the scalability of alt runtime as the number of cores grows ([#​5935]) [#​5925]: https://togithub.com/tokio-rs/tokio/pull/5925 [#​5930]: https://togithub.com/tokio-rs/tokio/pull/5930 [#​5781]: https://togithub.com/tokio-rs/tokio/pull/5781 [#​5935]: https://togithub.com/tokio-rs/tokio/pull/5935 ### [`v1.31.0`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.31.0): Tokio v1.31.0 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.30.0...tokio-1.31.0) ##### Fixed - io: delegate `WriteHalf::poll_write_vectored` ([#​5914]) ##### Unstable - rt(unstable): fix memory leak in unstable next-gen scheduler prototype ([#​5911]) - rt: expose mean task poll time metric ([#​5927]) [#​5914]: https://togithub.com/tokio-rs/tokio/pull/5914 [#​5911]: https://togithub.com/tokio-rs/tokio/pull/5911 [#​5927]: https://togithub.com/tokio-rs/tokio/pull/5927 ### [`v1.30.0`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.30.0): Tokio v1.30.0 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.29.1...tokio-1.30.0) ### 1.30.0 (August 9, 2023) This release bumps the MSRV of Tokio to 1.63. ([#​5887]) ##### Changed - tokio: reduce LLVM code generation ([#​5859]) - io: support `--cfg mio_unsupported_force_poll_poll` flag ([#​5881]) - sync: make `const_new` methods always available ([#​5885]) - sync: avoid false sharing in mpsc channel ([#​5829]) - rt: pop at least one task from inject queue ([#​5908]) ##### Added - sync: add `broadcast::Sender::new` ([#​5824]) - net: implement `UCred` for espidf ([#​5868]) - fs: add `File::options()` ([#​5869]) - time: implement extra reset variants for `Interval` ([#​5878]) - process: add `{ChildStd*}::into_owned_{fd, handle}` ([#​5899]) ##### Removed - tokio: removed unused `tokio_*` cfgs ([#​5890]) - remove build script to speed up compilation ([#​5887]) ##### Documented - sync: mention lagging in docs for `broadcast::send` ([#​5820]) - runtime: expand on sharing runtime docs ([#​5858]) - io: use vec in example for `AsyncReadExt::read_exact` ([#​5863]) - time: mark `Sleep` as `!Unpin` in docs ([#​5916]) - process: fix `raw_arg` not showing up in docs ([#​5865]) ##### Unstable - rt: add runtime ID ([#​5864]) - rt: initial implementation of new threaded runtime ([#​5823]) [#​5820]: https://togithub.com/tokio-rs/tokio/pull/5820 [#​5823]: https://togithub.com/tokio-rs/tokio/pull/5823 [#​5824]: https://togithub.com/tokio-rs/tokio/pull/5824 [#​5829]: https://togithub.com/tokio-rs/tokio/pull/5829 [#​5858]: https://togithub.com/tokio-rs/tokio/pull/5858 [#​5859]: https://togithub.com/tokio-rs/tokio/pull/5859 [#​5863]: https://togithub.com/tokio-rs/tokio/pull/5863 [#​5864]: https://togithub.com/tokio-rs/tokio/pull/5864 [#​5865]: https://togithub.com/tokio-rs/tokio/pull/5865 [#​5868]: https://togithub.com/tokio-rs/tokio/pull/5868 [#​5869]: https://togithub.com/tokio-rs/tokio/pull/5869 [#​5878]: https://togithub.com/tokio-rs/tokio/pull/5878 [#​5881]: https://togithub.com/tokio-rs/tokio/pull/5881 [#​5885]: https://togithub.com/tokio-rs/tokio/pull/5885 [#​5887]: https://togithub.com/tokio-rs/tokio/pull/5887 [#​5890]: https://togithub.com/tokio-rs/tokio/pull/5890 [#​5899]: https://togithub.com/tokio-rs/tokio/pull/5899 [#​5908]: https://togithub.com/tokio-rs/tokio/pull/5908 [#​5916]: https://togithub.com/tokio-rs/tokio/pull/5916 ### [`v1.29.1`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.29.1): Tokio v1.29.1 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.29.0...tokio-1.29.1) ##### Fixed - rt: fix nesting two `block_in_place` with a `block_on` between ([#​5837]) [#​5837]: https://togithub.com/tokio-rs/tokio/pull/5837 ### [`v1.29.0`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.29.0): Tokio v1.29.0 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.28.2...tokio-1.29.0) Technically a breaking change, the `Send` implementation is removed from `runtime::EnterGuard`. This change fixes a bug and should not impact most users. ##### Breaking - rt: `EnterGuard` should not be `Send` ([#​5766]) ##### Fixed - fs: reduce blocking ops in `fs::read_dir` ([#​5653]) - rt: fix possible starvation ([#​5686], [#​5712]) - rt: fix stacked borrows issue in `JoinSet` ([#​5693]) - rt: panic if `EnterGuard` dropped incorrect order ([#​5772]) - time: do not overflow to signal value ([#​5710]) - fs: wait for in-flight ops before cloning `File` ([#​5803]) ##### Changed - rt: reduce time to poll tasks scheduled from outside the runtime ([#​5705], [#​5720]) ##### Added - net: add uds doc alias for unix sockets ([#​5659]) - rt: add metric for number of tasks ([#​5628]) - sync: implement more traits for channel errors ([#​5666]) - net: add nodelay methods on TcpSocket ([#​5672]) - sync: add `broadcast::Receiver::blocking_recv` ([#​5690]) - process: add `raw_arg` method to `Command` ([#​5704]) - io: support PRIORITY epoll events ([#​5566]) - task: add `JoinSet::poll_join_next` ([#​5721]) - net: add support for Redox OS ([#​5790]) ##### Unstable - rt: add the ability to dump task backtraces ([#​5608], [#​5676], [#​5708], [#​5717]) - rt: instrument task poll times with a histogram ([#​5685]) [#​5766]: https://togithub.com/tokio-rs/tokio/pull/5766 [#​5653]: https://togithub.com/tokio-rs/tokio/pull/5653 [#​5686]: https://togithub.com/tokio-rs/tokio/pull/5686 [#​5712]: https://togithub.com/tokio-rs/tokio/pull/5712 [#​5693]: https://togithub.com/tokio-rs/tokio/pull/5693 [#​5772]: https://togithub.com/tokio-rs/tokio/pull/5772 [#​5710]: https://togithub.com/tokio-rs/tokio/pull/5710 [#​5803]: https://togithub.com/tokio-rs/tokio/pull/5803 [#​5705]: https://togithub.com/tokio-rs/tokio/pull/5705 [#​5720]: https://togithub.com/tokio-rs/tokio/pull/5720 [#​5659]: https://togithub.com/tokio-rs/tokio/pull/5659 [#​5628]: https://togithub.com/tokio-rs/tokio/pull/5628 [#​5666]: https://togithub.com/tokio-rs/tokio/pull/5666 [#​5672]: https://togithub.com/tokio-rs/tokio/pull/5672 [#​5690]: https://togithub.com/tokio-rs/tokio/pull/5690 [#​5704]: https://togithub.com/tokio-rs/tokio/pull/5704 [#​5566]: https://togithub.com/tokio-rs/tokio/pull/5566 [#​5721]: https://togithub.com/tokio-rs/tokio/pull/5721 [#​5790]: https://togithub.com/tokio-rs/tokio/pull/5790 [#​5608]: https://togithub.com/tokio-rs/tokio/pull/5608 [#​5676]: https://togithub.com/tokio-rs/tokio/pull/5676 [#​5708]: https://togithub.com/tokio-rs/tokio/pull/5708 [#​5717]: https://togithub.com/tokio-rs/tokio/pull/5717 [#​5685]: https://togithub.com/tokio-rs/tokio/pull/5685 ### [`v1.28.2`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.28.2): Tokio v1.28.2 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.28.1...tokio-1.28.2) ### 1.28.2 (May 28, 2023) Forward ports 1.18.6 changes. ##### Fixed - deps: disable default features for mio ([#​5728]) [#​5728]: https://togithub.com/tokio-rs/tokio/pull/5728 ### [`v1.28.1`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.28.1): Tokio v1.28.1 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.28.0...tokio-1.28.1) ### 1.28.1 (May 10th, 2023) This release fixes a mistake in the build script that makes `AsFd` implementations unavailable on Rust 1.63. ([#​5677]) [#​5677]: https://togithub.com/tokio-rs/tokio/pull/5677 ### [`v1.28.0`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.28.0): Tokio v1.28.0 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.27.0...tokio-1.28.0) ### 1.28.0 (April 25th, 2023) ##### Added - io: add `AsyncFd::async_io` ([#​5542]) - io: impl BufMut for ReadBuf ([#​5590]) - net: add `recv_buf` for `UdpSocket` and `UnixDatagram` ([#​5583]) - sync: add `OwnedSemaphorePermit::semaphore` ([#​5618]) - sync: add `same_channel` to broadcast channel ([#​5607]) - sync: add `watch::Receiver::wait_for` ([#​5611]) - task: add `JoinSet::spawn_blocking` and `JoinSet::spawn_blocking_on` ([#​5612]) ##### Changed - deps: update windows-sys to 0.48 ([#​5591]) - io: make `read_to_end` not grow unnecessarily ([#​5610]) - macros: make entrypoints more efficient ([#​5621]) - sync: improve Debug impl for `RwLock` ([#​5647]) - sync: reduce contention in `Notify` ([#​5503]) ##### Fixed - net: support `get_peer_cred` on AIX ([#​5065]) - sync: avoid deadlocks in `broadcast` with custom wakers ([#​5578]) ##### Documented - sync: fix typo in `Semaphore::MAX_PERMITS` ([#​5645]) - sync: fix typo in `tokio::sync::watch::Sender` docs ([#​5587]) [#​5065]: https://togithub.com/tokio-rs/tokio/pull/5065 [#​5503]: https://togithub.com/tokio-rs/tokio/pull/5503 [#​5542]: https://togithub.com/tokio-rs/tokio/pull/5542 [#​5578]: https://togithub.com/tokio-rs/tokio/pull/5578 [#​5583]: https://togithub.com/tokio-rs/tokio/pull/5583 [#​5587]: https://togithub.com/tokio-rs/tokio/pull/5587 [#​5590]: https://togithub.com/tokio-rs/tokio/pull/5590 [#​5591]: https://togithub.com/tokio-rs/tokio/pull/5591 [#​5607]: https://togithub.com/tokio-rs/tokio/pull/5607 [#​5610]: https://togithub.com/tokio-rs/tokio/pull/5610 [#​5611]: https://togithub.com/tokio-rs/tokio/pull/5611 [#​5612]: https://togithub.com/tokio-rs/tokio/pull/5612 [#​5618]: https://togithub.com/tokio-rs/tokio/pull/5618 [#​5621]: https://togithub.com/tokio-rs/tokio/pull/5621 [#​5645]: https://togithub.com/tokio-rs/tokio/pull/5645 [#​5647]: https://togithub.com/tokio-rs/tokio/pull/5647 ### [`v1.27.0`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.27.0): Tokio v1.27.0 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.26.0...tokio-1.27.0) ### 1.27.0 (March 27th, 2023) This release bumps the MSRV of Tokio to 1.56. ([#​5559]) ##### Added - io: add `async_io` helper method to sockets ([#​5512]) - io: add implementations of `AsFd`/`AsHandle`/`AsSocket` ([#​5514], [#​5540]) - net: add `UdpSocket::peek_sender()` ([#​5520]) - sync: add `RwLockWriteGuard::{downgrade_map, try_downgrade_map}` ([#​5527]) - task: add `JoinHandle::abort_handle` ([#​5543]) ##### Changed - io: use `memchr` from `libc` ([#​5558]) - macros: accept path as crate rename in `#[tokio::main]` ([#​5557]) - macros: update to syn 2.0.0 ([#​5572]) - time: don't register for a wakeup when `Interval` returns `Ready` ([#​5553]) ##### Fixed - fs: fuse std iterator in `ReadDir` ([#​5555]) - tracing: fix `spawn_blocking` location fields ([#​5573]) - time: clean up redundant check in `Wheel::poll()` ([#​5574]) ##### Documented - macros: define cancellation safety ([#​5525]) - io: add details to docs of `tokio::io::copy[_buf]` ([#​5575]) - io: refer to `ReaderStream` and `StreamReader` in module docs ([#​5576]) [#​5512]: https://togithub.com/tokio-rs/tokio/pull/5512 [#​5514]: https://togithub.com/tokio-rs/tokio/pull/5514 [#​5520]: https://togithub.com/tokio-rs/tokio/pull/5520 [#​5525]: https://togithub.com/tokio-rs/tokio/pull/5525 [#​5527]: https://togithub.com/tokio-rs/tokio/pull/5527 [#​5540]: https://togithub.com/tokio-rs/tokio/pull/5540 [#​5543]: https://togithub.com/tokio-rs/tokio/pull/5543 [#​5553]: https://togithub.com/tokio-rs/tokio/pull/5553 [#​5555]: https://togithub.com/tokio-rs/tokio/pull/5555 [#​5557]: https://togithub.com/tokio-rs/tokio/pull/5557 [#​5558]: https://togithub.com/tokio-rs/tokio/pull/5558 [#​5559]: https://togithub.com/tokio-rs/tokio/pull/5559 [#​5572]: https://togithub.com/tokio-rs/tokio/pull/5572 [#​5573]: https://togithub.com/tokio-rs/tokio/pull/5573 [#​5574]: https://togithub.com/tokio-rs/tokio/pull/5574 [#​5575]: https://togithub.com/tokio-rs/tokio/pull/5575 [#​5576]: https://togithub.com/tokio-rs/tokio/pull/5576 ### [`v1.26.0`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.26.0): Tokio v1.26.0 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.25.3...tokio-1.26.0) ##### Fixed - macros: fix empty `join!` and `try_join!` ([[https://github.com/tokio-rs/tokio/pull/5504](https://togithub.com/tokio-rs/tokio/pull/5504)]) - sync: don't leak tracing spans in mutex guards ([[https://github.com/tokio-rs/tokio/pull/5469](https://togithub.com/tokio-rs/tokio/pull/5469)]) - sync: drop wakers after unlocking the mutex in Notify ([[https://github.com/tokio-rs/tokio/pull/5471](https://togithub.com/tokio-rs/tokio/pull/5471)]) - sync: drop wakers outside lock in semaphore ([[https://github.com/tokio-rs/tokio/pull/5475](https://togithub.com/tokio-rs/tokio/pull/5475)]) ##### Added - fs: add `fs::try_exists` ([[https://github.com/tokio-rs/tokio/pull/4299](https://togithub.com/tokio-rs/tokio/pull/4299)]) - net: add types for named unix pipes ([[https://github.com/tokio-rs/tokio/pull/5351](https://togithub.com/tokio-rs/tokio/pull/5351)]) - sync: add `MappedOwnedMutexGuard` ([[https://github.com/tokio-rs/tokio/pull/5474](https://togithub.com/tokio-rs/tokio/pull/5474)]) ##### Changed - chore: update windows-sys to 0.45 ([[https://github.com/tokio-rs/tokio/pull/5386](https://togithub.com/tokio-rs/tokio/pull/5386)]) - net: use Message Read Mode for named pipes ([[https://github.com/tokio-rs/tokio/pull/5350](https://togithub.com/tokio-rs/tokio/pull/5350)]) - sync: mark lock guards with `#[clippy::has_significant_drop]` ([[https://github.com/tokio-rs/tokio/pull/5422](https://togithub.com/tokio-rs/tokio/pull/5422)]) - sync: reduce contention in watch channel ([[https://github.com/tokio-rs/tokio/pull/5464](https://togithub.com/tokio-rs/tokio/pull/5464)]) - time: remove cache padding in timer entries ([[https://github.com/tokio-rs/tokio/pull/5468](https://togithub.com/tokio-rs/tokio/pull/5468)]) - time: Improve `Instant::now()` perf with test-util ([[https://github.com/tokio-rs/tokio/pull/5513](https://togithub.com/tokio-rs/tokio/pull/5513)]) ##### Internal Changes - io: use `poll_fn` in `copy_bidirectional` ([[https://github.com/tokio-rs/tokio/pull/5486](https://togithub.com/tokio-rs/tokio/pull/5486)]) - net: refactor named pipe builders to not use bitfields ([[https://github.com/tokio-rs/tokio/pull/5477](https://togithub.com/tokio-rs/tokio/pull/5477)]) - rt: remove Arc from Clock ([[https://github.com/tokio-rs/tokio/pull/5434](https://togithub.com/tokio-rs/tokio/pull/5434)]) - sync: make `notify_waiters` calls atomic ([[https://github.com/tokio-rs/tokio/pull/5458](https://togithub.com/tokio-rs/tokio/pull/5458)]) - time: don't store deadline twice in sleep entries ([[https://github.com/tokio-rs/tokio/pull/5410](https://togithub.com/tokio-rs/tokio/pull/5410)]) ##### Unstable - metrics: add a new metric for budget exhaustion yields ([[https://github.com/tokio-rs/tokio/pull/5517](https://togithub.com/tokio-rs/tokio/pull/5517)]) ##### Documented - io: improve AsyncFd example ([[https://github.com/tokio-rs/tokio/pull/5481](https://togithub.com/tokio-rs/tokio/pull/5481)]) - runtime: document the nature of the main future ([[https://github.com/tokio-rs/tokio/pull/5494](https://togithub.com/tokio-rs/tokio/pull/5494)]) - runtime: remove extra period in docs ([[https://github.com/tokio-rs/tokio/pull/5511](https://togithub.com/tokio-rs/tokio/pull/5511)]) - signal: updated Documentation for Signals ([[https://github.com/tokio-rs/tokio/pull/5459](https://togithub.com/tokio-rs/tokio/pull/5459)]) - sync: add doc aliases for `blocking_*` methods ([[https://github.com/tokio-rs/tokio/pull/5448](https://togithub.com/tokio-rs/tokio/pull/5448)]) - sync: fix docs for Send/Sync bounds in broadcast ([[https://github.com/tokio-rs/tokio/pull/5480](https://togithub.com/tokio-rs/tokio/pull/5480)]) - sync: document drop behavior for channels ([[https://github.com/tokio-rs/tokio/pull/5497](https://togithub.com/tokio-rs/tokio/pull/5497)]) - task: clarify what happens to spawned work during runtime shutdown ([[https://github.com/tokio-rs/tokio/pull/5394](https://togithub.com/tokio-rs/tokio/pull/5394)]) - task: clarify `process::Command` docs ([[https://github.com/tokio-rs/tokio/pull/5413](https://togithub.com/tokio-rs/tokio/pull/5413)]) - task: fix wording with 'unsend' ([[https://github.com/tokio-rs/tokio/pull/5452](https://togithub.com/tokio-rs/tokio/pull/5452)]) - time: document immediate completion guarantee for timeouts ([[https://github.com/tokio-rs/tokio/pull/5509](https://togithub.com/tokio-rs/tokio/pull/5509)]) - tokio: document supported platforms ([[https://github.com/tokio-rs/tokio/pull/5483](https://togithub.com/tokio-rs/tokio/pull/5483)]) [https://github.com/tokio-rs/tokio/pull/4299]: https://togithub.com/tokio-rs/tokio/pull/4299 [https://github.com/tokio-rs/tokio/pull/5350]: https://togithub.com/tokio-rs/tokio/pull/5350 [https://github.com/tokio-rs/tokio/pull/5351]: https://togithub.com/tokio-rs/tokio/pull/5351 [https://github.com/tokio-rs/tokio/pull/5386]: https://togithub.com/tokio-rs/tokio/pull/5386 [https://github.com/tokio-rs/tokio/pull/5394]: https://togithub.com/tokio-rs/tokio/pull/5394 [https://github.com/tokio-rs/tokio/pull/5410]: https://togithub.com/tokio-rs/tokio/pull/5410 [https://github.com/tokio-rs/tokio/pull/5413]: https://togithub.com/tokio-rs/tokio/pull/5413 [https://github.com/tokio-rs/tokio/pull/5422]: https://togithub.com/tokio-rs/tokio/pull/5422 [https://github.com/tokio-rs/tokio/pull/5434]: https://togithub.com/tokio-rs/tokio/pull/5434 [https://github.com/tokio-rs/tokio/pull/5448]: https://togithub.com/tokio-rs/tokio/pull/5448 [https://github.com/tokio-rs/tokio/pull/5452]: https://togithub.com/tokio-rs/tokio/pull/5452 [https://github.com/tokio-rs/tokio/pull/5458]: https://togithub.com/tokio-rs/tokio/pull/5458 [https://github.com/tokio-rs/tokio/pull/5459]: https://togithub.com/tokio-rs/tokio/pull/5459 [https://github.com/tokio-rs/tokio/pull/5464]: https://togithub.com/tokio-rs/tokio/pull/5464 [https://github.com/tokio-rs/tokio/pull/5468]: https://togithub.com/tokio-rs/tokio/pull/5468 [https://github.com/tokio-rs/tokio/pull/5469]: https://togithub.com/tokio-rs/tokio/pull/5469 [https://github.com/tokio-rs/tokio/pull/5471]: https://togithub.com/tokio-rs/tokio/pull/5471 [https://github.com/tokio-rs/tokio/pull/5474]: https://togithub.com/tokio-rs/tokio/pull/5474 [https://github.com/tokio-rs/tokio/pull/5475]: https://togithub.com/tokio-rs/tokio/pull/5475 [https://github.com/tokio-rs/tokio/pull/5477]: https://togithub.com/tokio-rs/tokio/pull/5477 [https://github.com/tokio-rs/tokio/pull/5480]: https://togithub.com/tokio-rs/tokio/pull/5480 [https://github.com/tokio-rs/tokio/pull/5481]: https://togithub.com/tokio-rs/tokio/pull/5481 [https://github.com/tokio-rs/tokio/pull/5483]: https://togithub.com/tokio-rs/tokio/pull/5483 [https://github.com/tokio-rs/tokio/pull/5486]: https://togithub.com/tokio-rs/tokio/pull/5486 [https://github.com/tokio-rs/tokio/pull/5494]: https://togithub.com/tokio-rs/tokio/pull/5494 [https://github.com/tokio-rs/tokio/pull/5497]: https://togithub.com/tokio-rs/tokio/pull/5497 [https://github.com/tokio-rs/tokio/pull/5504]: https://togithub.com/tokio-rs/tokio/pull/5504 [https://github.com/tokio-rs/tokio/pull/5509]: https://togithub.com/tokio-rs/tokio/pull/5509 [https://github.com/tokio-rs/tokio/pull/5511]: https://togithub.com/tokio-rs/tokio/pull/5511 [https://github.com/tokio-rs/tokio/pull/5513]: https://togithub.com/tokio-rs/tokio/pull/5513 [https://github.com/tokio-rs/tokio/pull/5517]: https://togithub.com/tokio-rs/tokio/pull/5517 ### [`v1.25.3`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.25.3): Tokio v1.25.3 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.25.2...tokio-1.25.3) ### 1.25.3 (December 17th, 2023) ##### Fixed - io: add budgeting to `tokio::runtime::io::registration::async_io` ([#​6221]) [#​6221]: https://togithub.com/tokio-rs/tokio/pull/6221 ### [`v1.25.2`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.25.2): Tokio v1.25.2 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.25.1...tokio-1.25.2) ### 1.25.2 (September 22, 2023) Forward ports 1.20.6 changes. ##### Changed - io: use `memchr` from `libc` ([#​5960]) [#​5960]: https://togithub.com/tokio-rs/tokio/pull/5960 ### [`v1.25.1`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.25.1): Tokio v1.25.1 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.25.0...tokio-1.25.1) ### 1.25.1 (May 28, 2023) Forward ports 1.18.6 changes. ##### Fixed - deps: disable default features for mio ([#​5728]) [#​5728]: https://togithub.com/tokio-rs/tokio/pull/5728 ### [`v1.25.0`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.25.0): Tokio v1.25.0 ### 1.25.0 (January 28, 2023) ##### Fixed - rt: fix runtime metrics reporting ([#​5330]) ##### Added - sync: add `broadcast::Sender::len` ([#​5343]) ##### Changed - fs: increase maximum read buffer size to 2MiB ([#​5397]) [#​5330]: https://togithub.com/tokio-rs/tokio/pull/5330 [#​5343]: https://togithub.com/tokio-rs/tokio/pull/5343 [#​5397]: https://togithub.com/tokio-rs/tokio/pull/5397 ### [`v1.24.1`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.24.1): Tokio v1.24.1 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.24.0...tokio-1.24.1) This release fixes a compilation failure on targets without `AtomicU64` when using rustc older than 1.63. ([#​5356]) [#​5356]: https://togithub.com/tokio-rs/tokio/pull/5356 ### [`v1.24.0`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.24.0): Tokio v1.24.0 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.23.1...tokio-1.24.0) The highlight of this release is the reduction of lock contention for all I/O operations ([#​5300](https://togithub.com/tokio-rs/tokio/issues/5300)). We have received reports of up to a 20% improvement in CPU utilization and increased throughput for real-world I/O heavy applications. ##### Fixed - rt: improve native `AtomicU64` support detection ([#​5284]) ##### Added - rt: add configuration option for max number of I/O events polled from the OS per tick ([#​5186]) - rt: add an environment variable for configuring the default number of worker threads per runtime instance ([#​4250]) ##### Changed - sync: reduce MPSC channel stack usage ([#​5294]) - io: reduce lock contention in I/O operations ([#​5300]) - fs: speed up `read_dir()` by chunking operations ([#​5309]) - rt: use internal `ThreadId` implementation ([#​5329]) - test: don't auto-advance time when a `spawn_blocking` task is running ([#​5115]) [#​5186]: https://togithub.com/tokio-rs/tokio/pull/5186 [#​5294]: https://togithub.com/tokio-rs/tokio/pull/5294 [#​5284]: https://togithub.com/tokio-rs/tokio/pull/5284 [#​4250]: https://togithub.com/tokio-rs/tokio/pull/4250 [#​5300]: https://togithub.com/tokio-rs/tokio/pull/5300 [#​5329]: https://togithub.com/tokio-rs/tokio/pull/5329 [#​5115]: https://togithub.com/tokio-rs/tokio/pull/5115 [#​5309]: https://togithub.com/tokio-rs/tokio/pull/5309 ### [`v1.23.1`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.23.1): Tokio v1.23.1 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.23.0...tokio-1.23.1) This release forward ports changes from 1.18.4. ##### Fixed - net: fix Windows named pipe server builder to maintain option when toggling pipe mode ([#​5336]). [#​5336]: https://togithub.com/tokio-rs/tokio/pull/5336 ### [`v1.23.0`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.23.0): Tokio v1.23.0 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.22.0...tokio-1.23.0) ##### Fixed - net: fix Windows named pipe connect ([#​5208]) - io: support vectored writes for `ChildStdin` ([#​5216]) - io: fix `async fn ready()` false positive for OS-specific events ([#​5231]) ##### Changed - runtime: `yield_now` defers task until after driver poll ([#​5223]) - runtime: reduce amount of codegen needed per spawned task ([#​5213]) - windows: replace `winapi` dependency with `windows-sys` ([#​5204]) [#​5208]: https://togithub.com/tokio-rs/tokio/pull/5208 [#​5216]: https://togithub.com/tokio-rs/tokio/pull/5216 [#​5213]: https://togithub.com/tokio-rs/tokio/pull/5213 [#​5204]: https://togithub.com/tokio-rs/tokio/pull/5204 [#​5223]: https://togithub.com/tokio-rs/tokio/pull/5223 [#​5231]: https://togithub.com/tokio-rs/tokio/pull/5231 ### [`v1.22.0`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.22.0): Tokio v1.22.0 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.21.2...tokio-1.22.0) ##### Added - runtime: add `Handle::runtime_flavor` ([#​5138]) - sync: add `Mutex::blocking_lock_owned` ([#​5130]) - sync: add `Semaphore::MAX_PERMITS` ([#​5144]) - sync: add `merge()` to semaphore permits ([#​4948]) - sync: add `mpsc::WeakUnboundedSender` ([#​5189]) ##### Added (unstable) - process: add `Command::process_group` ([#​5114]) - runtime: export metrics about the blocking thread pool ([#​5161]) - task: add `task::id()` and `task::try_id()` ([#​5171]) ##### Fixed - macros: don't take ownership of futures in macros ([#​5087]) - runtime: fix Stacked Borrows violation in `LocalOwnedTasks` ([#​5099]) - runtime: mitigate ABA with 32-bit queue indices when possible ([#​5042]) - task: wake local tasks to the local queue when woken by the same thread ([#​5095]) - time: panic in release mode when `mark_pending` called illegally ([#​5093]) - runtime: fix typo in expect message ([#​5169]) - runtime: fix `unsync_load` on atomic types ([#​5175]) - task: elaborate safety comments in task deallocation ([#​5172]) - runtime: fix `LocalSet` drop in thread local ([#​5179]) - net: remove libc type leakage in a public API ([#​5191]) - runtime: update the alignment of `CachePadded` ([#​5106]) ##### Changed - io: make `tokio::io::copy` continue filling the buffer when writer stalls ([#​5066]) - runtime: remove `coop::budget` from `LocalSet::run_until` ([#​5155]) - sync: make `Notify` panic safe ([#​5154]) ##### Documented - io: fix doc for `write_i8` to use signed integers ([#​5040]) - net: fix doc typos for TCP and UDP `set_tos` methods ([#​5073]) - net: fix function name in `UdpSocket::recv` documentation ([#​5150]) - sync: typo in `TryLockError` for `RwLock::try_write` ([#​5160]) - task: document that spawned tasks execute immediately ([#​5117]) - time: document return type of `timeout` ([#​5118]) - time: document that `timeout` checks only before poll ([#​5126]) - sync: specify return type of `oneshot::Receiver` in docs ([#​5198]) ##### Internal changes - runtime: use const `Mutex::new` for globals ([#​5061]) - runtime: remove `Option` around `mio::Events` in io driver ([#​5078]) - runtime: remove a conditional compilation clause ([#​5104]) - runtime: remove a reference to internal time handle ([#​5107]) - runtime: misc time driver cleanup ([#​5120]) - runtime: move signal driver to runtime module ([#​5121]) - runtime: signal driver now uses I/O driver directly ([#​5125]) - runtime: start decoupling I/O driver and I/O handle ([#​5127]) - runtime: switch `io::handle` refs with scheduler:Handle ([#​5128]) - runtime: remove Arc from I/O driver ([#​5134]) - runtime: use signal driver handle via `scheduler::Handle` ([#​5135]) - runtime: move internal clock fns out of context ([#​5139]) - runtime: remove `runtime::context` module ([#​5140]) - runtime: keep driver cfgs in `driver.rs` ([#​5141]) - runtime: add `runtime::context` to unify thread-locals ([#​5143]) - runtime: rename some confusing internal variables/fns ([#​5151]) - runtime: move `coop` mod into `runtime` ([#​5152]) - runtime: move budget state to context thread-local ([#​5157]) - runtime: move park logic into runtime module ([#​5158]) - runtime: move `Runtime` into its own file ([#​5159]) - runtime: unify entering a runtime with `Handle::enter` ([#​5163]) - runtime: remove handle reference from each scheduler ([#​5166]) - runtime: move `enter` into `context` ([#​5167]) - runtime: combine context and entered thread-locals ([#​5168]) - runtime: fix accidental unsetting of current handle ([#​5178]) - runtime: move `CoreStage` methods to `Core` ([#​5182]) - sync: name mpsc semaphore types ([#​5146]) [#​4948]: https://togithub.com/tokio-rs/tokio/pull/4948 [#​5040]: https://togithub.com/tokio-rs/tokio/pull/5040 [#​5042]: https://togithub.com/tokio-rs/tokio/pull/5042 [#​5061]: https://togithub.com/tokio-rs/tokio/pull/5061 [#​5066]: https://togithub.com/tokio-rs/tokio/pull/5066 [#​5073]: https://togithub.com/tokio-rs/tokio/pull/5073 [#​5078]: https://togithub.com/tokio-rs/tokio/pull/5078 [#​5087]: https://togithub.com/tokio-rs/tokio/pull/5087 [#​5093]: https://togithub.com/tokio-rs/tokio/pull/5093 [#​5095]: https://togithub.com/tokio-rs/tokio/pull/5095 [#​5099]: https://togithub.com/tokio-rs/tokio/pull/5099 [#​5104]: https://togithub.com/tokio-rs/tokio/pull/5104 [#​5106]: https://togithub.com/tokio-rs/tokio/pull/5106 [#​5107]: https://togithub.com/tokio-rs/tokio/pull/5107 [#​5114]: https://togithub.com/tokio-rs/tokio/pull/5114 [#​5117]: https://togithub.com/tokio-rs/tokio/pull/5117 [#​5118]: https://togithub.com/tokio-rs/tokio/pull/5118 [#​5120]: https://togithub.com/tokio-rs/tokio/pull/5120 [#​5121]: https://togithub.com/tokio-rs/tokio/pull/5121 [#​5125]: https://togithub.com/tokio-rs/tokio/pull/5125 [#​5126]: https://togithub.com/tokio-rs/tokio/pull/5126 [#​5127]: https://togithub.com/tokio-rs/tokio/pull/5127 [#​5128]: https://togithub.com/tokio-rs/tokio/pull/5128 [#​5130]: https://togithub.com/tokio-rs/tokio/pull/5130 [#​5134]: https://togithub.com/tokio-rs/tokio/pull/5134 [#​5135]: https://togithub.com/tokio-rs/tokio/pull/5135 [#​5138]: https://togithub.com/tokio-rs/tokio/pull/5138 [#​5138]: https://togithub.com/tokio-rs/tokio/pull/5138 [#​5139]: https://togithub.com/tokio-rs/tokio/pull/5139 [#​5140]: https://togithub.com/tokio-rs/tokio/pull/5140 [#​5141]: https://togithub.com/tokio-rs/tokio/pull/5141 [#​5143]: https://togithub.com/tokio-rs/tokio/pull/5143 [#​5144]: https://togithub.com/tokio-rs/tokio/pull/5144 [#​5144]: https://togithub.com/tokio-rs/tokio/pull/5144 [#​5146]: https://togithub.com/tokio-rs/tokio/pull/5146 [#​5150]: https://togithub.com/tokio-rs/tokio/pull/5150 [#​5151]: https://togithub.com/tokio-rs/tokio/pull/5151 [#​5152]: https://togithub.com/tokio-rs/tokio/pull/5152 [#​5154]: https://togithub.com/tokio-rs/tokio/pull/5154 [#​5155]: https://togithub.com/tokio-rs/tokio/pull/5155 [#​5157]: https://togithub.com/tokio-rs/tokio/pull/5157 [#​5158]: https://togithub.com/tokio-rs/tokio/pull/5158 [#​5159]: https://togithub.com/tokio-rs/tokio/pull/5159 [#​5160]: https://togithub.com/tokio-rs/tokio/pull/5160 [#​5161]: https://togithub.com/tokio-rs/tokio/pull/5161 [#​5163]: https://togithub.com/tokio-rs/tokio/pull/5163 [#​5166]: https://togithub.com/tokio-rs/tokio/pull/5166 [#​5167]: https://togithub.com/tokio-rs/tokio/pull/5167 [#​5168]: https://togithub.com/tokio-rs/tokio/pull/5168 [#​5169]: https://togithub.com/tokio-rs/tokio/pull/5169 [#​5171]: https://togithub.com/tokio-rs/tokio/pull/5171 [#​5172]: https://togithub.com/tokio-rs/tokio/pull/5172 [#​5175]: https://togithub.com/tokio-rs/tokio/pull/5175 [#​5178]: https://togithub.com/tokio-rs/tokio/pull/5178 [#​5179]: https://togithub.com/tokio-rs/tokio/pull/5179 [#​5182]: https://togithub.com/tokio-rs/tokio/pull/5182 [#​5189]: https://togithub.com/tokio-rs/tokio/pull/5189 [#​5191]: https://togithub.com/tokio-rs/tokio/pull/5191 [#​5198]: https://togithub.com/tokio-rs/tokio/pull/5198 ### [`v1.21.2`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.21.2): Tokio v1.21.2 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.21.1...tokio-1.21.2) ### 1.21.2 (September 27, 2022) This release removes the dependency on the `once_cell` crate to restore the MSRV of 1.21.x, which is the latest minor version at the time of release. ([#​5048]) [#​5048]: https://togithub.com/tokio-rs/tokio/pull/5048 ### [`v1.21.1`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.21.1): Tokio v1.21.1 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.21.0...tokio-1.21.1) ### 1.21.1 (September 13, 2022) ##### Fixed - net: fix dependency resolution for socket2 ([#​5000]) - task: ignore failure to set TLS in `LocalSet` Drop ([#​4976]) [#​4976]: https://togithub.com/tokio-rs/tokio/pull/4976 [#​5000]: https://togithub.com/tokio-rs/tokio/pull/5000 ### [`v1.21.0`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.21.0): Tokio v1.21.0 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.20.6...tokio-1.21.0) ### 1.21.0 (September 2, 2022) This release is the first release of Tokio to intentionally support WASM. The `sync,macros,io-util,rt,time` features are stabilized on WASM. Additionally the wasm32-wasi target is given unstable support for the `net` feature. ##### Added - net: add `device` and `bind_device` methods to TCP/UDP sockets ([#​4882]) - net: add `tos` and `set_tos` methods to TCP and UDP sockets ([#​4877]) - net: add security flags to named pipe `ServerOptions` ([#​4845]) - signal: add more windows signal handlers ([#​4924]) - sync: add `mpsc::Sender::max_capacity` method ([#​4904]) - sync: implement Weak version of `mpsc::Sender` ([#​4595]) - task: add `LocalSet::enter` ([#​4765]) - task: stabilize `JoinSet` and `AbortHandle` ([#​4920]) - tokio: add `track_caller` to public APIs ([#​4805], [#​4848], [#​4852]) - wasm: initial support for `wasm32-wasi` target ([#​4716]) ##### Fixed - miri: improve miri compatibility by avoiding temporary references in `linked_list::Link` impls ([#​4841]) - signal: don't register write interest on signal pipe ([#​4898]) - sync: add `#[must_use]` to lock guards ([#​4886]) - sync: fix hang when calling `recv` on closed and reopened broadcast channel ([#​4867]) - task: propagate attributes on task-locals ([#​4837]) ##### Changed - fs: change panic to error in `File::start_seek` ([#​4897]) - io: reduce syscalls in `poll_read` ([#​4840]) - process: use blocking threadpool for child stdio I/O ([#​4824]) - signal: make `SignalKind` methods const ([#​4956]) ##### Internal changes - rt: extract `basic_scheduler::Config` ([#​4935]) - rt: move I/O driver into `runtime` module ([#​4942]) - rt: rename internal scheduler types ([#​4945]) ##### Documented - chore: fix typos and grammar ([#​4858], [#​4894], [#​4928]) - io: fix typo in `AsyncSeekExt::rewind` docs ([#​4893]) - net: add documentation to `try_read()` for zero-length buffers ([#​4937]) - runtime: remove incorrect panic section for `Builder::worker_threads` ([#​4849]) - sync: doc of `watch::Sender::send` improved ([#​4959]) - task: add cancel safety docs to `JoinHandle` ([#​4901]) - task: expand on cancellation of `spawn_blocking` ([#​4811]) - time: clarify that the first tick of `Interval::tick` happens immediately ([#​4951]) ##### Unstable - rt: add unstable option to disable the LIFO slot ([#​4936]) - task: fix incorrect signature in `Builder::spawn_on` ([#​4953]) - task: make `task::Builder::spawn*` methods fallible ([#​4823]) [#​4595]: https://togithub.com/tokio-rs/tokio/pull/4595 [#​4716]: https://togithub.com/tokio-rs/tokio/pull/4716 [#​4765]: https://togithub.com/tokio-rs/tokio/pull/4765 [#​4805]: https://togithub.com/tokio-rs/tokio/pull/4805 [#​4811]: https://togithub.com/tokio-rs/tokio/pull/4811 [#​4823]: https://togithub.com/tokio-rs/tokio/pull/4823 [#​4824]: https://togithub.com/tokio-rs/tokio/pull/4824 [#​4837]: https://togithub.com/tokio-rs/tokio/pull/4837 [#​4840]: https://togithub.com/tokio-rs/tokio/pull/4840 [#​4841]: https://togithub.com/tokio-rs/tokio/pull/4841 [#​4845]: https://togithub.com/tokio-rs/tokio/pull/4845 [#​4848]: https://togithub.com/tokio-rs/tokio/pull/4848 [#​4849]: https://togithub.com/tokio-rs/tokio/pull/4849 [#​4852]: https://togithub.com/tokio-rs/tokio/pull/4852 [#​4858]: https://togithub.com/tokio-rs/tokio/pull/4858 [#​4867]: https://togithub.com/tokio-rs/tokio/pull/4867 [#​4877]: https://togithub.com/tokio-rs/tokio/pull/4877 [#​4882]: https://togithub.com/tokio-rs/tokio/pull/4882 [#​4886]: https://togithub.com/tokio-rs/tokio/pull/4886 [#​4893]: https://togithub.com/tokio-rs/tokio/pull/4893 [#​4894]: https://togithub.com/tokio-rs/tokio/pull/4894 [#​4897]: https://togithub.com/tokio-rs/tokio/pull/4897 [#​4898]: https://togithub.com/tokio-rs/tokio/pull/4898 [#​4901]: https://togithub.com/tokio-rs/tokio/pull/4901 [#​4904]: https://togithub.com/tokio-rs/tokio/pull/4904 [#​4920]: https://togithub.com/tokio-rs/tokio/pull/4920 [#​4924]: https://togithub.com/tokio-rs/tokio/pull/4924 [#​4928]: https://togithub.com/tokio-rs/tokio/pull/4928 [#​4935]: https://togithub.com/tokio-rs/tokio/pull/4935 [#​4936]: https://togithub.com/tokio-rs/tokio/pull/4936 [#​4937]: https://togithub.com/tokio-rs/tokio/pull/4937 [#​4942]: https://togithub.com/tokio-rs/tokio/pull/4942 [#​4945]: https://togithub.com/tokio-rs/tokio/pull/4945 [#​4951]: https://togithub.com/tokio-rs/tokio/pull/4951 [#​4953]: https://togithub.com/tokio-rs/tokio/pull/4953 [#​4956]: https://togithub.com/tokio-rs/tokio/pull/4956 [#​4959]: https://togithub.com/tokio-rs/tokio/pull/4959 ### [`v1.20.6`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.20.6): Tokio v1.20.6 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.20.5...tokio-1.20.6) ### 1.20.6 (September 22, 2023) This is a backport of a change from 1.27.0. ##### Changed - io: use `memchr` from `libc` ([#​5960]) [#​5960]: https://togithub.com/tokio-rs/tokio/pull/5960 ### [`v1.20.5`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.20.5): Tokio v1.20.5 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.20.4...tokio-1.20.5) ### 1.20.5 (May 28, 2023) Forward ports 1.18.6 changes. ##### Fixed - deps: disable default features for mio ([#​5728]) [#​5728]: https://togithub.com/tokio-rs/tokio/pull/5728 ### [`v1.20.4`](https://togithub.com/tokio-rs/tokio/compare/tokio-1.20.3...tokio-1.20.4) [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.20.3...tokio-1.20.4) ### [`v1.20.3`](https://togithub.com/tokio-rs/tokio/compare/tokio-1.20.2...tokio-1.20.3) [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.20.2...tokio-1.20.3) ### [`v1.20.2`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.20.2): Tokio v1.20.2 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.20.1...tokio-1.20.2) ### 1.20.2 (September 27, 2022) This release removes the dependency on the `once_cell` crate to restore the MSRV of the 1.20.x LTS release. ([#​5048]) [#​5048]: https://togithub.com/tokio-rs/tokio/pull/5048 ### [`v1.20.1`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.20.1): Tokio v1.20.1 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.20.0...tokio-1.20.1) ### 1.20.1 (July 25, 2022) ##### Fixed - chore: fix version detection in build script ([#​4860]) [#​4860]: https://togithub.com/tokio-rs/tokio/pull/4860 ### [`v1.20.0`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.20.0): Tokio v1.20.0 [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.19.2...tokio-1.20.0) ### 1.20.0 (July 12, 2022) ##### Added - tokio: add track_caller to public APIs ([#​4772], [#​4791], [#​4793], [#​4806], [#​4808]) - sync: Add `has_changed` method to `watch::Ref` ([#​4758]) ##### Changed - time: remove `src/time/driver/wheel/stack.rs` ([#​4766]) - rt: clean up arguments passed to basic scheduler ([#​4767]) - net: be more specific about winapi features ([#​4764]) - tokio: use const initialized thread locals where possible ([#​4677]) - task: various small improvements to LocalKey ([#​4795]) ##### Fixed ##### Documented - fs: warn about performance pitfall ([#​4762]) - chore: fix spelling ([#​4769]) - sync: document spurious failures in oneshot ([#​4777]) - sync: add warning for watch in non-Send futures ([#​4741]) - chore: fix typo ([#​4798]) ##### Unstable - joinset: rename `join_one` to `join_next` ([#​4755]) - rt: unhandled panic conf </details> --- ### Configuration 📅 **Schedule**: Branch creation - "after 9pm,before 6am" in timezone Europe/Zurich, Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/smartive/zitadel-rust). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMzEuMCIsInVwZGF0ZWRJblZlciI6IjM3LjMzMS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Motivation
tokio::sync::Notify
has an internal waiters queue locked behind a mutex.Notify::notify_waiters
is a function to notify all waiters from this queue. It first acquires the lock, then removes waiters from the queue and wakes them up. However, the whole process is done in batches of 32 waiters to avoid deadlocks. The function has to release the lock before waking up a batch and re-acquire it before proceeding to the next one. In this short timespan, another thread can acquire the lock and modify the queue or the internal state. This leads to the following issues:notify_waiters
call can notify multiple futures which are created and awaited sequentially. For example, both futures from the following code can complete:poll
. One could expect that sequentially polled futures will yield results consistent with each other. If one pending future returnsReady
, then other futures which were pending should also be ready. As an example, let's say that we have two pendingNotified
futures:fut1
andfut2
. If we callnotify_waiters
in parallel with the following, the assertion can fail:notify_one
calls. It is possible that callingnotify_one
after awaiting a future notified bynotify_waiters
will result in the notification being lost. As an example, let's say that we have a pendingnotify.notified()
futurefut
. If we callnotify_waiters
in parallel with the following code, it can hang forever:For more context, see the discussion in #5404 or in the related Discord thread.
Closes: #5396
Solution
The idea is to move all waiters to a secondary list, which is created in each call to
notify_waiters
. This list will be unavailable to modify fromnotify_one
and other parts of the code, so the waiters contained in it will not consume other notifications, and it will be impossible to insert new waiters into it. This approach eliminates all presented issues.The tricky part is how to allow waiters contained by a secondary list to remove themselves from it. It is possible to drop a waiter still contained by a secondary list, and in such case it should be able to unlink itself from the neighboring nodes from the list. To solve it, this PR adds a new variant of a linked list, which allows removing a node from it without knowing the list head's memory address. This is done by adding a special “guard” node, which makes the list circular.
To solve the issue with inconsistency in results from
poll
, this PR also adds some additional logic topoll_notified
. A polled future has to know whether it is already included by a secondary list innotify_waiters
and is staged to be notified. In such case it also has to remove itself from the list. To determine if it is contained by a secondary list, a future uses the counter ofnotify_waiters
calls. If the current value of this counter is different from the value recorded by a future at the time, when it was being added to the queue, then there is an ongoingnotify_waiters
call. In such case the future removes itself from the secondary list.