Solr - ConcurrentHashMap - NullPointerException

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Solr - ConcurrentHashMap - NullPointerException

Fuad Efendi

I am recalling big noise in JIRA; and Paul Nobble implemented first version of this… what can be wrong now, after few years? Solr 3.6.0


Jun 18, 2012 3:40:43 PM org.apache.solr.common.SolrException log
SEVERE: java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:768)
at org.apache.solr.util.ConcurrentLRUCache.get(ConcurrentLRUCache.java:87)
at org.apache.solr.search.FastLRUCache.get(FastLRUCache.java:136)
at org.apache.solr.search.SolrIndexSearcher.getPositiveDocSet(SolrIndexSearcher.java:632)
at org.apache.solr.search.SolrIndexSearcher.numDocs(SolrIndexSearcher.java:1743)
at org.apache.solr.request.SimpleFacets.getFacetQueryCounts(SimpleFacets.java:234)
at org.apache.solr.request.SimpleFacets.getFacetCounts(SimpleFacets.java:194)
at org.apache.solr.handler.component.FacetComponent.process(FacetComponent.java:72)
at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:186)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:1376)
at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:365)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:260)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:680)



Fuad Efendi

416-993-2060

http://www.tokenizer.ca


Reply | Threaded
Open this post in threaded view
|

Re: Solr - ConcurrentHashMap - NullPointerException

Fuad Efendi
Some research, line 768 of ConcurrentHashMap:

 int hash = hash(key.hashCode());


I believe we have Unit Test with null as a key… very strange for Solr cache implementation…



   /**

     * Returns the value to which the specified key is mapped,

     * or {@code null} if this map contains no mapping for the key.

     *

     * <p>More formally, if this map contains a mapping from a key

     * {@code k} to a value {@code v} such that {@code key.equals(k)},

     * then this method returns {@code v}; otherwise it returns

     * {@code null}.  (There can be at most one such mapping.)

     *

     * @throws NullPointerException if the specified key is null

     */

    public V get(Object key) {

        int hash = hash(key.hashCode());

        return segmentFor(hash).get(key, hash);

    }







From: Fuad Efendi <[hidden email]>
Reply-To: lucene-dev <[hidden email]>
Date: Monday, 18 June, 2012 11:45 AM
To: lucene-dev <[hidden email]>
Subject: Solr - ConcurrentHashMap - NullPointerException


I am recalling big noise in JIRA; and Paul Nobble implemented first version of this… what can be wrong now, after few years? Solr 3.6.0


Jun 18, 2012 3:40:43 PM org.apache.solr.common.SolrException log
SEVERE: java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:768)
at org.apache.solr.util.ConcurrentLRUCache.get(ConcurrentLRUCache.java:87)
at org.apache.solr.search.FastLRUCache.get(FastLRUCache.java:136)
at org.apache.solr.search.SolrIndexSearcher.getPositiveDocSet(SolrIndexSearcher.java:632)
at org.apache.solr.search.SolrIndexSearcher.numDocs(SolrIndexSearcher.java:1743)
at org.apache.solr.request.SimpleFacets.getFacetQueryCounts(SimpleFacets.java:234)
at org.apache.solr.request.SimpleFacets.getFacetCounts(SimpleFacets.java:194)
at org.apache.solr.handler.component.FacetComponent.process(FacetComponent.java:72)
at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:186)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:1376)
at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:365)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:260)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:680)



Fuad Efendi

416-993-2060

http://www.tokenizer.ca


Reply | Threaded
Open this post in threaded view
|

Re: Solr - ConcurrentHashMap - NullPointerException

Fuad Efendi
Rare problem… it happened when I provided NULL facet query via solrconfig:

       <str name="facet.query"></str>

 


We probably should add null check:

  // only handle positive (non negative) queries

  DocSet getPositiveDocSet(Query q) throws IOException {

    DocSet answer;

    if (filterCache != null) {

      answer = filterCache.get(q);

      if (answer!=null) return answer;

    }

    answer = getDocSetNC(q,null);

    if (filterCache != null) filterCache.put(

        q,answer);

    return answer;

  }





From: Fuad Efendi <[hidden email]>
Reply-To: lucene-dev <[hidden email]>
Date: Monday, 18 June, 2012 11:52 AM
To: lucene-dev <[hidden email]>
Subject: Re: Solr - ConcurrentHashMap - NullPointerException

Some research, line 768 of ConcurrentHashMap:

 int hash = hash(key.hashCode());


I believe we have Unit Test with null as a key… very strange for Solr cache implementation…



   /**

     * Returns the value to which the specified key is mapped,

     * or {@code null} if this map contains no mapping for the key.

     *

     * <p>More formally, if this map contains a mapping from a key

     * {@code k} to a value {@code v} such that {@code key.equals(k)},

     * then this method returns {@code v}; otherwise it returns

     * {@code null}.  (There can be at most one such mapping.)

     *

     * @throws NullPointerException if the specified key is null

     */

    public V get(Object key) {

        int hash = hash(key.hashCode());

        return segmentFor(hash).get(key, hash);

    }







From: Fuad Efendi <[hidden email]>
Reply-To: lucene-dev <[hidden email]>
Date: Monday, 18 June, 2012 11:45 AM
To: lucene-dev <[hidden email]>
Subject: Solr - ConcurrentHashMap - NullPointerException


I am recalling big noise in JIRA; and Paul Nobble implemented first version of this… what can be wrong now, after few years? Solr 3.6.0


Jun 18, 2012 3:40:43 PM org.apache.solr.common.SolrException log
SEVERE: java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:768)
at org.apache.solr.util.ConcurrentLRUCache.get(ConcurrentLRUCache.java:87)
at org.apache.solr.search.FastLRUCache.get(FastLRUCache.java:136)
at org.apache.solr.search.SolrIndexSearcher.getPositiveDocSet(SolrIndexSearcher.java:632)
at org.apache.solr.search.SolrIndexSearcher.numDocs(SolrIndexSearcher.java:1743)
at org.apache.solr.request.SimpleFacets.getFacetQueryCounts(SimpleFacets.java:234)
at org.apache.solr.request.SimpleFacets.getFacetCounts(SimpleFacets.java:194)
at org.apache.solr.handler.component.FacetComponent.process(FacetComponent.java:72)
at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:186)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:1376)
at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:365)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:260)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:680)



Fuad Efendi

416-993-2060

http://www.tokenizer.ca