[ 
https://issues.apache.org/jira/browse/SOLR-7884?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14680752#comment-14680752
 ] 

Hoss Man commented on SOLR-7884:
--------------------------------

bq. The suggested fix for this is to replace the call to getCanonicalHostName 
by one to getHostName() ...

Hmmm.... I'm not convinced this is a good idea ... Just because that's what 
other libraries use doesn’t mean it's a good fit in this context.  The intent 
of this information is to inform clients what the _canonical_ hostname is for 
communicating with Solr.  If the local hostname/DNS is missconfigured we don't 
want to lie to the user.

In my opinion, the approach discussed in SOLR-5043 would be a better method for 
dealing with this.

(allthough in addition to that, updating SystemInfoHandler.init to pay 
attention to when the node is operating in cloud mode and use the same "host" 
configuration option from CloudConfig that the rest of Solr uses, and only do 
getCanonicalHostName as a fallback option.  -- At least that way the only 
misconfiguration that can lead us to lying to the user is an explicit 
misconfiguration of Solr, something the user running Solr is guaranteed to have 
control of)

----

bq. As Solr is shipped bundled with a desktop application, there is currently 
no workaround because the user network configuration is beyond our reach.

I'm not sure i follow this reasoning -- even if you can't ensure the 
DNS/network of the machine Solr is being deployed to is reliable, can't you 
specify SecurityManager settings to prevent the process from doing DNS lookups? 
(in which case Solr should happily continue to function, with or w/o correctly 
function DNS, w/o any delays)



> Omit reverse lookups in SystemInfoHandler
> -----------------------------------------
>
>                 Key: SOLR-7884
>                 URL: https://issues.apache.org/jira/browse/SOLR-7884
>             Project: Solr
>          Issue Type: Improvement
>    Affects Versions: 5.2.1
>            Reporter: Robert Krüger
>         Attachments: SOLR-7884.patch
>
>
> The method SystemInfoHandler.init contains this code:
> {code:java}
>   try {
>       InetAddress addr = InetAddress.getLocalHost();
>       hostname = addr.getCanonicalHostName();
>     } catch (UnknownHostException e) {
>       //default to null
>     }
>   }
> {code}
> The call to getCanonicalHostName triggers a DNS reverse lookup, that on Mac 
> OSX times out after 30 seconds if the current network setup has a problem 
> with reverse lookup and then returns the IP address as host name. In our 
> product this leads to a hang of 2x30 seconds (one for the SystemInfoHandler 
> of the container and another one for that of the core) during startup under 
> these conditions. Unfortunately I have found no way to make this reproducible 
> by simulating it as it depends on local network config, os and whatever else.
> As Solr is shipped bundled with a desktop application, there is currently no 
> workaround because the user network configuration is beyond our reach.
> The suggested fix for this is to replace the call to getCanonicalHostName by 
> one to getHostName(), which is done for exactly this purpose (obtaining a 
> host string for logging) in the popular Logback framework (see 
> http://logback.qos.ch/xref/ch/qos/logback/core/util/ContextUtil.html, how 
> they do it).
> Otherwise Solr has been working perfectly in this setup (bundled with a 
> desktop app) for a long time and it would be great to remove that last 
> obstacle to make it a nicer citizen bundlingwise.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to