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

test connect_timeout does not seem to work #42

Open
stepga opened this issue Feb 26, 2022 · 11 comments
Open

test connect_timeout does not seem to work #42

stepga opened this issue Feb 26, 2022 · 11 comments
Assignees
Labels
bug Something isn't working

Comments

@stepga
Copy link
Contributor

stepga commented Feb 26, 2022

26 of the 27 test pass, excluding connect_timeout.

instead of resulting in a timeout, ssh seems to fail with:
"connect to host 192.0.0.8 port 22: Network is unreachable"

when changing the test's host ip e.g. to the google dns 8.8.8.8 it works.

@NobodyXu
Copy link
Member

Just run it again.

Sometimes timeout might fail, but it usually works.

@NobodyXu
Copy link
Member

BTW, this is related to #41 , so I expected you to post this in the Pull Request

@NobodyXu
Copy link
Member

@stepga If the problem is solved, can we close this issue?

@stepga
Copy link
Contributor Author

stepga commented Feb 26, 2022

Just run it again.
Sometimes timeout might fail, but it usually works.

Strange. It fails reproducibly every time I run run_ci_tests.sh

BTW, this is related to #41 , so I expected you to post this in the Pull Request

This happens on origin/master 26e275654768519a0e3f676e5473d86b43228816.
edit: fixed commit

@NobodyXu
Copy link
Member

Strange. It fails reproducibly every time I run run_ci_tests.sh

That is definitely strange.

This happens on origin/master e1c02a7.

Can you try the latest commit of master?

@stepga
Copy link
Contributor Author

stepga commented Feb 26, 2022

Strange. It fails reproducibly every time I run run_ci_tests.sh

That is definitely strange.

This happens on origin/master e1c02a7.

Can you try the latest commit of master?

i updated/edited the former post: this happens for me with 26e2756

@NobodyXu
Copy link
Member

instead of resulting in a timeout, ssh seems to fail with:
"connect to host 192.0.0.8 port 22: Network is unreachable"

when changing the test's host ip e.g. to the google dns 8.8.8.8 it works.

Looking at the error message, this actually matches the host used in connect_timeout.

The test basically specifies a random host and port, expects ssh connection to fail, it is not very robust.

Although I don't understand why changing the host ip fixed the problem.

@NobodyXu
Copy link
Member

NobodyXu commented Mar 1, 2022

@jonhoo I don't think I can figure a solution to this one.

Can you please lend me some help here?

@NobodyXu NobodyXu added the bug Something isn't working label Mar 4, 2022
@NobodyXu NobodyXu self-assigned this Mar 4, 2022
@jonhoo
Copy link
Collaborator

jonhoo commented Mar 4, 2022

Hmm, this sounds an awful lot like you have firewall rules that treat 192.0.0.8 specially. Or maybe that somehow matches your own local network? I think we need more info here, like your OS, the firewall you're using (if any), and your local network config (ip + netmask).

@jaystile
Copy link

I am seeing a similar issue when I try to ssh to an IP address that is only exposed when my VPN is on.

ssh will hang indefinitely if the ConnectTimeout is not set, but will finish if the ConnectTimeout is set.

ssh 172.16.1.2 -o ConnectTimeout=1
ssh: connect to host 172.16.1.2 port 22: Connection timed out

The example in my code appears to hang forever which indicates that the ConnectTimeout is not being passed correctly. The code works fine when my VPN is enabled.

let _sb = SessionBuilder::default()
        .connect_timeout(Duration::new(2, 0))
        .known_hosts_check(KnownHosts::Accept)
        .connect("172.16.1.2")
        .await;

@stilesj-uchicago
Copy link

Now it is working for me. I didn't change anything, so I am confused. You can ignore my previous comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

5 participants