[
https://issues.apache.org/jira/browse/SOLR-10778?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16036163#comment-16036163
]
Erick Erickson commented on SOLR-10778:
---------------------------------------
Looking at this some more. Approximate counts:
Total precommit WARNING messages: 350 (after patch for JavaBinCodec)
Total precommit WARNING messages in _test_ files: 306.
I looked at a couple of the 44 messages from non-test files and some look like
false hits vis-a-vis the WARNING messages. For instance this warning in
IndexWriter.java
{code}
[ecj-lint] 2. WARNING in
/Users/Erick/apache/solrJiras/jiramaster/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
(at line 4320)
[ecj-lint] newReader = new SegmentReader(info, reader, liveDocs,
info.info.maxDoc() - delCount);
[ecj-lint]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ecj-lint] Resource leak: 'newReader' is never closed
{code}
OK, here's the code:
{code}
SegmentReader newReader;
synchronized (this) {
// We must also sync on IW here, because another thread could be
writing
// new DV updates / remove old gen field infos files causing FNFE:
newReader = new SegmentReader(info, reader, liveDocs,
info.info.maxDoc() - delCount);
}
boolean released = false;
try {
rld.release(reader);
released = true;
} finally {
if (!released) {
newReader.decRef();
}
}
reader = newReader;
{code}
Given the decref and assigning around of the variables, I _think_ this WARNING
message is bogus. I'd pretty much guarantee that this code toke some
significant effort to get right, not going to touch that without guidance.
So here's what I propose. I'll take the lead in getting the warnings out of the
test code. I may well find stuff I can't figure out, but the huge majority of
that is secretarial work. All help appreciated!!!
Once that's done and we'll have a reasonable number of non-test file WARNINGs
to work on and I'll ask people familiar with that code to render an opinion.
It's clear we'll need a way to flag the linter to not warn about "resource
leaks" that really aren't if we're going to get this clean.
And when all that's done, we should fail the build on lint WARNINGs.
I'll create two more JIRAs for this and link them in.
PLEASE, PLEASE, PLEASE weigh in if you think this is wasted effort! It'll be
quite a bit of scut work, but I do think it would be A Good Thing to get these
out. I've already found a couple of things that are suspect...
> Ant precommit task WARNINGS about unclosed resources
> ----------------------------------------------------
>
> Key: SOLR-10778
> URL: https://issues.apache.org/jira/browse/SOLR-10778
> Project: Solr
> Issue Type: Improvement
> Security Level: Public(Default Security Level. Issues are Public)
> Components: clients - java
> Affects Versions: 4.6
> Reporter: Andrew Musselman
> Priority: Minor
> Attachments: notclosed.txt
>
>
> During precommit we are seeing lots of warnings about resources that aren't
> being closed, which could pose problems based on chat amongst the team. Log
> snippet for example:
> [mkdir] Created dir:
> /var/folders/5p/6b46rm_94dzc5m8d4v56tds40000gp/T/ecj1165341501
> [ecj-lint] Compiling 419 source files to
> /var/folders/5p/6b46rm_94dzc5m8d4v56tds40000gp/T/ecj1165341501
> [ecj-lint] ----------
> [ecj-lint] 1. WARNING in
> /path/to/lucene-solr/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrClient.java
> (at line 920)
> [ecj-lint] new LBHttpSolrClient(httpSolrClientBuilder, httpClient,
> solrServerUrls) :
> [ecj-lint]
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> [ecj-lint] Resource leak: '<unassigned Closeable value>' is never closed
> [ecj-lint] ----------
> [ecj-lint] ----------
> [ecj-lint] 2. WARNING in
> /path/to/lucene-solr/solr/solrj/src/java/org/apache/solr/client/solrj/impl/StreamingBinaryResponseParser.java
> (at line 49)
> [ecj-lint] JavaBinCodec codec = new JavaBinCodec() {
> [ecj-lint] ^^^^^
> [ecj-lint] Resource leak: 'codec' is never closed
> [ecj-lint] ----------
> [ecj-lint] ----------
> [ecj-lint] 3. WARNING in
> /path/to/lucene-solr/solr/solrj/src/java/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java
> (at line 90)
> [ecj-lint] JavaBinCodec codec = new JavaBinCodec();
> [ecj-lint] ^^^^^
> [ecj-lint] Resource leak: 'codec' is never closed
> [ecj-lint] ----------
> [ecj-lint] 4. WARNING in
> /path/to/lucene-solr/solr/solrj/src/java/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java
> (at line 113)
> [ecj-lint] JavaBinCodec codec = new JavaBinCodec() {
> [ecj-lint] ^^^^^
> [ecj-lint] Resource leak: 'codec' is never closed
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]