Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-7884

Omit reverse lookups in SystemInfoHandler

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 5.2.1
    • None
    • None
    • None

    Description

      The method SystemInfoHandler.init contains this code:

        try {
            InetAddress addr = InetAddress.getLocalHost();
            hostname = addr.getCanonicalHostName();
          } catch (UnknownHostException e) {
            //default to null
          }
        }
      

      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.

      Attachments

        1. SOLR-7884.patch
          0.6 kB
          Robert Krüger

        Issue Links

          Activity

            People

              Unassigned Unassigned
              rmk_apache Robert Krüger
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: