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

Client spews "Setting timeout of" messages #1864

Closed
larseggert opened this issue Apr 30, 2024 · 6 comments · Fixed by #1866
Closed

Client spews "Setting timeout of" messages #1864

larseggert opened this issue Apr 30, 2024 · 6 comments · Fixed by #1866

Comments

@larseggert
Copy link
Collaborator

Running the test/test.sh script generates a ton of messages like

0s356ms DEBUG [Client e4cf3ef0326dc9b16338] pn=9 type=Short pri-path:1bf8e83784f7e3129ce7 0.0.0.0:53440->127.0.0.1:4433 IpTos(Cs0, NotEct)
  TX -> ConnectionClose { error_code: Application(0), frame_type: 0, reason_phrase: [107, 116, 104, 120, 98, 121, 101, 33] }
0s357ms DEBUG [LossRecovery] packet ap-9 sent
0s357ms DEBUG Setting timeout of 141.61858ms
0s357ms DEBUG Setting timeout of 141.612121ms
0s357ms DEBUG Setting timeout of 141.607246ms
0s357ms DEBUG Setting timeout of 141.602788ms
0s357ms DEBUG Setting timeout of 141.598496ms
0s357ms DEBUG Setting timeout of 141.594246ms
0s357ms DEBUG Setting timeout of 141.590163ms
0s357ms DEBUG Setting timeout of 141.58608ms
0s357ms DEBUG Setting timeout of 141.581955ms
0s357ms DEBUG Setting timeout of 141.577871ms

after the client closes the connection.

Anyone got any idea where those come from? Maybe @mxinden?
client.log

@mxinden
Copy link
Collaborator

mxinden commented Apr 30, 2024

Both the client and the server log when setting a timeout (aka. callback):

Output::Callback(new_timeout) => {
qdebug!("Setting timeout of {:?}", new_timeout);
self.timeout = Some(Box::pin(tokio::time::sleep(new_timeout)));
break;
}

Output::Callback(new_timeout) => {
qdebug!("Setting timeout of {:?}", new_timeout);
self.timeout = Some(Box::pin(tokio::time::sleep(new_timeout)));
break;
}

I am not sure why the client continuously sets the same timeout.

after the client closes the connection.

I would expect the client to break out of the run loop once the connection is closed.

// no more work, connection closed, terminating
(true, true) => break,

I can take a deeper look in the next couple of days.

@martinthomson
Copy link
Member

martinthomson commented May 1, 2024

This is probably the PTO time for the request. Once the client has sent its requests, it will need to wait for a response. This is what that waiting looks like.

We should just bump that message down to TRACE. If it is as commonplace as it is, then we don't need to see it in logs.

@larseggert
Copy link
Collaborator Author

But why would the client busy-wait like this? There are thousands of these in the log.

@martinthomson
Copy link
Member

Is there some way in which the tokio select would exit early? The expected outcome is that the client should indicate it wants to wait for a PTO. The next thing should either be a new datagram arriving or the PTO expiring.

@martinthomson
Copy link
Member

Ahh, I think that I can see what is happening. We're setting self.timeout, but we don't bother to tell the socket about it. The recv call therefore just polls without delay.

I think that the fix here is to have process_multiple_input exit once the timeout becomes Some. Otherwise, yes, the loop is a busy one.

@mxinden
Copy link
Collaborator

mxinden commented May 2, 2024

The problematic instruction is this continue, continuously closing an already closing connection:

(true, false) => {
self.client.close(Instant::now(), 0, "kthxbye!");
continue;
}

#1866 fixes the issue.

Regression introduced in #1837. Sorry about that. Thank you for raising it.

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 a pull request may close this issue.

3 participants