-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
Remove DNS lookups during websocket connection initiation #28280
Comments
There are two classes named |
I'm afraid the issue is not resolved. The AbstractStandardUpgradeStrategy still tries to get InetSocketAddresses during upgrade:
and ServerHttpRequest uses constructor of InetSocketAddress, which performs DNS lookup:
(checked on spring 5.3.20 and java 17) |
@lrgrz, this issue was closed back in April. If you think you have discovered a bug or regression, please create a new issue to address that. Thanks |
The
ServletServerHttpRequest
getLocalAddress
andgetRemoteAddress
methods contain additional DNS queries. TheservletRequest.getLocalName()
method requests ahostname
from an IP address, and theInetSocketAddress
constructor callsInetAddress.getByName
, which requests an IP address from ahostname
.It looks like these requests can be omitted if you use
servletRequest.getLocalAddr()
andservletRequest.getRemoteAddr()
instead ofget*Name()
methods.If DNS is not properly configured on the server, then the establishment of a
websocket
connection hangs (for a few seconds).Problematic stack trace:
The impression is that these addresses are not even used by Spring, but are only needed to ensure the operation of the
WebSocketSession
methodsgetLocalAddress()
andgetRemoteAddress()
, and we don't use these methods at all.The text was updated successfully, but these errors were encountered: