You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Steve Rowe (JIRA)" <ji...@apache.org> on 2013/01/16 05:50:14 UTC

[jira] [Reopened] (SOLR-4300) Possible race condition in CoreContainer.getCore() when lazily loading cores.

     [ https://issues.apache.org/jira/browse/SOLR-4300?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steve Rowe reopened SOLR-4300:
------------------------------

      Assignee: Steve Rowe  (was: Erick Erickson)

Jenkins is unhappy:

{noformat}
Build: http://jenkins.thetaphi.de/job/Lucene-Solr-trunk-MacOSX/92/
Java: 64bit/jdk1.7.0 -XX:+UseSerialGC

1 tests failed.
FAILED:  junit.framework.TestSuite.org.apache.solr.core.TestLazyCores

Error Message:
Clean up static fields (in @AfterClass?), your test seems to hang on to approximately 13,549,312 bytes (threshold is 10,485,760). Field reference sizes (counted individually):   - 14,228,288 bytes, static java.util.List org.apache.solr.core.TestLazyCores._theCores   - 720 bytes, private static java.lang.String[] org.apache.solr.core.TestLazyCores._necessaryConfs   - 280 bytes, public static org.junit.rules.TestRule org.apache.solr.SolrTestCaseJ4.solrClassRules   - 240 bytes, protected static java.lang.String org.apache.solr.SolrTestCaseJ4.testSolrHome   - 128 bytes, private static java.lang.String org.apache.solr.SolrTestCaseJ4.factoryProp   - 64 bytes, private static java.lang.String org.apache.solr.SolrTestCaseJ4.coreName

Stack Trace:
junit.framework.AssertionFailedError: Clean up static fields (in @AfterClass?), your test seems to hang on to approximately 13,549,312 bytes (threshold is 10,485,760). Field reference sizes (counted individually):
 - 14,228,288 bytes, static java.util.List org.apache.solr.core.TestLazyCores._theCores
...
{noformat}

I can reproduce this on my Mac.

After applying the patch below converting the static field {{_theCores}} into a local variable of the only method it's used in, I was able to successfully run {{ant test -Dtestcase=TestLazyCores -Dtests.dups=100}}:

{code:java}
Index: solr/core/src/test/org/apache/solr/core/TestLazyCores.java
===================================================================
--- solr/core/src/test/org/apache/solr/core/TestLazyCores.java	(revision 1433815)
+++ solr/core/src/test/org/apache/solr/core/TestLazyCores.java	(working copy)
@@ -248,10 +248,10 @@
     }
   }
 
-  static List<SolrCore> _theCores = new ArrayList<SolrCore>();
   // Test case for SOLR-4300
   @Test
   public void testRace() throws Exception {
+    final List<SolrCore> _theCores = new ArrayList<SolrCore>();
     final CoreContainer cc = init();
     try {
{code}

I'll commit this shortly.
                
> Possible race condition in CoreContainer.getCore() when lazily loading cores.
> -----------------------------------------------------------------------------
>
>                 Key: SOLR-4300
>                 URL: https://issues.apache.org/jira/browse/SOLR-4300
>             Project: Solr
>          Issue Type: Bug
>    Affects Versions: 4.1, 5.0
>            Reporter: Erick Erickson
>            Assignee: Steve Rowe
>            Priority: Blocker
>             Fix For: 4.1, 5.0
>
>         Attachments: SOLR-4300.patch
>
>
> Yonik pointed out in SOLR-1028 that there is a possible race condition here, he's right not to my surprise. Calling it a "blocker" for now so we make a decision on it rather than let it fall through the cracks. I should be able to get a patch up tonight (Sunday).
> That said, there's potential here to introduce deadlocks, is it worth rushing into 4.1?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org