lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Muir (JIRA)" <>
Subject [jira] [Updated] (LUCENE-4252) Detect/Fail tests when they leak RAM in static fields
Date Wed, 25 Jul 2012 04:35:34 GMT


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 (,
then TestPostingsFormat fails like this:

[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
[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(

> Detect/Fail tests when they leak RAM in static fields
> -----------------------------------------------------
>                 Key: LUCENE-4252
>                 URL:
>             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:!default.jspa
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message