-
-
Notifications
You must be signed in to change notification settings - Fork 16k
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
DnsNameResolver hangs for 5 seconds in InetAddress.getAllByName0 on Mac OSX #6454
Comments
The more I think about it, the more I realise it is a) actually related to defaultProcessId Feel free to close as not an issue, just raiding as it was surprising and annoying |
Working around with -Dio.netty.processId=$$ |
WIll take a look |
adding system property
should help avoid the problem |
The current method of pulling the process id is a bit of a hack since it relies on VMManagementImpl.getVmId however this now seems to be the common way of obtaining it for a lot of projects < JDK9.
Java 9 provides an API to pull the process id. long pid = ProcessHandle.current().getPid(); @normanmaurer not sure there is much that can be done apart from time how long it takes and issue a warn if it exceeds a threshold, or implement pulling the pid via Java 9 API using reflection, that said this seems like a machine misconfiguration not an issue with Netty.. but just so you know @yschimke, Norman loves contributions ;) |
I'm approved at work for my own projects, Finagle, OkHttp but didn't ask for Netty. I don't have that much spare time so it's not worth the CLA effort just for this fix. |
BTW I agree about the misconfiguration, I fixed this on my machine and also commented with a workaround. Two things set off my spidey sense
|
It looks like an Mac OSX issue (resolution of the local host must happens inside java.lang.management.RuntimeMXBean#getName() causing the delay). The StackOverflow solution remove the delay. |
Let me close this issue for now as I think with PR #6592 we should no longer require JDK DNS resolution as part of codec-dns's initialization |
Expected behavior
DnsNameResolver constructor should be fast, anything slow offloaded until actually used. Or a warning given that environment in badly configured.
This is an environmental problem, but raising because its a regression from java DNS which doesn't hang like this.
Feel free to close if you don't want to worry about it in Netty.
Actual behavior
constructor hangs at program startup
Steps to reproduce
started Sat Feb 25 13:17:16 GMT 2017
finished Sat Feb 25 13:17:21 GMT 2017
Fix
Fix is http://justthesam.com/2016/10/fixing-java-net-inet6addressimpl-lookupallhostaddr-slowdown/
Netty version
4.1.8.Final
JVM version (e.g.
java -version
)$ java -version
java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+157)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+157, mixed mode)
OS version (e.g.
uname -a
)Darwin xxx 16.4.0 Darwin Kernel Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64 x86_64
The text was updated successfully, but these errors were encountered: