[ https://issues.apache.org/jira/browse/LUCENE-5787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14041224#comment-14041224 ]
John Gibson commented on LUCENE-5787: ------------------------------------- {quote} This means you want to subclass LuceneTestCase with Groovy as basis for your own Solr/Lucene tests? {quote} Yes, exactly. Although in my case it was subclassing AbstractSolrTestCase (which is a descendent of LuceneTestCase). {quote} I think (didn't check) the leak checker is a test rule, so it cannot be easily replaced/ modified (you'd have to shadow the rule chain field and replace all the logic in there). Yet another JUnit dead-end corner case I guess. {quote} Dawid, I believe that you're correct. When I first looked into this I couldn't figure out how to disable the check, so I ended up copying LTC into my project and whitelisting the necessary fields manually. The most annoying part about this bug was that initially the test worked fine, then as I added more fields and code to the suite the ClassInfo reference passed the 10 MiB mark and suddenly it stopped working. {quote} This bug does not affect Lucene, it is a problem of 3rd party infrastructures using our test framework. So the big question: What does other scripting laguages do? Scala? JRuby? The list is endless. Maybe add an annotation like {noformat}@SuppressLeakChecks([fieldname, fieldname, fieldname]){noformat} {quote} This is an excellent observation that I hadn't thought of. An annotation may be the correct route. Another option would be to ignore all [synthetic fields|http://docs.oracle.com/javase/7/docs/api/java/lang/reflect/Field.html#isSynthetic%28%29]. (Note that I'm just assuming that Groovy's ClassInfo field is synthetic, given that it's generated by the groovy compiler/runtime.) > LuceneTestCase static leak checker interferes with Groovy unit tests > -------------------------------------------------------------------- > > Key: LUCENE-5787 > URL: https://issues.apache.org/jira/browse/LUCENE-5787 > Project: Lucene - Core > Issue Type: Bug > Affects Versions: 4.7, 4.8.1 > Environment: Maven 3.0.5 > JUnit 4.11 > Reporter: John Gibson > > {{LuceneTestCase}}'s static memory leak checker can break Groovy subclasses. > Specifically, Groovy classes have a synthetic static member variable of type > {{org.codehaus.groovy.reflection.ClassInfo}}. If this variable grows too > large then LTC will fail the test. Because the variable is added by the > Groovy runtime instead of by the developer there is no way for the developer > to clear the field themselves. > Also note that the static leak checker does not ignore memory held by soft or > weak references. These should be ignored because the memory retained by such > fields will be reclaimed instead of triggering OutOfMemoryErrors. > Note that because LTC is a base class for Solr's testing support classes this > also affects {{SolrTestCaseJ4}} and {{AbstractSolrTestCase}}. -- This message was sent by Atlassian JIRA (v6.2#6252) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org