I'm early in the stages of working on a JavaFX app and I thought, "why not update my JDK to the latest version?". However, after updating, the program takes forever to load! Specifically, before my main method it appears to hang, on loading the class java.net.Inet4AddressImpl
.
Output of java -verbose -jar /path/to/jarfile.jar
:
[Loaded java.net.Inet6AddressImpl from /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/rt.jar]
[Loaded sun.net.spi.nameservice.NameService from /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/rt.jar]
[Loaded java.net.InetAddress$2 from /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/rt.jar]
[Loaded java.net.Inet4Address from /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/rt.jar]
[Loaded java.net.Inet6Address from /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/rt.jar]
[Loaded java.net.Inet6Address$Inet6AddressHolder from /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/rt.jar]
Here it lags for a full five seconds... then continues.
[Loaded java.net.Inet4AddressImpl from /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/rt.jar]
[Loaded sun.net.InetAddressCachePolicy from /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/rt.jar]
[Loaded sun.net.InetAddressCachePolicy$1 from /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/rt.jar]
[Loaded sun.net.InetAddressCachePolicy$2 from /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/rt.jar]
And so on until the application launches.
This started when switching from JDK 1.8.0_25
to 1.8.0_131
It does not seem that java.net.Inet4AddressImpl
lags other random jars I tried to launch.
I'm a bit lost on how to troubleshoot this at this point.
Edit: @Holger suggested a thread dump on the freeze and that it's probably the instantiation of the class beforehand. Well, here is what the JavaFX Application Thread is up to! Seems like it is stuck on a native method Inet6AddressImpl.lookupAllHostAddr(String)
. Certainly seems like some native DNS handling gone wrong.
Thread [JavaFX Application Thread] (Suspended)
owns: Object (id=27)
owns: LogbackLock (id=28)
Inet6AddressImpl.lookupAllHostAddr(String) line: not available [native method]
InetAddress$2.lookupAllHostAddr(String) line: 928
InetAddress.getAddressesFromNameService(String, InetAddress) line: 1323
InetAddress.getLocalHost() line: 1500
ContextUtil.getLocalHostName() line: 38
ContextUtil.addHostNameAsProperty() line: 74
ConfigurationAction.begin(InterpretationContext, String, Attributes) line: 57
Interpreter.callBeginAction(List<Action>, String, Attributes) line: 275
Interpreter.startElement(String, String, String, Attributes) line: 147
Interpreter.startElement(StartEvent) line: 129
EventPlayer.play(List<SaxEvent>) line: 50
JoranConfigurator(GenericConfigurator).doConfigure(List<SaxEvent>) line: 149
JoranConfigurator(GenericConfigurator).doConfigure(InputSource) line: 135
JoranConfigurator(GenericConfigurator).doConfigure(InputStream) line: 99
JoranConfigurator(GenericConfigurator).doConfigure(URL) line: 49
ContextInitializer.configureByResource(URL) line: 75
ContextInitializer.autoConfig() line: 148
StaticLoggerBinder.init() line: 85
StaticLoggerBinder.<clinit>() line: 55
LoggerFactory.bind() line: 128
LoggerFactory.performInitialization() line: 107
LoggerFactory.getILoggerFactory() line: 295
LoggerFactory.getLogger(String) line: 269
LoggerFactory.getLogger(Class) line: 281
App.<clinit>() line: 11
Class<T>.forName0(String, boolean, ClassLoader, Class<?>) line: not available [native method]
Class<T>.forName(String, boolean, ClassLoader) line: 348
LauncherImpl.lambda$launchApplicationWithArgs$156(String, ClassLoader, AtomicReference, String, AtomicReference) line: 352
546718765.run() line: not available
PlatformImpl.lambda$runAndWait$175(Runnable, CountDownLatch) line: 326
592179046.run() line: not available
PlatformImpl.lambda$null$173(Runnable) line: 295
1018934961.run() line: not available
AccessController.doPrivileged(PrivilegedAction<T>, AccessControlContext) line: not available [native method]
PlatformImpl.lambda$runLater$174(Runnable, AccessControlContext) line: 294
1937348256.run() line: not available
InvokeLaterDispatcher$Future.run() line: 95