Solr
  1. Solr
  2. SOLR-7401

NPE when concurrently creating and deleting collections

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.2, 6.0
    • Component/s: SolrCloud
    • Labels:
      None
    • Flags:
      Patch

      Description

      I've hit this when multiple tests run against the same Solr server. Some tests create a collection, do some stuff and then delete it, but there are two tests which create+delete a collection, and then assert it doesn't exist by searching it (expecting to hit an exception). While I think this isn't the best way to assert a collection doesn't exist (I intend to change this assert to use a LIST command), it did surface this concurrency bug.

      java.lang.NullPointerException
      	at java.util.ArrayList.addAll(ArrayList.java:577)
      	at org.apache.solr.servlet.SolrDispatchFilter.getSlicesForCollections(SolrDispatchFilter.java:731)
      	at org.apache.solr.servlet.SolrDispatchFilter.getRemotCoreUrl(SolrDispatchFilter.java:669)
      

      The problem is that getSlicesForCollections may get a CollectionRef whose collection value may be null, therefore attempting to add null to the list. I reproduced in a test, and fixed the bug.

        Activity

        Hide
        Shai Erera added a comment -

        Patch adds a test and fixes the bug. Without the fix, the test fails pretty consistently.

        Show
        Shai Erera added a comment - Patch adds a test and fixes the bug. Without the fix, the test fails pretty consistently.
        Hide
        Shalin Shekhar Mangar added a comment -

        +1 LGTM

        Show
        Shalin Shekhar Mangar added a comment - +1 LGTM
        Hide
        ASF subversion and git services added a comment -

        Commit 1673813 from Shai Erera in branch 'dev/trunk'
        [ https://svn.apache.org/r1673813 ]

        SOLR-7401: fixed NPE when concurrently creating and deleting collections

        Show
        ASF subversion and git services added a comment - Commit 1673813 from Shai Erera in branch 'dev/trunk' [ https://svn.apache.org/r1673813 ] SOLR-7401 : fixed NPE when concurrently creating and deleting collections
        Hide
        ASF subversion and git services added a comment -

        Commit 1673823 from Shai Erera in branch 'dev/branches/branch_5x'
        [ https://svn.apache.org/r1673823 ]

        SOLR-7401: fixed NPE when concurrently creating and deleting collections

        Show
        ASF subversion and git services added a comment - Commit 1673823 from Shai Erera in branch 'dev/branches/branch_5x' [ https://svn.apache.org/r1673823 ] SOLR-7401 : fixed NPE when concurrently creating and deleting collections
        Hide
        Shai Erera added a comment -

        Committed to trunk and 5x.

        Show
        Shai Erera added a comment - Committed to trunk and 5x.
        Hide
        ASF subversion and git services added a comment -

        Commit 1673888 from Shai Erera in branch 'dev/trunk'
        [ https://svn.apache.org/r1673888 ]

        SOLR-7401: fix copy/paste bug

        Show
        ASF subversion and git services added a comment - Commit 1673888 from Shai Erera in branch 'dev/trunk' [ https://svn.apache.org/r1673888 ] SOLR-7401 : fix copy/paste bug
        Hide
        ASF subversion and git services added a comment -

        Commit 1673890 from Shai Erera in branch 'dev/branches/branch_5x'
        [ https://svn.apache.org/r1673890 ]

        SOLR-7401: fix copy/paste bug

        Show
        ASF subversion and git services added a comment - Commit 1673890 from Shai Erera in branch 'dev/branches/branch_5x' [ https://svn.apache.org/r1673890 ] SOLR-7401 : fix copy/paste bug
        Hide
        Anshum Gupta added a comment -

        Bulk close for 5.2.0.

        Show
        Anshum Gupta added a comment - Bulk close for 5.2.0.

          People

          • Assignee:
            Shai Erera
            Reporter:
            Shai Erera
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development