On Sun, Oct 25, 2009 at 8:28 AM, Mark Miller <[email protected]> wrote:
>
>        RefCounted<SolrIndexSearcher> s = core.getNewestSearcher(false);
>        try {
>          IndexReader reader = s==null ? null : s.get().getReader();
>          if (reader!=null && reader.getIndexCommit() != null &&
> reader.getIndexCommit().getGeneration() != 1L) {
>
> If getNewestSearcher(false) happens to return null, we are in for a
> nasty surprise when it next trys to decref the null Searcher:
>
>  } catch (IOException e) {
>          LOG.warn("Unable to get IndexCommit on startup", e);
>  } finally {
>          s.decref();
>  }
>
> Some internal disagreement in that code...


Yep, good catch.  I recently added the null check, because we
shouldn't assume there will always be an open reader (today I think
there will be, but tomorrow?).  That should be extended to the
decref().

-Yonik
http://www.lucidimagination.com

Reply via email to