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

net::tcp::tests::connect_timeout_unroutable can fail with ConnectionRefused #50065

Closed
ExpHP opened this issue Apr 18, 2018 · 6 comments · Fixed by #57584
Closed

net::tcp::tests::connect_timeout_unroutable can fail with ConnectionRefused #50065

ExpHP opened this issue Apr 18, 2018 · 6 comments · Fixed by #57584
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc C-bug Category: This is a bug. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@ExpHP
Copy link
Contributor

ExpHP commented Apr 18, 2018

When I run the libstd test suite on campus, I get a failure in net::tcp::tests::connect_timeout_unroutable:

Testing std stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.0 secs
     Running build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/std-ce5ffdd0e2e57188

running 767 tests
test collections::hash::bench::get_remove_insert ... ok
test collections::hash::bench::grow_by_insertion ... ok
test collections::hash::bench::find_existing ... ok
test collections::hash::bench::find_nonexisting ... ok
test collections::hash::bench::new_drop ... ok
...
...
test net::tcp::tests::connect_loopback ... ok
test net::tcp::tests::connect_timeout_unbound ... ok
thread '<unnamed>' panicked at 'bad error: Connection refused (os error 111) ConnectionRefused', libstd/net/tcp.rs:1687:9
test net::tcp::tests::connect_timeout_unroutable ... FAILED
test net::tcp::tests::connect_timeout_valid ... ok
test net::tcp::tests::debug ... ok
...
...
test sys::unix::ext::net::test::test_read_with_timeout ... ok
test thread::tests::test_park_timeout_unpark_called_other_thread ... ok
test sync::mpsc::tests::stress_recv_timeout_two_threads ... ok

failures:
    net::tcp::tests::connect_timeout_unroutable

test result: FAILED. 766 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out

error: test failed, to rerun pass '--lib'

The test says "this IP is unroutable, so connections should always time out," but evidently there's something about the setup at this location that was not anticipated.

The results are the same whether I am connected to WiFi or through ethernet. Both connections go through the same router (a Linksys WRT120N I have physical access to, which doesn't appear to save any sort of logs), and I don't know where it goes after that.

I can work around it by disconnecting from the internet entirely, and do not have issues when running the tests at home (same laptop, different network).

$ uname -a
Linux arch-t430s 4.15.14-1-ARCH #1 SMP PREEMPT Wed Mar 28 17:34:29 UTC 2018 x86_64 GNU/Linux
@nagisa
Copy link
Member

nagisa commented Apr 19, 2018

@ExpHP is your subnet 10.255.255.0/24 or 10.255.0.0/16 or 10.0.0.0/8 or anything similar? You can check by running ip addr.

Either way, the test is ill formed and should be correctled.

@ExpHP
Copy link
Contributor Author

ExpHP commented Apr 19, 2018

I'm not there right now, but just in case I forget to come back to this, I do recall that the router is accessed through an IP in the 192.168.x.x subnet. (I'm not sure if this precludes the situation you have described)

(I wish GitHub notifications had a "mark unread" feature!)

@ExpHP
Copy link
Contributor Author

ExpHP commented Apr 20, 2018

It appears not to be.

wifi

3: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 84:3a:4b:87:6e:9c brd ff:ff:ff:ff:ff:ff
    inet 129.161.90.210/23 brd 129.161.91.255 scope global dynamic noprefixroute wlp3s0
       valid_lft 429sec preferred_lft 429sec
    inet6 2620:0:2820:a0b:814a:5875:4e4:ae1/64 scope global dynamic noprefixroute 
       valid_lft 2591944sec preferred_lft 604744sec
    inet6 fe80::36a6:1d37:ada:bea3/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

ethernet:

2: enp0s25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 54:ee:75:24:59:1b brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.107/24 brd 192.168.1.255 scope global dynamic noprefixroute enp0s25
       valid_lft 56623sec preferred_lft 56623sec
    inet6 fe80::c384:e1ac:e2fb:3690/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

@sfackler
Copy link
Member

I think I must have misread something when making that test - the IP is inside of an address block reserved for private networks which means it could be routable depending on how your network is set up.

We could instead use an IP from one of the documentation blocks like 192.0.2.0.

@XAMPPRocky XAMPPRocky added A-testsuite Area: The testsuite used to check the correctness of rustc T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Aug 27, 2018
@nnethercote
Copy link
Contributor

The address 10.255.255.1 is routable on my vanilla Ubuntu 18.04 box:

[gulf:~] ping 10.255.255.1
PING 10.255.255.1 (10.255.255.1) 56(84) bytes of data.
64 bytes from 10.255.255.1: icmp_seq=1 ttl=250 time=14.8 ms
64 bytes from 10.255.255.1: icmp_seq=2 ttl=250 time=14.4 ms
64 bytes from 10.255.255.1: icmp_seq=3 ttl=250 time=15.3 ms
64 bytes from 10.255.255.1: icmp_seq=4 ttl=250 time=14.7 ms
^C
--- 10.255.255.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 14.455/14.859/15.366/0.326 ms

The address 192.0.2.0 is not routable:

[gulf:~] ping 192.0.2.0
PING 192.0.2.0 (192.0.2.0) 56(84) bytes of data.
^C
--- 192.0.2.0 ping statistics ---
4 packets transmitted, 0 received, 100% packet loss, time 3075ms

Therefore, this test always fails on this box. I will file a PR changing it to 192.0.2.0.

@nnethercote
Copy link
Contributor

This is a dup of #44698.

nnethercote added a commit to nnethercote/rust that referenced this issue Jan 11, 2019
Because the current address is reachable on some machines, which causes
the test to fail.

Fixes rust-lang#44698, rust-lang#50065.
nnethercote added a commit to nnethercote/rust that referenced this issue Jan 13, 2019
It requires an unreachable IP address, but there is no such thing, and
this has caused it to fail for multiple people.

Fixes rust-lang#44698, fixes rust-lang#50065.
Centril added a commit to Centril/rust that referenced this issue Jan 14, 2019
…utable, r=sfackler

Remove the `connect_timeout_unroutable` test.

It requires an unreachable IP address, but there is no such thing, and
this has caused it to fail for multiple people.

Fixes rust-lang#44698, fixes rust-lang#50065.

r? @sfackler
Centril added a commit to Centril/rust that referenced this issue Jan 14, 2019
…utable, r=sfackler

Remove the `connect_timeout_unroutable` test.

It requires an unreachable IP address, but there is no such thing, and
this has caused it to fail for multiple people.

Fixes rust-lang#44698, fixes rust-lang#50065.

r? @sfackler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc C-bug Category: This is a bug. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
5 participants