[
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-2.patch
Assignee: Chris M. Hostetter
Status: Open (was: Open)
{quote}Well getHttpClient is deprecated, so we could begin weening tests off of
it. I've used the JDK's HttpClient, and it worked out well.
{quote}
Re-writing tests to use a new HTTP client implementation is more then i'm
willing to bite off at the moment – especially given how prevalent it seems to
be for tests to call {{HttpSolrClient.getHttpClient()}}
( {{SolrTestCaseJ4.getHttpClient(String)}} is just the ugliest tip of the
iceberg).
It didn't really click for me the other day, but even if we knew we had a
{{ClosableHttpClient}} instance, and we called {{close()}} on it,
{{ObjectReleaseTracker}} would still complain because that's not our class and
it's close method doesn't know/care to call
{{ObjectReleaseTracker.release(this)}}.
Apparently this is the whole purpose of the static {{HttpClientUtils.close()}}
method which is already used in many tests: to call {{release()}} on
{{HttpClient}} that are created by {{HttpClientUtils}}. So I updated the
handful of tests I know of "leaking" {{HttpClient}} instances to use that
method.
The attached patch fixes all of the tests (that i know of) which currently
break with {{ObjectReleaseTracker}} correctly enabled in {{SolrTestCase}} ...
if there are no objections i'll commit tomorrow so we stem the bleeding before
even more tests get written that leak stuff
> 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
> Assignee: Chris M. Hostetter
> Priority: Major
> Attachments: SOLR-16983-1.patch, SOLR-16983-2.patch,
> SOLR-16983.bug-demo.nocommit.patch, SOLR-16983.patch,
> test-output-if-clear-is-removed-from-SolrTestCaseJ4.txt.gz
>
>
>
> {{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: [email protected]
For additional commands, e-mail: [email protected]