Commit Graph
2970 Commits
Author SHA1 Message Date
Carl Lerche ba81945ffc chore: prepare Tokio 1.20.3 release tokio-1.20.3 2023-01-03 13:28:44 -08:00
Carl Lerche 763bdc967e ci: run WASI tasks using latest Rust
This should let CI to pass.
2023-01-03 13:28:43 -08:00
Carl Lerche 9f98535877 Merge remote-tracking branch 'origin/tokio-1.18.x' into fix-named-pipes-1.20 2023-01-03 13:12:20 -08:00
Carl Lerche 9241c3eddf chore: prepare Tokio v1.18.4 release tokio-1.18.4 2023-01-03 13:06:27 -08:00
Carl Lerche 699573d550 net: fix named pipes server configuration builder
The `pipe_mode` function would erase any previously set configuration
option that is specified using the pipe_mode fit field. This patch fixes
the builder to maintain the bit field when changing the pipe mode.
2023-01-03 13:06:27 -08:00
Alice Ryhl 3d95a4626f chore: prepare Tokio v1.20.2 (#5055) tokio-1.20.2 2022-09-27 21:05:16 +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 5c76d070e2 chore: prepare Tokio v1.18.3 (#5051) tokio-1.18.3 2022-09-27 09:42:51 +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
Alice Ryhl c0746b6a30 chore: prepare Tokio v1.20.1 (#4861) tokio-1.20.1 2022-07-25 14:21:00 +02:00
Alice Ryhl b673eae342 chore: fix version detection in build script (#4860) 2022-07-25 14:14:12 +02:00
Noah Kennedy b343767725 chore: prepare Tokio v1.20.0 (#4830) tokio-1.20.0 2022-07-12 22:03:44 +00:00
Noah Kennedy be620e913d chore: fix ci by hard-coding nightly version for miri (#4825)
It would seem that the latest nightly is having issues, so I went with the one from yesterday (2022-7-10).
2022-07-12 02:14:27 +00:00
Carl Lerche ad942de2b7 chore: add a regression test for WASI (#4822)
Currently, we only have WASM regression tests that run without WASI.
However, rust provides a WASI specific target which enables code to
special case WASI. This PR adds a basic test to cover that case.

This is an initial addition to help land tokio-rs/tokio#4716.
2022-07-11 12:06:40 -07:00
Hayden Stainsby 4daeea8cad sync: add track_caller to public APIs (#4808)
Functions that may panic can be annotated with `#[track_caller]` so that
in the event of a panic, the function where the user called the
panicking function is shown instead of the file and line within Tokio
source.

This change adds `#[track_caller]` to all the public APIs in the sync
module of the tokio crate where the documentation describes how the
function may panic due to incorrect context or inputs.

In cases where `#[track_caller]` does not work, it has been left out.
For example, it currently does not work on async functions, blocks, or
closures. So any call stack that passes through one of these before
reaching the actual panic is not able to show the calling site outside
of tokio as the panic location.

The following functions have call stacks that pass through closures:
* `sync::watch::Sender::send_modify`
* `sync::watch::Sender::send_if_modified`

Additionally, in the above functions it is a panic inside the supplied
closure which causes the function to panic, and so showing the location
of the panic itself is desirable.

The following functions are async:
* `sync::mpsc::bounded::Sender::send_timeout`

Tests are included to cover each potentially panicking function.

Refs: #4413
2022-07-06 12:53:52 +02:00
Hayden Stainsby 18efef7d3b signal: add track_caller to public APIs (#4806)
Functions that may panic can be annotated with #[track_caller] so that
in the event of a panic, the function where the user called the
panicking function is shown instead of the file and line within Tokio
source.

This change adds #[track_caller] to the signal() function which is the
only function in the signal public API which can panic. Documentation
was added to this function to indicate that it may panic.

Not all panic cases can have #[track_caller] applied fully as the
callstack passes through a closure which isn't yet supported by the
annotation (e.g. signal() called from outside a tokio runtime).

Tests are included to cover the case where signal() is called from a
runtime without IO enabled.

Refs: #4413
2022-07-06 12:16:12 +02:00
Noah Kennedy d8cad13fd9 tests: alter integration tests for stdio to not use a handrolled cat implementation (#4803)
This fixes #4801, where, as a result of https://github.com/rust-lang/rust/pull/95469, our implementation of cat used for this test no longer works, as stdio functions on windows now can abort the process if the pipe is set to nonblocking mode.

Unfortunately in windows, setting one end of the pipe to be nonblocking makes the whole thing nonblocking, so when, in tokio::process we set the child pipes to nonblocking mode, it causes serious problems for any rust program at the other end.

Fixing this issue is for another day, but fixing the tests is for today.
2022-07-01 22:32:15 -05:00
Arnaud Gourlay 8ed06ef825 chore: fix typo (#4798) 2022-06-30 18:35:49 +00:00
Alice RyhlandKitsu e6020c0fed task: various small improvements to LocalKey (#4795)
Co-authored-by: Kitsu <[email protected]>
2022-06-30 10:08:41 +00:00
Alphyr 7f92bce39f tokio: use const initialized thread locals where possible (#4677) 2022-06-29 09:32:14 +00:00
Uwe Klotz 7ed2737de2 sync: Add has_changed method to watch::Ref (#4758) 2022-06-29 09:20:25 +00:00
Alice Ryhl 79d802450b chore: disable caching for cross jobs (#4794)
CI is running into https://github.com/cross-rs/cross/issues/724, which
should be fixed if we clear the cache.
2022-06-29 10:46:23 +02:00
Alice Ryhl 45f24f1b86 sync: add warning for watch in non-Send futures (#4741) 2022-06-28 23:01:35 +02:00
Hayden Stainsby b51aa8f6f9 io: add track_caller to public APIs (#4793)
Functions that may panic can be annotated with #[track_caller] so that
in the event of a panic, the function where the user called the
panicking function is shown instead of the file and line within Tokio
source.

This change adds #[track_caller] to all the non-unstable public io APIs
in the main tokio crate where the documentation describes how the
function may panic due to incorrect context or inputs.

Additionally, the documentation for `AsyncFd` was updated to indicate
that the functions `new` and `with_intent` can panic.

Tests are included to cover each potentially panicking function. The
logic to test the location of a panic (which is a little complex), has
been moved to a test support module.

Refs: #4413
2022-06-28 10:55:21 +00:00
Hayden Stainsby 3cc616877d time: add track_caller to public APIs (#4791)
Functions that may panic can be annotated with #[track_caller] so that
in the event of a panic, the function where the user called the
panicking function is shown instead of the file and line within Tokio
source.

This change adds #[track_caller] to all the non-unstable public APIs in
tokio-util where the documentation describes how the function may panic
due to incorrect context or inputs.

In cases where `#[track_caller]` does not work, it has been left out. For
example, it currently does not work on async functions, blocks, or
closures. So any call stack that passes through one of these before
reaching the actual panic is not able to show the calling site outside
of tokio as the panic location.

The public functions that could not have `#[track_caller]` added for
this reason are:
* `time::advance`

Tests are included to cover each potentially panicking function. In the
following cases, `#[track_caller]` had already been added, and only
tests have been added:
* `time::interval`
* `time::interval_at`

Refs: #4413
2022-06-27 10:40:50 +00:00
Hayden Stainsby ad412a9833 util: add track_caller to public APIs (#4785)
* util: add track_caller to public APIs

Functions that may panic can be annotated with `#[track_caller]` so that
in the event of a panic, the function where the user called the
panicking function is shown instead of the file and line within Tokio
source.

This change adds `#[track_caller]` to all the non-unstable public APIs in
tokio-util where the documentation describes how the function may panic
due to incorrect context or inputs.

In one place, an assert was added where the described behavior appeared
not to be implemented. The documentation for `DelayQueue::reserve`
states that the function will panic if the new capacity exceeds the
maximum number of entries the queue can contain. However, the function
didn't panic until a higher number caused by an allocation failure. This
is inconsistent with `DelayQueue::insert_at` which will panic if the
number of entries were to go over MAX_ENTRIES.

Tests are included to cover each potentially panicking function.

Refs: #4413

* fix tests on FreeBSD 32-bit (I hope)

Some tests were failing on FreeBSD 32-bit because the "times too far in
the future" for DelayQueue were also too far in the future for the OS.

Fixed by copying the MAX_DURATION value from where it's defined and
using it to create a duration that is just 1 more than the maximum. This
will start to break once we get close (within 2 and a bit years) of the
Epochalypse (19 Jan, 2038) - but a lot of other things are going to be
breaking on FreeBSD 32-bit by then anyway.
2022-06-27 12:31:31 +02:00
baul 55078ffec3 joinset: fix loom test without tokio_unstable (#4783) 2022-06-23 09:41:30 +02:00
Hayden Stainsby 485ca3e37c stream: add track_caller to public APIs (#4786)
Functions that may panic can be annotated with `#[track_caller]` so that
in the event of a panic, the function where the user called the
panicking function is shown instead of the file and line within Tokio
source.

This change adds `#[track_caller]` to all the non-unstable public APIs
in tokio-stream (only `chunks_timeout` in `StreamExt`) where the
documentation describes how this function may panic due to incorrect
input.

A test has been included to cover the panic.

Refs: #4413
2022-06-22 17:27:23 +00:00
Hayden Stainsby 159508b916 add track_caller to public APIs (#4413) (#4772)
Functions that may panic can be annotated with `#[track_caller]` so that
in the event of a panic, the function where the user called the
panicking function is shown instead of the file and line within Tokio
source.

This change adds track caller to all the non-unstable public APIs in
Tokio core where the documentation describes how the function may panic
due to incorrect context or inputs.  Since each internal function needs
to be annotated down to the actual panic, it makes sense to start in
Tokio core functionality.

Tests are needed to ensure that all the annotations remain in place in
case internal refactoring occurs.

The test installs a panic hook to extract the file location from the
`PanicInfo` struct and clone it up to the outer scope to check that the
panic was indeed reported from within the test file.  The downside to
this approach is that the panic hook is global while set and so we need
a lot of extra functionality to effectively serialize the tests so that
only a single panic can occur at a time.

The annotation of `block_on` was removed as it did not work. It appears
to be impossible to correctly chain track caller when the call stack to
the panic passes through clojures, as the track caller annotation can
only be applied to functions. Also, the panic message itself is very
descriptive.
2022-06-22 06:31:36 +00:00
Alice Ryhl 34b8ebbe66 sync: document spurious failures in oneshot (#4777) 2022-06-19 16:07:35 +02:00
b-naber d8fb721de2 task: improve LocalPoolHandle (#4680) 2022-06-17 18:37:00 +02:00
Carl Lerche c98be229ff rt: unhandled panic config for current thread rt (#4770)
Allows the user to configure the runtime's behavior when a spawned task
panics. Currently, the panic is propagated to the JoinHandle and the
runtime resumes. This patch lets the user set the runtime to shutdown on
unhandled panic.

So far, this is only implemented for the current-thread runtime.

Refs: #4516
2022-06-16 12:54:43 -07:00
gftea 90bc5faa7e net: be more specific about winapi features (#4764) 2022-06-16 09:52:50 +00:00
Richard Zak f26ce08f37 chore: fix spelling (#4769)
Signed-off-by: Richard Zak <[email protected]>
2022-06-15 16:06:50 +00:00
NotAFile d487c1ca34 fs: warn about performance pitfall (#4762) 2022-06-15 08:22:03 +02:00
Carl Lerche f7a64538f7 rt: clean up arguments passed to basic scheduler (#4767)
Extracts the refactor from #4518.

The basic scheduler takes many configuration options as arguments to the
constructor. This cleans it up a bit by defining a `Config` struct and
using that to pass arguments to the constructor.
2022-06-14 18:35:43 -07:00
Erick Tryzelaar 8d29edca24 time: remove src/time/driver/wheel/stack.rs (#4766)
This removes tokio/src/time/driver/wheel/stack.rs. The module was
removed in #3080, but the actual file wasn't removed in it.
2022-06-13 18:14:16 +02:00
George Pyrros 89000ca1da macros: improve the documentation for #[tokio::test] (#4761) 2022-06-13 12:47:42 +00:00
David Barsky 08d49532b4 joinset: rename join_one to join_next (#4755) 2022-06-09 22:41:25 +02:00
Alice Ryhl 340c4dc3b2 chore: prepare Tokio v1.19.2 (#4754) tokio-1.19.2 2022-06-06 17:38:28 +02:00
jefftt 7011a68343 time: add StreamExt::chunks_timeout (#4695) 2022-06-06 16:16:50 +02:00
Alice Ryhl c7280167db sync: fix will_wake usage in Notify (#4751) 2022-06-06 09:40:40 +02:00
Alice Ryhl bac7984417 chore: prepare Tokio v1.19.1 (#4750) tokio-1.19.1 2022-06-05 13:28:42 +02:00
Alice Ryhl a7e7eca893 sync: fix panic in Notified::enable (#4747) 2022-06-05 08:43:58 +02:00
Alice Ryhl 89ccf2ad2b chore: prepare tokio-stream 0.1.9 (#4743) tokio-stream-0.1.9 2022-06-04 22:04:21 +02:00
Alice Ryhl 3f8a690c01 chore: prepare tokio-macros 1.8.0 (#4742) tokio-macros-1.8.0 2022-06-04 22:04:12 +02:00
Alice Ryhl 14c77bc434 chore: prepare tokio-util 0.7.3 (#4744) tokio-util-0.7.3 2022-06-04 22:04:02 +02:00
Alice Ryhl 0241f1c54d chore: fix changelog typo (#4740) 2022-06-03 19:17:12 +00:00
Alice Ryhl 674d77d4ef chore: prepare Tokio v1.19.0 (#4738) tokio-1.19.0 2022-06-03 20:41:16 +02:00
Max IndenandTaiki Endo 42b4c27b88 net: add take_error to TcpSocket and TcpStream (#4739)
Co-authored-by: Taiki Endo <[email protected]>
2022-06-03 19:50:52 +02:00