This article provide information about the "UnknownHostException: elapsed time for lookup" messages in Oneclick tomcat logs
example:
UnknownHostException: elapsed time for lookup: 0 ms
UnknownHostException: elapsed time for lookup: 0 ms
UnknownHostException: elapsed time for lookup: 0 ms
UnknownHostException: elapsed time for lookup: 0 ms
UnknownHostException: elapsed time for lookup: 0 ms
UnknownHostException: elapsed time for lookup: 16 ms
UnknownHostException: elapsed time for lookup: 0 ms
UnknownHostException: elapsed time for lookup: 0 ms
1. What is the impact of the name resolution failing? Will the requested action of the client be denied?
Engineering: This UnknownHostException is benign. Here the code actually sets the client details to the CorbaHelper object just to set the SecurityInfo of the client. This Catch block was added to capture the UnKnownHostException and it was actually for a debug patch where a customer was seeing these Exceptions and was reporting oneclick slowness. This log message would be good to know if these failed lookups do in fact take measurable time of OC and resulting in OC slowness. But here we can see it says 0ms so it’s not impacting OC performance on these failed lookups.
2. Can it be that it’s just the DNS failing temporarily?
Engineering: Not very sure but looks like for some reason this DNS lookup from OC Webserver machine is not resulting in success. We think they are launching the browser through IP in the URL? If so, they can try with hostname and see if it still throws this UnknownHostException?
3. Can you understand why the access log isn’t showing a problem?
Engineering: localhost_access log just shows what all calls made to the OC Webserver and what response has been returned and in how much time.
4. I have noticed the following:
https://tomcat.apache.org/tomcat-9.0-doc/config/valve.html#Extended_Access_Log_Valve
Maybe we could use/enable the Extended access log valve in the localhost_access log to get the hostnames too?
Engineering: In order to use ExtendedAccessLogValve, we need to add this class to the server.xml file like below:
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t %r %s %b %D" resolveHosts="false"></Valve> // This is already present in the server.xml file.
The below line should be added newly:
<Valve className="org.apache.catalina.valves.ExtendedAccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="c-dns c-ip" resolveHosts=" false "></Valve>
5. Do you have any idea what could be a problematic value for milliseconds in the logs? Maybe higher than 100 ms?
Engineering: yes anything above 100ms is concerning.
Customer is getting few lines like these in red:
UnknownHostException: elapsed time for lookup: 0 ms
UnknownHostException: elapsed time for lookup: 0 ms
UnknownHostException: elapsed time for lookup: 0 ms
UnknownHostException: elapsed time for lookup: 0 ms
UnknownHostException: elapsed time for lookup: 0 ms
UnknownHostException: elapsed time for lookup: 16 ms
UnknownHostException: elapsed time for lookup: 0 ms
UnknownHostException: elapsed time for lookup: 0 ms
UnknownHostException: elapsed time for lookup: 0 ms
I´m assuming 16 ms is still a very low value…
Engineering: yes its very low value and can be ignored.
6. You mentioned that these messages were activated due a debug patch provided in the past. Can we disable/prevent these messages to appear in tomcat logs? Or it´s hardcoded?
Engineering: Its hardcoded value in the code. Its not debug controlled.