[
https://issues.apache.org/jira/browse/LUCENE-4252?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Robert Muir updated LUCENE-4252:
--------------------------------
Attachment: LUCENE-4252.patch
just a prototype, seems to work.
E.g. if i svn up to r1365256, before I committed the fix to TestPostingsFormat
(http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestPostingsFormat.java?r1=1365257&r2=1365256&pathrev=1365257),
then TestPostingsFormat fails like this:
{noformat}
[junit4:junit4] <JUnit4> says cześć! Master seed: 4A806862EF7FBAA2
[junit4:junit4] Executing 1 suite with 1 JVM.
[junit4:junit4] Suite: org.apache.lucene.index.TestPostingsFormat
[junit4:junit4] OK 0.27s | TestPostingsFormat.test
[junit4:junit4] > (@AfterClass output)
[junit4:junit4] 2> NOTE: test params are: codec=Lucene40:
{=MockFixedIntBlock(blockSize=769), vqvfc=MockFixedIntBlock(blockSize=769),
ouan=PostingsFormat(name=Memory doPackFST= false),
vhhpavin=MockFixedIntBlock(blockSize=769)},
sim=RandomSimilarityProvider(queryNorm=true,coord=true): {}, locale=fi_FI,
timezone=SystemV/AST4ADT
[junit4:junit4] 2> NOTE: Linux 3.2.0-24-generic amd64/Sun Microsystems Inc.
1.6.0_24 (64-bit)/cpus=8,threads=1,free=145473456,total=317390848
[junit4:junit4] 2> NOTE: All tests run in this JVM: [TestPostingsFormat]
[junit4:junit4] 2> NOTE: reproduce with: ant test
-Dtestcase=TestPostingsFormat -Dtests.seed=4A806862EF7FBAA2 -Dtests.slow=true
-Dtests.locale=fi_FI -Dtests.timezone=SystemV/AST4ADT
-Dtests.file.encoding=ISO-8859-1
[junit4:junit4] 2>
[junit4:junit4] ERROR 0.00s | TestPostingsFormat (suite)
[junit4:junit4] > Throwable #1: java.lang.RuntimeException: Please fix the
static leaks in your test in a @AfterClass, your test seems to hang on to
approximately 125704200 bytes.
[junit4:junit4] > at
org.apache.lucene.util.TestRuleSetupAndRestoreClassEnv.after(TestRuleSetupAndRestoreClassEnv.java:282)
{noformat}
> Detect/Fail tests when they leak RAM in static fields
> -----------------------------------------------------
>
> Key: LUCENE-4252
> URL: https://issues.apache.org/jira/browse/LUCENE-4252
> Project: Lucene - Core
> Issue Type: Test
> Components: general/test
> Reporter: Robert Muir
> Attachments: LUCENE-4252.patch
>
>
> We run our junit tests without firing up a JVM each time.
> But some tests initialize lots of stuff in @BeforeClass and don't properly
> null it out in an @AfterClass, which can cause a subsequent test in the same
> JVM to OOM, which is difficult to debug.
> Inspiration for this was me committing Mike's cool TestPostingsFormat, which
> forgot to do this: then we were seeing OOMs in several jenkins runs.
> We should try to detect these leaks in LuceneTestCase with RAMUsageEstimator
> and fail the test.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]