mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-06 00:00:10 +02:00
Merge 'tokio-1.43.2' into 'tokio-1.47.x' (#7503)
This commit is contained in:
@@ -240,6 +240,14 @@ comment on [#7172].
|
|||||||
[#7186]: https://github.com/tokio-rs/tokio/pull/7186
|
[#7186]: https://github.com/tokio-rs/tokio/pull/7186
|
||||||
[#7192]: https://github.com/tokio-rs/tokio/pull/7192
|
[#7192]: https://github.com/tokio-rs/tokio/pull/7192
|
||||||
|
|
||||||
|
# 1.43.2 (August 1st, 2025)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- process: fix panic from spurious pidfd wakeup ([#7494])
|
||||||
|
|
||||||
|
[#7494]: https://github.com/tokio-rs/tokio/pull/7494
|
||||||
|
|
||||||
# 1.43.1 (April 5th, 2025)
|
# 1.43.1 (April 5th, 2025)
|
||||||
|
|
||||||
This release fixes a soundness issue in the broadcast channel. The channel
|
This release fixes a soundness issue in the broadcast channel. The channel
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ impl<E: Source> PollEvented<E> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a reference to the registration.
|
/// Returns a reference to the registration.
|
||||||
#[cfg(feature = "net")]
|
#[cfg(any(feature = "net", all(feature = "process", target_os = "linux")))]
|
||||||
pub(crate) fn registration(&self) -> &Registration {
|
pub(crate) fn registration(&self) -> &Registration {
|
||||||
&self.registration
|
&self.registration
|
||||||
}
|
}
|
||||||
@@ -138,14 +138,6 @@ impl<E: Source> PollEvented<E> {
|
|||||||
Ok(inner)
|
Ok(inner)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "process", target_os = "linux"))]
|
|
||||||
pub(crate) fn poll_read_ready(&self, cx: &mut Context<'_>) -> Poll<io::Result<()>> {
|
|
||||||
self.registration
|
|
||||||
.poll_read_ready(cx)
|
|
||||||
.map_err(io::Error::from)
|
|
||||||
.map_ok(|_| ())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Re-register under new runtime with `interest`.
|
/// Re-register under new runtime with `interest`.
|
||||||
#[cfg(all(feature = "process", target_os = "linux"))]
|
#[cfg(all(feature = "process", target_os = "linux"))]
|
||||||
pub(crate) fn reregister(&mut self, interest: Interest) -> io::Result<()> {
|
pub(crate) fn reregister(&mut self, interest: Interest) -> io::Result<()> {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ use std::{
|
|||||||
pin::Pin,
|
pin::Pin,
|
||||||
process::ExitStatus,
|
process::ExitStatus,
|
||||||
sync::atomic::{AtomicBool, Ordering::Relaxed},
|
sync::atomic::{AtomicBool, Ordering::Relaxed},
|
||||||
task::{ready, Context, Poll},
|
task::{Context, Poll},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@@ -117,17 +117,21 @@ where
|
|||||||
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
||||||
let this = Pin::into_inner(self);
|
let this = Pin::into_inner(self);
|
||||||
|
|
||||||
match ready!(this.pidfd.poll_read_ready(cx)) {
|
match this.pidfd.registration().poll_read_ready(cx) {
|
||||||
Err(err) if is_rt_shutdown_err(&err) => {
|
Poll::Ready(Ok(evt)) => {
|
||||||
this.pidfd.reregister(Interest::READABLE)?;
|
if let Some(exit_code) = this.inner.try_wait()? {
|
||||||
ready!(this.pidfd.poll_read_ready(cx))?
|
return Poll::Ready(Ok(exit_code));
|
||||||
|
}
|
||||||
|
this.pidfd.registration().clear_readiness(evt);
|
||||||
}
|
}
|
||||||
res => res?,
|
Poll::Ready(Err(err)) if is_rt_shutdown_err(&err) => {}
|
||||||
}
|
Poll::Ready(Err(err)) => return Poll::Ready(Err(err)),
|
||||||
Poll::Ready(Ok(this
|
Poll::Pending => return Poll::Pending,
|
||||||
.inner
|
};
|
||||||
.try_wait()?
|
|
||||||
.expect("pidfd is ready to read, the process should have exited")))
|
this.pidfd.reregister(Interest::READABLE)?;
|
||||||
|
cx.waker().wake_by_ref();
|
||||||
|
Poll::Pending
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
#![cfg(feature = "process")]
|
||||||
|
#![warn(rust_2018_idioms)]
|
||||||
|
#![cfg(target_os = "linux")]
|
||||||
|
#![cfg(not(miri))]
|
||||||
|
|
||||||
|
use tokio::process::Command;
|
||||||
|
use tokio::time::{sleep, Duration};
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn issue_7144() {
|
||||||
|
let mut threads = vec![];
|
||||||
|
for _ in 0..20 {
|
||||||
|
threads.push(tokio::spawn(test_one()));
|
||||||
|
}
|
||||||
|
for thread in threads {
|
||||||
|
thread.await.unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn test_one() {
|
||||||
|
let mut t = Command::new("strace")
|
||||||
|
.args("-o /dev/null -D sleep 5".split(' '))
|
||||||
|
.spawn()
|
||||||
|
.unwrap();
|
||||||
|
sleep(Duration::from_millis(100)).await;
|
||||||
|
unsafe { libc::kill(t.id().unwrap() as _, libc::SIGINT) };
|
||||||
|
t.wait().await.unwrap();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user