Skip to content
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

Unstable ErrorKind in Stable branch #6650

Closed
dr-kernel opened this issue Jun 21, 2024 · 2 comments
Closed

Unstable ErrorKind in Stable branch #6650

dr-kernel opened this issue Jun 21, 2024 · 2 comments
Labels
A-tokio Area: The main tokio crate C-bug Category: This is a bug. M-io Module: tokio/io

Comments

@dr-kernel
Copy link

Version
1.38

Platform
Linux 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Description
Using a crate tokio-modbus which uses TcpStream to connect to a client. If this client isn't available (like the device is offline) I get the error:
Os { code: 113, kind: HostUnreachable, message: "No route to host" }
Looking up this "kind" is points me to rust-lang/rust#86442
https://github.com/rust-lang/rust/blob/a9c8887c7d548abc6c3e87f7d6fa02a0e95880bd/library/std/src/io/error.rs#L229-L230
This error is in the unstable branch. Why does TcpStream::connect() use this when I don't use the nightly?
tokio = { version = "1", features = ["full"] }
I couldn't actually find where this ErrorKind variant is throw aside from

#[cfg(unix)]
if err.raw_os_error() != Some(libc::EINPROGRESS) {
return Err(err);
}
which is likely an OS error?

I expected to see this happen:
See one of the stable io::Error::ErrorKinds:

 | ErrorKind::ConnectionRefused
 | ErrorKind::ConnectionReset
 | ErrorKind::ConnectionAborted

or the like
The one that's being returned is appropriate but I cannot use it if i want to continue to use stable.

Instead, this happened:
Os { code: 113, kind: HostUnreachable, message: "No route to host" }

@dr-kernel dr-kernel added A-tokio Area: The main tokio crate C-bug Category: This is a bug. labels Jun 21, 2024
@dr-kernel
Copy link
Author

dr-kernel commented Jun 21, 2024

Seems that this is a sync problem between stable and nightly use of ErrorKind. https://doc.rust-lang.org/stable/src/std/sys/pal/unix/mod.rs.html#261
I'll leave this open for now, but doesn't seem to be a tokio-rs problem but a rust std problem.

@Darksonn Darksonn added the M-io Module: tokio/io label Jun 21, 2024
@Darksonn
Copy link
Contributor

Tokio will often rely on the standard library for various kinds of logic, and when we do so, we are subject to the choices that the standard library makes. There isn't anything we can do about it.

Closing as wont-fix.

@Darksonn Darksonn closed this as not planned Won't fix, can't repro, duplicate, stale Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate C-bug Category: This is a bug. M-io Module: tokio/io
Projects
None yet
Development

No branches or pull requests

2 participants