Skip to content

Conversation

lachlan-roberts
Copy link
Contributor

@lachlan-roberts lachlan-roberts commented Jul 14, 2025

Issue #13324

Change ConnectionLimit class to operate exclusively on TCP connections by adding a onClosed notification to the AcceptListener class.

This will make it work with WebSocket where the HttpConnection is closed and replaced with a WebSocketConnection.

When upgrading to WebSocket over HTTP/2 the ConnectionLimit will only apply to the single HTTP2Connection, and not to the multiple WebSocketConnections which can be created over streams on this connection.

Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
@gregw gregw moved this to 👀 In review in Jetty 12.0.24 (FROZEN) Jul 15, 2025
@gregw gregw moved this to 👀 In review in Jetty 12.1.0 - (FROZEN) Jul 15, 2025
}
}

@Override
public void onClosed(Connection connection)
public void onClosed(SelectableChannel channel)
Copy link
Contributor

Choose a reason for hiding this comment

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

I was expecting this class to change to having two limits:

  • Channel limit: onAccepting, onAccepted - > onClosed(SelectableChannel)
  • Connection limit: onOpened(Connection) -> onClosed(Connection)

At the very least, the javadoc needs to be changed to explain that it is Channels that are being limited, not connections. If we leave it as just that, then perhaps the class name needs to be changed as well?

If the class limits both, then its name can stay the same, but more javadoc is needed.

Alternately, we have both ChannelLimit and ConnectionLimit listeners?

@joakime
Copy link
Contributor

joakime commented Jul 16, 2025

From conversation on weekly call...

Deprecate ConnectionLimit, copy code to new NetworkConnectionLimit.
Limits based on HTTP/2 streams will be handled by other things, like QoSHandler.

@gregw
Copy link
Contributor

gregw commented Jul 16, 2025

Create another class to limit virtual connections (channels)... Maybe in a different PR

@sbordet
Copy link
Contributor

sbordet commented Jul 17, 2025

I'm working on this.

sbordet added 4 commits July 17, 2025 14:07
* Deprecated ConnectionLimit and associated Jetty module, and removed their usages in favor of EndPointLimit.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
gregw
gregw previously approved these changes Jul 22, 2025
@gregw gregw dismissed sbordet’s stale review July 22, 2025 06:40

sbordet is now an author

…nLimit in a test.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Copy link
Contributor Author

@lachlan-roberts lachlan-roberts left a comment

Choose a reason for hiding this comment

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

LGTM

@sbordet sbordet merged commit bd78956 into jetty-12.0.x Jul 28, 2025
10 checks passed
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in Jetty 12.0.24 (FROZEN) Jul 28, 2025
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in Jetty 12.1.0 - (FROZEN) Jul 28, 2025
@sbordet sbordet deleted the jetty-12.0.x-13324-WebSocketConnectionLimit branch July 28, 2025 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: ✅ Done
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

ConnectionLimit doesn't work with WebSocket connections.
4 participants