ppkarwasz commented on issue #2111:
URL: 
https://github.com/apache/logging-log4j2/issues/2111#issuecomment-1871255011

   I think that we should just log a warning  (which will not show up due to 
[the default being 
`ERROR`](https://lists.apache.org/thread/kj2x4hv38v1tlo1ggdlsy90z4hh772bp) ;-( 
) if the lookup takes more than 100 ms. By comparison Tomcat logs a warning if 
`Random()` takes more than 100 ms to initialize.
   
   This is a fairly well-known JDK characteristic (see e.g. 
[JDK8143378](https://bugs.openjdk.org/browse/JDK-8143378)) that implements 
`InetAddress#getLocalHost()` on UNIX-es as:
   
   - a super-fast 
[`gethostname`](https://man7.org/linux/man-pages/man2/gethostname.2.html) call,
   - a slow 
[`getaddrinfo`](https://man7.org/linux/man-pages/man3/getaddrinfo.3.html) call 
with a `AI_CANONNAME` hint to retrieve the fully qualified host name (2 DNS 
calls) and **discard** the result of the reverse lookup.
   
   On the other hand it is pretty common for server software to retrieve the 
FQDN of the machine, so users experiencing delays with Log4j will also 
experience delays in e.g. Apache HTTPD.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to