Commit Graph
120 Commits
Author SHA1 Message Date
Carl Lerche 779b9c19d5 ci: disable tuning test when runing ASAN (#5770)
The tuning test relies on a predictable execution environment. It
assumes that spawning a new task can complete reasonably fast. When
running tests with ASAN, the tuning test will spurriously fail. After
investigating, I believe this is due to running tests with ASAN enabled
and without `release` in a low resource environment (CI) results in an
execution environment that is too slow for the tuning test to succeed.
2023-06-06 09:35:19 -07:00
Carl Lerche 1e14ef0093 ci: fix spurious CI failure (#5752)
PR #5720 introduced runtime self-tuning. It included a test that
attempts to verify self-tuning logic. The test is heavily reliant on
timing details. This patch attempts to make the test a bit more reliable
by not assuming tuning will converge within a set amount of time.
2023-06-01 17:15:48 -07:00
Carl Lerche 79a7e78c0d rt(threaded): basic self-tuning of injection queue (#5720)
Each multi-threaded runtime worker prioritizes pulling tasks off of its
local queue. Every so often, it checks the injection (global) queue for
work submitted there. Previously, "every so often," was a constant
"number of tasks polled" value. Tokio sets a default of 61, but allows
users to configure this value.

If workers are under load with tasks that are slow to poll, the
injection queue can be starved. To prevent starvation in this case, this
commit implements some basic self-tuning. The multi-threaded scheduler
tracks the mean task poll time using an exponentially-weighted moving
average. It then uses this value to pick an interval at which to check
the injection queue.

This commit is a first pass at adding self-tuning to the scheduler.
There are other values in the scheduler that could benefit from
self-tuning (e.g. the maintenance interval). Additionally, the
current-thread scheduler could also benfit from self-tuning. However, we
have reached the point where we should start investigating ways to unify
logic in both schedulers. Adding self-tuning to the current-thread
scheduler will be punted until after this unification.
2023-06-01 08:13:24 -07:00
Carl Lerche 98c8c38e96 ci: speed up multi-threaded runtime loom tests. (#5723)
Increase max preemption back to 2 while running the tests in under 90 minutes.
2023-05-27 16:34:59 -07:00
Alice Ryhl 080d52902f Merge 'tokio-1.28.2' into 'master' (#5737) 2023-05-27 20:39:03 +02:00
Alice Ryhl 1605279abf Merge 'tokio-1.25.1' into 'tokio-1.28.x' (#5735) 2023-05-27 20:36:34 +02:00
Alice Ryhl 4b032a25a4 ci: use a fixed stable on 1.25.x (#5732)
This cherry-picks:
 * chore: remove ntapi dev-dependency
 * time: fix repeatedly_reset_entry_inserted_as_expired test
2023-05-27 17:20:38 +02:00
Carl Lerche 9eb3f5b556 rt(threaded): cap LIFO slot polls (#5712)
As an optimization to improve locality, the multi-threaded scheduler
maintains a single slot (LIFO slot). When a task is scheduled, it goes
into the LIFO slot. The scheduler will run tasks in the LIFO slot first
before checking the local queue.

Ping-ping style workloads where task A notifies task B, which
notifies task A again, can cause starvation as these two tasks 
repeatedly schedule the other in the LIFO slot. #5686, a first
attempt at solving this problem, consumes a unit of budget each time a
task is scheduled from the LIFO slot. However, at the time of this
commit, the scheduler allocates 128 units of budget for each chunk of
work. This is relatively high in situations where tasks do not perform many
async operations yet have meaningful poll times (even 5-10 microsecond
poll times can have an outsized impact on the scheduler).

In an ideal world, the scheduler would adapt to the workload it is
executing. However, as a stopgap, this commit limits the times
the LIFO slot is prioritized per scheduler tick.
2023-05-23 14:38:15 -07:00
Carl Lerche 3a94eb0893 rt: batch pop from injection queue when idle (#5705)
In the multi-threaded scheduler, when there are no tasks on the local
queue, a worker will attempt to pull tasks from the injection queue.
Previously, the worker would only attempt to poll one task from the
injection queue then continue trying to find work from other sources.
This can result in the injection queue backing up when there are many
tasks being scheduled from outside of the runtime.

This patch updates the worker to try to poll more than one task from the
injection queue when it has no more local work. Note that we also don't
want a single worker to poll **all** tasks on the injection queue as
that would result in work becoming unbalanced.
2023-05-23 08:16:41 -07:00
Carl Lerche ddd7250e62 ci: update nightly version (#5706) 2023-05-20 11:00:50 +02:00
Alice Ryhl 4e2ef63c4e ci: only check fuzz tests after basic tests (#5687) 2023-05-14 12:43:37 +02:00
Hootan Shadmehr dec390df1e ci: check that tokio-stream/fuzz compiles (#5682) 2023-05-10 20:17:50 +02:00
Hootan Shadmehr 3abe877bf7 ci: check that tokio/fuzz compiles (#5670) 2023-05-03 22:00:06 +02:00
Jack Wrenn 660eac71f0 taskdump: implement task dumps for current-thread runtime (#5608)
Task dumps are snapshots of runtime state. Taskdumps are collected by
instrumenting Tokio's leaves to conditionally collect backtraces, which
are then coalesced per-task into execution tree traces.

This initial implementation only supports collecting taskdumps from
within the context of a current-thread runtime, and only `yield_now()`
is instrumented.
2023-04-27 12:59:20 +02:00
Predrag Gruevski a86c052218 ci: use cargo-semver-checks GitHub Action (#5648) 2023-04-25 00:17:17 +02:00
John-John Tedro ea5d448ee8 ci: gate costly checks behind basic ones (#5622) 2023-04-15 20:16:42 +02:00
Daniel Netzer b1ca0d8b12 ci: fix typo in ci.yml (#5599) 2023-04-05 09:35:47 +00:00
Alice Ryhl 0c8e8248f8 tokio: bump MSRV to 1.56 (#5559) 2023-03-21 18:06:47 +01:00
Predrag Gruevski cf486361d0 ci: remove cargo-semver-checks flags that are no longer necessary (#5496)
These flags were previously only needed due to a bug in the `cargo-semver-checks` CLI logic.

The correct behavior (available as of v0.18.3) for `cargo-semver-checks` is to ignore `publish = false` crates when scanning a workspace, *unless* those crates are specifically selected for checking.

All the crates being excluded here are `publish = false` so they are already excluded by the default behavior, so all `--exclude` flags are no-ops.
2023-02-22 18:54:17 +00:00
Alice Ryhl 0f17d69303 ci: remove PROPTEST_CASES from miri (#5478)
This option doesn't do anything anymore.
2023-02-19 11:11:22 +00:00
Finomnis d1da6c20d8 ci: always assume minor release in semver check (#5455) 2023-02-14 10:09:59 +01:00
Finomnis 1dcfe1cc9b ci: add semver checking to CI (#5437) 2023-02-08 16:45:02 +01:00
Taiki Endo 40782efb76 tokio: fix remaining issues about atomic_u64_static_once_cell.rs (#5374)
Fixes #5373
Closes #5358 

- Add check for no_atomic_u64 & no_const_mutex_new (condition to atomic_u64_static_once_cell.rs is compiled)
- Allow unused_imports in TARGET_ATOMIC_U64_PROBE. I also tested other *_PROBE and found no other errors triggered by -D warning.
- Fix cfg of util::once_cell module
2023-01-14 11:11:05 -08:00
Carl Lerche 048049f888 rt: move task::Id into its own file (#5327)
This is a minor internal cleanup.
2022-12-30 10:49:45 -08:00
Taiki Endo 98d484e29c ci: update cargo-check-external-types to 0.1.6 (#5325) 2022-12-30 19:03:44 +09:00
Taiki Endo b75dba6904 ci: update Swatinem/rust-cache action to v2 (#5320) 2022-12-28 02:20:12 +09:00
Taiki Endo 519afd4458 ci: remove uses of unmaintained actions-rs actions (#5316)
- Use dtolnay/rust-toolchain instead of actions-rs/toolchain
- Use cargo/cross directly instead of actions-rs/cargo
- Use rustsec/audit-check instead of actions-rs/audit-check
2022-12-28 00:06:56 +09:00
Carl Lerche c693ccd210 ci: test no const mutex new (#5257)
This adds CI coverage for a couple of code paths that are not currently
hit in CI:

* no `const fn Mutex::new`
* no `AtomicU64`

This is done by adding some new CFG flags used only for tests in order
to force those code paths.
2022-12-09 02:13:22 +09:00
Carl Lerche 22cff80048 chore: update CI's clippy version to 1.65 (#5276) 2022-12-06 19:56:13 -08:00
Carl Lerche 22862739dd rt: yield_now defers task until after driver poll (#5223)
Previously, calling `task::yield_now().await` would yield the current
task to the scheduler, but the scheduler would poll it again before
polling the resource drivers. This behavior can result in starving the
resource drivers.

This patch creates a queue tracking yielded tasks. The scheduler
notifies those tasks **after** polling the resource drivers.

Refs: #5209
2022-11-30 14:21:08 -08:00
Taiki Endo fc83e01949 chore: add tokio_no_atomic_u64 cfg (#5226) 2022-11-23 19:00:57 +09:00
Carl Lerche 808d52563e ci: run tests on ARM and i686 using cross (#5196)
This patch updates CI to use `cross` to run Tokio tests on virtualized
ARM and i686 VMs. Because ipv6 doesn't work on Github action running in
a docker instance, those tests are disabled
2022-11-18 14:02:53 -08:00
Alice Ryhl a1002a2203 ci: update miri flags (#5174) 2022-11-06 13:41:53 +01:00
Alice Ryhl fc9518b627 chore: bump clippy version (#5173) 2022-11-06 12:44:26 +01:00
Carl Lerche df6348fb4a chore: fix tests for Rust 1.65 release (#5164)
Rust 1.65 reduces some struct sizes.
2022-11-03 14:24:10 -07:00
Ashish Kurmi b821e436c5 ci: add minimum GitHub token permissions for workflows (#5072)
Signed-off-by: Ashish Kurmi <[email protected]>
2022-10-03 05:15:23 -04:00
Alice Ryhl feef48fb58 ci: improve minrust check and re-enable example (#5060) 2022-09-27 21:18:13 +00:00
Alice Ryhl 47b6e194fb Merge 'tokio-1.21.2' into 'master' (#5059) 2022-09-27 21:53:36 +02:00
Alice Ryhl 3fbf314985 Merge 'tokio-1.20.2' into 'tokio-1.21.x' (#5057) 2022-09-27 21:13:45 +02:00
Alice Ryhl 2063d6692e Merge 'tokio-1.18.3' into 'tokio-1.20.x' (#5054) 2022-09-27 10:48:37 +02:00
Alice Ryhl 05e661490b chore: don't use once_cell for 1.18.x LTS release (#5048)
The latest release of once_cell has an MSRV that is incompatible with the MSRV of the 1.18.x LTS release.
2022-09-26 10:41:35 +02:00
Taiki Endo ac1ae2cfbc ci: use latest Valgrind (#4367) 2022-09-14 21:49:32 +09:00
Taiki Endo b891714bdb ci: use --feature-powerset --depth 2 in features check (#5007)
As has been pointed out a few times in the past (e.g., #4036 (comment)), each-feature 
is not sufficient for features check.

Ideally, we'd like to check all combinations of features, but there are too many
combinations. So limit the max number of simultaneous feature flags to 2 by --depth
option. I think this should be sufficient in most cases as @carllerche said in
taiki-e/cargo-hack#58.
2022-09-13 11:05:38 -07:00
Jernej Kos 0fddb765d4 ci: add build test for x86_64-fortanix-unknown-sgx target (#5001) 2022-09-13 15:12:35 +02:00
Carl Lerche 99aa8d12b7 rt: rm internal Park,Unpark traits (#4991)
Years ago, Tokio was organized as a cluster of separate crates. This
architecture required a trait to represent "park the thread and do
work.". When all crates were combined into a single crate, the `Park`
and `Unpark` traits remained as internal details.

This patch removes these traits as they are no longer needed. This is in
service of a future refactor that will decouple the various resource
drivers and store them in a single struct instead of nesting them.
However, in the mean time, removing the Park/Unpark traits adds a bit of
messy code to make the conditional compilation work. This code will
(hopefully) be short-lived.
2022-09-07 18:39:45 -07:00
John DiSanti d720770b07 ci: add cargo-check-external-types check (#4914) 2022-08-24 13:35:32 +02:00
John DiSanti 4b1c4801b1 ci: upgrade to nightly-2022-07-26 and pin miri nightly (#4915) 2022-08-15 21:09:47 +00:00
John DiSanti d416b1d1d6 ci: upgrade nightly to nightly-2022-07-25 (#4903)
Upgrade the nightly to a version that works with all of miri,
cargo-hack, minimal-versions, and cargo-check-external-types.

This is a prerequisite for #4902.
2022-08-12 16:12:09 +00:00
Josh Soref 5ab6aaf3cd ci: scope workflows (#4857)
Signed-off-by: Josh Soref <[email protected]>
2022-07-30 13:55:53 +02:00
Josh Soref f3e340a35b chore: fix spelling mistakes (#4858)
Signed-off-by: Josh Soref <[email protected]>
2022-07-25 07:26:01 +00:00