-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Fixes #10806 - cache local and remote socket address in EndPoint for benefit of RequestLog #10815
Conversation
…benefit of RequestLog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazed we have not noticed this before!
jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/SelectableChannelEndPoint.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/SelectableChannelEndPoint.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/SelectableChannelEndPoint.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/SelectableChannelEndPoint.java
Outdated
Show resolved
Hide resolved
@joakime I've pushed a bit more adventurous cleanup of local/remote addresses to this PR. Thoughts? |
Interesting, kinda like it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is right.
What about the case of socket address reuse?
If it's just a problem of the request log, it probably should be fixed there rather than returning cached addresses that may be used in completely different contexts where returning a cached address is not right.
For example clients may behave differently from servers.
Also, in QUIC the remote address may change dynamically, so we don't want to cache.
The RequestLog
is passed _request.getLoggedRequest()
, so we can easily wrap the "logged" request and cache the socket addresses there, rather than everywhere else.
The problem is way down in the Java Impl. |
I'm working on an alternative approach suggested by a conversation with @sbordet, i'll submit that as a new PR. |
I think there might be some goodness in the cleanup in this PR even if we don't make addresses immutable in end points. So, before closing this one, please look to see if any of the changes make sense if we don't make the addresses immutable. |
Dropping in favor of #10867 |
The EndPoint local-address and remote-address are inaccessible once the EndPoint is closed due to "ensureOpen" checks by the Java implementation itself.
This PR merely caches the local-address and remote-address in the EndPoint classes to be accessed if unable to get the attempt to get the SocketAddress from the Channel fails due to a
ClosedChannelException
.Fixes: #10806