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

SolrSuggester should selectively register close hook

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Resolved
    • 4.10.3
    • 6.3
    • Suggester
    • None

    Description

      Currently this is the code for registering a close hook for SolrSuggester:

      lookup = factory.create(config, core);
          core.addCloseHook(new CloseHook() {
            @Override
            public void preClose(SolrCore core) {
              if (lookup != null && lookup instanceof Closeable) {
                try {
                  ((Closeable) lookup).close();
                } catch (IOException e) {
                  LOG.warn("Could not close the suggester lookup.", e);
                }
              }
            }
            
            @Override
            public void postClose(SolrCore core) {}
          });
      

      Notice that the close hook is always registered, even though the close logic runs conditionally.

      This can be changed so that the close hook is registered conditionally.

      This will help avoid memory leaks in scenarios where a custom component reloads the SolrSuggester multiple times for the same core.

      Attachments

        1. SOLR-9406.patch
          1 kB
          Joel Bernstein

        Activity

          People

            jbernste Joel Bernstein
            covolution Gethin James
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: