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

Chris M. Hostetter updated SOLR-16983:
--------------------------------------
    Attachment: SOLR-16983.bug-demo.nocommit.patch
        Status: Open  (was: Open)

I'm attaching a rough nocommit patch that demonstrates the problem: 
{{BasicFunctionalityTest.testObjectTrackerSanityCheck}} should clearly fail...
{code:java}
  public void testObjectTrackerSanityCheck() throws Exception { // nocommit
    
assertTrue(org.apache.solr.common.util.ObjectReleaseTracker.track("nocommit:tracked-object-never-released"));
  }
{code}
...but it in fact passes, and the {{System.err.println}} calls in the patch 
make it clear why...
{noformat}
hossman@slate:~/lucene/solr [j11] [*main] $ ./gradlew test --max-workers=1 
--tests BasicFunctionalityTest.testObjectTrackerSanityCheck -Ptests.verbose=true
...
  2> nocommit: STCJ4.AfterClass
  2> nocommit: ORT.clear
  2> nocommit: STC.rule.afterIfSuccessful
  2> nocommit: ORT.checkEmpty
  2> nocommit: ORT.clear
...
  2> NOTE: All tests run in this JVM: [BasicFunctionalityTest]
:solr:core:test (SUCCESS): 1 test(s)
The slowest suites (exceeding 1s) during this run:
   3.26s BasicFunctionalityTest (:solr:core)

BUILD SUCCESSFUL in 18s
{noformat}
At a quick glance, I suspect this bug was introduced by changes made in 
{{commit 21bc46c43c94cc90589cc536ffc7518908e64240}} (SOLR-16573) that affected 
when in the lifecycle of {{SolrTestCase}} subclasses the 
{{ObjectReleaseTracker.clearObjectTrackerAndCheckEmpty()}} check got called – 
But I haven't verified that. (It's possible the problem is much older).

/ping [~dsmiley]  & [~joshgogz]

> ObjectReleaseTracker completely useless in all SolrTestCaseJ4 based tests
> -------------------------------------------------------------------------
>
>                 Key: SOLR-16983
>                 URL: https://issues.apache.org/jira/browse/SOLR-16983
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Chris M. Hostetter
>            Priority: Major
>         Attachments: SOLR-16983.bug-demo.nocommit.patch
>
>
>  
> {{SolrTestCase}} has a {{@ClassRule}} named {{solrClassRules}} which calls 
> {{ObjectReleaseTracker.clearObjectTrackerAndCheckEmpty()}} in it's 
> {{afterIfSuccessful()}} method to ensure that any objects which use 
> {{ObjectReleaseTracker}} are correctly released (ie: closed)
> _*...BUT...*_
> {{SolrTestCaseJ4}} has an {{@AfterClass}} method named 
> {{teardownTestCases()}} which calls {{ObjectReleaseTracker.clear()}} _before_ 
> the {{afterIfSuccessful()}} method of it's parent class's {{solrClassRules}} 
> gets to run.
> ... Which means that {{ObjectReleaseTracker}} is completley useless in every 
> test that descends from {{{}SolrTestCaseJ4{}}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to