127 Commits

Author SHA1 Message Date
Patrick McGleenon
e392c4ff1e
chore: update CI to clippy 1.76 (#6334)
Co-authored-by: Rafael Bachmann <rafael.bachmann.93@gmail.com>
2024-02-10 10:45:40 +01:00
M.Amin Rayej
53f9e5a357
ci: make sure dictionary words are sorted and unique (#6316) 2024-01-31 16:11:54 +03:30
Owen Leung
131e7b4e49
ci: add spellchecking (#6297) 2024-01-29 10:53:43 +01:00
M.Amin Rayej
58edfc61ab
ci: verify that tests work with panic=abort (#6283) 2024-01-16 16:10:23 +01:00
Taiki Endo
84c5674c60
ci: update clippy version to 1.75 (#6273) 2024-01-07 02:33:37 +09:00
Taiki Endo
9780bf491f
ci: update cargo-check-external-types to 0.1.10 (#6274) 2024-01-07 00:53:08 +09:00
Taiki Endo
d6ba535ceb
ci: update actions/checkout action to v4 (#6272) 2024-01-06 20:30:28 +09:00
Hayden Stainsby
ed32cd194c
task: add tests for tracing instrumentation of tasks (#6112)
Tokio is instrumented with traces which can be used to analyze the
behavior of the runtime during execution or post-mortem. The
instrumentation is optional. This is where tokio-console collections
information.

There are currently no tests for the instrumentation.

In order to provide more stability to the instrumentation and prepare
for future changes, tests are added to verify the current behavior. The
tests are written using the `tracing-mock` crate. As this crate is still
unreleased, a separate test create has been added under `tokio/tests`
which is outside the workspace. This allows us to pull in both `tracing`
and `tracing-mock` from the tracing repository on GitHub without
affecting the rest of the tokio repository.

This change adds initial tests for the task instrumentation. Further
tests will be added in subsequent commits.

Once `tracing-mock` is published on crates.io (tokio-rs/tracing#539),
these tests can be moved in with the "normal" tokio integration tests.
The decision to add these tests now is due to the release of
`tracing-mock` taking a while, so it would be better to have tests while
we wait.
2023-10-31 10:02:00 +01:00
Nikolay Arhipov
f3949cc56d
tokio: added vita target support (#6094) 2023-10-25 14:44:41 +02:00
Alice Ryhl
58acb56a17
ci: update nightly to 2023-10-21 (#6103) 2023-10-24 14:15:25 +00:00
Eliza Weisman
d1dae25cd2
ci: drop MIPS targets from cross-check (#5951)
Currently, Tokio runs cross-compilation checks for the
`mips-unknown-linux-gnu` and `mipsel-unknown-linux-musl` target triples.
However, Rust has recently demoted these targets from Tier 2 support to
Tier 3 (see rust-lang/compiler-team#648). Therefore, MIPS toolchains may
not always be available, even in stable releases. This is currently
[breaking our CI builds][1], as Rust 1.72.0 does not contain a standard
library for `mips-unknown-linux-gnu`.

This branch removes these builds from the cross-compilation check's
build matrix. Tokio may still build successfully for MIPS targets, but
we can't easily guarantee support when the stable Rust release train may
or may not be able to build for MIPS targets.

[1]: https://github.com/tokio-rs/tokio/actions/runs/5970263562/job/16197657405?pr=5947#step:3:80
2023-08-25 14:40:32 -07:00
Taiki Endo
e5e88551d2
Update CI config (#5893) 2023-08-02 01:04:11 +09:00
Jiahao XU
efe3ab679a
sync: make const_new methods always available (#5885)
Since MSRV is bumped to 1.63, `Mutex::new` is now usable in const context.

Also use `assert!` in const function to ensure correctness instead of
silently truncating the value and remove cfg `tokio_no_const_mutex_new`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-07-28 13:46:21 +02:00
Jiahao XU
c445e467ce
tokio: bump MSRV to 1.63 (#5887) 2023-07-27 10:57:19 +02:00
Jiahao XU
fc69666f8a
Speedup CI (#5691)
- Pass `--no-deps` to `cargo-clippy`
 - Use `dtolnay/rust-toolchain@stale` instead of
   `dtolnay/rust-toolchain@master`
 - Use dtolnay/rust-toolchain instead of `rustup` directly
 - Use `cargo-nextest` in job test to speedup testing
 - Use `cargo-nextest` in job test-unstable to speedup testing
 - Use `cargo-nextest` in job test-unstable-taskdump to speedup testing
 - Use `cargo-nextest` in job no-atomic-u64 to speedup testing
 - Use `cargo-nextest` in job check-unstable-mt-counters
 - Run `cargo check --benches` for `benches/` in job test
   Since the benchmark is not run
 - Run `cargo-check` instead of `cargo-build` in job test-parking_lot
   since no test is run
 - Run `cargo-check` instead of `cargo-build` in job no-atomic-u64
 - Run `Swatinem/rust-cache@v2` after `taiki-e/install-action@v2` to
   avoid caching pre-built artifacts downloaded by it.
 - Use `Swatinem/rust-cache@v2` in job no-atomic-u64
 - Add concurrenty group to cancel outdated CI
 - Use `taiki-e/setup-cross-toolchain-action@v1` in job cross-test

   instead of cross, so that we can use `cargo-nextest` to run tests in
   parallel.

   Also use `Swatinem/rust-cache@v2` to cache artifacts.
 - Use `Swatinem/rust-cache@v2` in job cross-check to speedup ci.
 - Fix job `cross-test`: Use `armv5te-unknown-linux-gnueabi` for no-atomic-u64

   testing instead of `arm-unknown-linux-gnueabihf`, which actually has
   atomic-u64
 - Rm use of `cross` in job `cross-check`

   Since it does not run any test, it does not need the `cross-rs`
   toolchain as tokio does not use any external C/C++ library that require
   `gcc`/`clang` to compile.
 - Add more recognizable name for steps in job cross-test
 - Split job `test` into `test-{tokio-full, workspace-all-features,
   integration-tests-per-feature}`
 - Split job `no-atomic-u64` into `no-atomic-u64-{test, check}`
 - Parallelize job `features` by using matrix
 - Split `cross-test` into `cross-test-{with, without}-parking_lot`
 - Speedup job `cross-test-*` and `no-atomic-u64-test` by running
   `cargo-test` with `-- --test-threads 1` since `qemu` userspace
   emulation has problems running binaries with many threads.
 - Speedup workflow `stress-test.yml` and job `valgrind` in workflow `ci.yml`
   by passing `--fair-sched=yes` to `valgrind`.
 - Speedup job `test-hyper`: Cache `./hyper/target`
   instead of caching `./target`, which is non-existent.
 - Set `RUST_TEST_THREADS=1` to make sure `libtest` only use one thread
   so that qemu will be happy with the tests.
   This is applied to `cross-test-with(out)-parking_lot, no-atomic-u64-test`.
 - Apply suggestions from code review

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-07-02 16:56:38 +09:00
Alice Ryhl
bb4512eae0
ci: reenable semver check (#5845) 2023-07-01 16:54:38 +02:00
Carl Lerche
0c7d8d10fb
ci: disable tuning tests for cross tests (#5836) 2023-06-29 10:23:13 -07:00
Andrew Mackenzie
fb0d305a7a
ci: build tokio for redox-os (#5800) 2023-06-19 19:33:17 +02:00
Taiki Endo
af6c87a045
chore: upgrade remaining 2018 edition crates to 2021 edition (#5788) 2023-06-12 02:21:50 +09:00
Taiki Endo
6257712d68
ci: update cargo-check-external-types to 0.1.7 (#5786) 2023-06-11 19:02:12 +09:00
Taiki Endo
c5d52c17ae
chore: enable cargo v2 resolver to prevent dev-deps from enabling log feature of mio (#5787) 2023-06-11 17:34:22 +09:00
Alice Ryhl
a2941e48be
ci: temporarily disable semver check (#5774) 2023-06-08 10:36:25 +02:00
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
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
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
Taiki Endo
fc83e01949
chore: add tokio_no_atomic_u64 cfg (#5226) 2022-11-23 19:00:57 +09:00