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 timeout #61

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Test timeout #61

wants to merge 1 commit into from

Conversation

RCasatta
Copy link
Member

I noticed timeout parameter is not approximately equal to the time measured with the included test.

timeout=1 -> elapsed 4s
timeout=2 -> elapsed 6s
timeout=3 -> elapsed 8s
timeout=4-> elapsed 10s

@afilini
Copy link
Member

afilini commented Jan 21, 2022

Ok I spent some time debugging this: I was wrong when I told you that you need to send an explicit ping, it look like this is done internally right after connecting to the server.

So this explains why we have the "2x timeout" part of the final time.

What I still don't understand is why there's the "+ 2" part. Looking at strace I can see that there's a 2s sleep right after it fails to receive anything (you can see recvfrom returning after 1s with EAGAIN)

[pid 16177]      0.000134 sendto(5, "{\"jsonrpc\":\"2.0\",\"id\":0,\"method\":\"server.ping\",\"params\":[]}\n", 60, MSG_NOSIGNAL, NULL, 0) = 60
[pid 16177]      0.000197 recvfrom(5, 0x77d448000fc0, 8192, 0, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
[pid 16177]      1.047175 clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=2, tv_nsec=0}, 0x77d44faed480) = 0 (????)
[pid 16177]      2.000259 socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, IPPROTO_IP) = 6

@afilini
Copy link
Member

afilini commented Jan 21, 2022

Ah, got it, that's the retry timeout:

std::thread::sleep(std::time::Duration::from_secs((1 << errors.len()).min(30) as u64));

Since we push the error before sleeping, it will sleep for 1 << 1 so two seconds

@notmandatory
Copy link
Member

This is pretty old, is it still something we need and should I target this for the next release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants