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

Fix #356 - expand idle timeouts #377

Closed
wants to merge 1 commit into from

Conversation

markt-asf
Copy link
Contributor

No description provided.

Copy link
Contributor

@joakime joakime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fan of the split idle timeouts.

Socket timeouts are traditionally SO_TIMEOUT which is neutral to read/write anyway.

We still haven't addressed what the existing setMaxIdleTimeout(long) means if these new methods exist.

@markt-asf
Copy link
Contributor Author

I've tried to clarify the language.

This change was prompted by a user request. The scenario was something like the server was sending messages every 10s and the client was sending messages every minute. They wanted to be able to detect that the client had stopped sending messages and the combined read/write idle timeout couldn't do that. Hence the request for separate read/write idle timeouts.

I did think about ways to remove the combined read/write idle timeout and/or convert it to the individual read and write timeouts but logically it just doesn't work.

@jansupol
Copy link
Contributor

jansupol commented Nov 4, 2021

This looks ok by me. I like the clarification for zero and negative values. The cons for this PR is that an extra thread would get consumed, currently a thread checks for read and write timeout, now there would be one thread for each (if read and write timeout differs). This can be an issue in an application server that defines a pool of threads and the default is very low, The customers are often used to having pools with just one or two threads, unfortunately.
@joakime WDYT?

@joakime
Copy link
Contributor

joakime commented Nov 4, 2021

Eclipse Jetty is 100% async, any blocking concepts (like what exists in the Servlet spec) are faked.
A websocket connection doesn't have a dedicated thread like this PR is proposing.
Having separate read/write timeouts is actually just introducing ridiculous scheduler requirements.
On some of our servers, with 200,000 active websocket connections, this is a new requirement that isn't possible to satisfy.

@joakime
Copy link
Contributor

joakime commented Nov 4, 2021

A connection has an overall idle timeout, and activity resets the overall timeout.
This works even in the half-closed tcp socket scenarios, and satisfies the half-closed websocket closed handshake scenarios as well.

Hell, even Java itself doesn't have this kind of split on read vs write idle timeout.

@joakime
Copy link
Contributor

joakime commented Nov 4, 2021

I also don't like what this PR implies for the behaviors on WebSocket over HTTP/2 (Which Eclipse Jetty supports) and WebSocket over HTTP/3 (Which we have prelim support for).
These also have overall idle timeout, WS+HTTP/2 with a virtual stream via a mux'd TCP connection, and WS+HTTP/3 being a stream over UDP.

*
* @param milliseconds the number of milliseconds.
*/
void setMaxIdleTimeout(long milliseconds);

/**
* Return the number of milliseconds before this conversation may be closed by the container if no messages are
* received in that time. A value that is zero or negative indicates that this timeout will not be used. The general
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Complete message? (all data frames?)
Partial message? (some data frames? an incomplete data frame?)
Control frame?
Reset on receive of traffic?
Or reset on delivery of data frame? or any frame? or even auto-fragmented frame?
What if the connection has higher level activity not within websocket (eg: http/2 stream specific details, or http/3 stream specific details)?


/**
* Return the number of milliseconds before this conversation may be closed by the container if no messages are
* sent in that time. A value that is zero or negative indicates that this timeout will not be used. The general
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sent by what?
The application has requested a send?
The extension has enough information to send something?
The websocket connection has sent it?
The HTTP/2 stream has sent it?
The TCP connection has sent it?
The HTTP/3 stream has sent it? Do we wait for confirmation on HTTP/3 of the send?

@joakime
Copy link
Contributor

joakime commented Nov 4, 2021

There's a reason why there's no separation of read vs write idle timeout on low level Socket connections.
I'm in 100% support of fixing the language around the one idle timeout, but not in introducing the split read vs write.

@markt-asf
Copy link
Contributor Author

I agree clarifying the language around the current idle timeout would be helpful. Since this is a WebSocket level timeout, I think it should be defined in terms of WebSocket and not any underlying protocol. How about something like:

  • for read, any WebSocket data (frame or part of a frame) is received from the underlying protocol
  • for write, any WebSocket data (frame or part of a frame) is written to the underlying protocol

as a starting point?

While this clarification is useful, it does not address the original feature request from the user. If separate read/write idle timeouts are not acceptable how do you propose we meet the original requirement set out in #356?

@joakime
Copy link
Contributor

joakime commented Nov 4, 2021

Lets continue to talk in #356

@markt-asf
Copy link
Contributor Author

Closing this PR. See #383 for the replacement.

@markt-asf markt-asf closed this Nov 10, 2021
@markt-asf markt-asf deleted the issue-356 branch November 10, 2021 14:15
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