-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
IPv6 & IPv4 use same port crash. #6259
Comments
dryBranch
added
A-tokio
Area: The main tokio crate
C-bug
Category: This is a bug.
labels
Jan 1, 2024
I check it with use std::{thread, net::TcpListener};
fn main() {
thread::spawn(|| {
let addr = "[::]:21000";
let l1 = TcpListener::bind(addr).unwrap();
println!("listen {addr}");
while let Ok(_) = l1.accept() { }
});
let addr = "0.0.0.0:21000";
let l2 = TcpListener::bind(addr).unwrap();
println!("listen {addr}");
while let Ok(_) = l2.accept() { }
} output pi@raspbian:~/workspace/rust/std_2stack$ RUST_BACKTRACE=full cargo r
Finished dev [unoptimized + debuginfo] target(s) in 0.05s
Running `target/debug/std_2stack`
listen 0.0.0.0:21000
thread '<unnamed>' panicked at src/main.rs:6:42:
called `Result::unwrap()` on an `Err` value: Os { code: 98, kind: AddrInUse, message: "Address already in use" }
stack backtrace:
0: 0xaaaacfb9745c - std::backtrace_rs::backtrace::libunwind::trace::heaab0e590535aeb3
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: 0xaaaacfb9745c - std::backtrace_rs::backtrace::trace_unsynchronized::h89cc7ae9ebb707d7
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0xaaaacfb9745c - std::sys_common::backtrace::_print_fmt::h08c31be18fedf422
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/sys_common/backtrace.rs:67:5
3: 0xaaaacfb9745c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc38bcf44d9e857e3
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/sys_common/backtrace.rs:44:22
4: 0xaaaacfbb5590 - core::fmt::rt::Argument::fmt::ha5b752f9cd7ef4a3
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/fmt/rt.rs:138:9
5: 0xaaaacfbb5590 - core::fmt::write::h9fac187ae7486f3c
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/fmt/mod.rs:1094:21
6: 0xaaaacfb94bec - std::io::Write::write_fmt::h239e9fb6296b3a7f
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/io/mod.rs:1714:15
7: 0xaaaacfb97290 - std::sys_common::backtrace::_print::h52f67cfa8753b0ab
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/sys_common/backtrace.rs:47:5
8: 0xaaaacfb97290 - std::sys_common::backtrace::print::hdea7481e2c957a93
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/sys_common/backtrace.rs:34:9
9: 0xaaaacfb98914 - std::panicking::default_hook::{{closure}}::h7c36fa733369c49e
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:270:22
10: 0xaaaacfb9863c - std::panicking::default_hook::h303eee75f9a8f6a8
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:290:9
11: 0xaaaacfb98ed8 - std::panicking::rust_panic_with_hook::h270c94381ec34744
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:707:13
12: 0xaaaacfb98da0 - std::panicking::begin_panic_handler::{{closure}}::h3653e3502bcc1625
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:599:13
13: 0xaaaacfb97940 - std::sys_common::backtrace::__rust_end_short_backtrace::h6b8510f2f024eeeb
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/sys_common/backtrace.rs:170:18
14: 0xaaaacfb98af0 - rust_begin_unwind
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:595:5
15: 0xaaaacfb77b48 - core::panicking::panic_fmt::ha96945d7a1b20293
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/panicking.rs:67:14
16: 0xaaaacfb77df8 - core::result::unwrap_failed::h52241e4ea1d20f58
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/result.rs:1652:5
17: 0xaaaacfb78970 - core::result::Result<T,E>::unwrap::h9d2314d6532c8147
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/result.rs:1077:23
18: 0xaaaacfb781c4 - std_2stack::main::{{closure}}::h51b1b4cdf5bb3546
at /home/pi/workspace/rust/std_2stack/src/main.rs:6:18
19: 0xaaaacfb7d62c - std::sys_common::backtrace::__rust_begin_short_backtrace::hb4c68872210fde64
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/sys_common/backtrace.rs:154:18
20: 0xaaaacfb7941c - std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}::h43d078fe3205bc73
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/thread/mod.rs:529:17
21: 0xaaaacfb7ac98 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h93cb94ccb1f01cbe
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/panic/unwind_safe.rs:271:9
22: 0xaaaacfb7a5c0 - std::panicking::try::do_call::hf08588a377ef1f93
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:502:40
23: 0xaaaacfb7a708 - __rust_try
24: 0xaaaacfb7a528 - std::panicking::try::h27af41256150c21e
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:466:19
25: 0xaaaacfb792dc - std::panic::catch_unwind::hd6591bdffec6a4a9
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panic.rs:142:14
26: 0xaaaacfb792dc - std::thread::Builder::spawn_unchecked_::{{closure}}::hefebfafc9a3e9d6b
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/thread/mod.rs:528:30
27: 0xaaaacfb7b724 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h3099d65634de8f49
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/ops/function.rs:250:5
28: 0xaaaacfb9af64 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h01303c6de09f5469
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/alloc/src/boxed.rs:2007:9
29: 0xaaaacfb9af64 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h4f39e7995f973f4c
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/alloc/src/boxed.rs:2007:9
30: 0xaaaacfb9af64 - std::sys::unix::thread::Thread::new::thread_start::h9f792bc0c268271e
at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/sys/unix/thread.rs:108:17
31: 0xffffafc417e4 - start_thread
32: 0xffffafb8359c - <unknown>
33: 0x0 - <unknown>
^C |
That's just how it works on Linux. You can search for the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version
pi@raspbian:~/workspace/rust/tokio_2stack$ cargo tree | rg tokio
tokio_2stack v0.1.0 (/home/pi/workspace/rust/tokio_2stack)
└── tokio v1.35.1
└── tokio-macros v2.2.0 (proc-macro)
Platform
pi@raspbian:~/workspace/rust/tokio_2stack$ uname -a
Linux raspbian 5.10.78-Release-OPENFANS+20211111-v8 #1 SMP PREEMPT Thu Nov 11 15:43:52 CST 2021 aarch64 GNU/Linux
Description
use IPv6
[::]
and IPv40.0.0.0
and use same port(eg.21000
) crash in my raspberry pi4.[::1]
&127.0.0.1
[::]
alone.[short summary of the bug]
I tried this code:
[code sample that causes the bug]
I expected to see this happen: [explanation]
Windows Env outputs
Instead, this happened: [explanation]
Additional Backtrace
The text was updated successfully, but these errors were encountered: