lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shai Erera (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LUCENE-3139) LuceneTestCase.afterClass does not print enough information if a temp-test-dir fails to delete
Date Tue, 24 May 2011 15:26:47 GMT

    [ https://issues.apache.org/jira/browse/LUCENE-3139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13038625#comment-13038625
] 

Shai Erera commented on LUCENE-3139:
------------------------------------

When I run 'ant test-backwards' I see these exceptions:

{noformat}
   [junit] ------------- Standard Error -----------------
   [junit] java.io.IOException: could not delete D:\dev\lucene\lucene-3x\lucene\build\backwards\test\1\test4293913517498927234tmp\_1.fdt
   [junit]     at org.apache.lucene.util._TestUtil.rmDir(_TestUtil.java:65)
   [junit]     at org.apache.lucene.util.LuceneTestCase.afterClassLuceneTestCaseJ4(LuceneTestCase.java:291)
   [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
   [junit]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
   [junit]     at java.lang.reflect.Method.invoke(Method.java:611)
   [junit]     at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
   [junit]     at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
   [junit]     at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
   [junit]     at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:37)
   [junit]     at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
   [junit]     at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
   [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:420)
   [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:911)
   [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:743)
   [junit] path D:\dev\lucene\lucene-3x\lucene\build\backwards\test\1\test4293913517498927234tmp
allocated from
   [junit] org.apache.lucene.util.LuceneTestCase.registerTempFile(LuceneTestCase.java:930)
   [junit] org.apache.lucene.util.LuceneTestCase.newDirectoryImpl(LuceneTestCase.java:945)
   [junit] org.apache.lucene.util.LuceneTestCase.newDirectory(LuceneTestCase.java:733)
   [junit] org.apache.lucene.util.LuceneTestCase.newDirectory(LuceneTestCase.java:725)
   [junit] org.apache.lucene.index.TestIndexWriterWithThreads._testMultipleThreadsFailure(TestIndexWriterWithThreads.java:212)
   [junit] org.apache.lucene.index.TestIndexWriterWithThreads.testIOExceptionDuringWriteSegmentWithThreads(TestIndexWriterWithThreads.java:381)
{noformat}

and

{noformat}
    [junit] ------------- Standard Error -----------------
    [junit] java.io.IOException: could not delete D:\dev\lucene\lucene-3x\lucene\build\backwards\test\5\test6976265647485126574tmp\write.lock
    [junit]     at org.apache.lucene.util._TestUtil.rmDir(_TestUtil.java:65)
    [junit]     at org.apache.lucene.util.LuceneTestCase.afterClassLuceneTestCaseJ4(LuceneTestCase.java:291)
    [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
    [junit]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
    [junit]     at java.lang.reflect.Method.invoke(Method.java:611)
    [junit]     at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    [junit]     at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    [junit]     at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    [junit]     at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:37)
    [junit]     at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    [junit]     at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
    [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:420)
    [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:911)
    [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:743)
    [junit] path D:\dev\lucene\lucene-3x\lucene\build\backwards\test\5\test6976265647485126574tmp
allocated from
    [junit] org.apache.lucene.util.LuceneTestCase.registerTempFile(LuceneTestCase.java:930)
    [junit] org.apache.lucene.util.LuceneTestCase.newDirectoryImpl(LuceneTestCase.java:945)
    [junit] org.apache.lucene.util.LuceneTestCase.newDirectory(LuceneTestCase.java:733)
    [junit] org.apache.lucene.util.LuceneTestCase.newDirectory(LuceneTestCase.java:725)
    [junit] org.apache.lucene.index.TestIndexReader.testReopenChangeReadonly(TestIndexReader.java:1622)
{noformat}

and

{noformat}
    [junit] ------------- Standard Error -----------------
    [junit] java.io.IOException: could not delete D:\dev\lucene\lucene-3x\lucene\build\backwards\test\5\test7434165808901493103tmp\write.lock
    [junit]     at org.apache.lucene.util._TestUtil.rmDir(_TestUtil.java:65)
    [junit]     at org.apache.lucene.util.LuceneTestCase.afterClassLuceneTestCaseJ4(LuceneTestCase.java:291)
    [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
    [junit]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
    [junit]     at java.lang.reflect.Method.invoke(Method.java:611)
    [junit]     at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    [junit]     at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    [junit]     at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    [junit]     at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:37)
    [junit]     at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    [junit]     at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
    [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:420)
    [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:911)
    [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:743)
    [junit] path D:\dev\lucene\lucene-3x\lucene\build\backwards\test\5\test7434165808901493103tmp
allocated from
    [junit] org.apache.lucene.util.LuceneTestCase.registerTempFile(LuceneTestCase.java:930)
    [junit] org.apache.lucene.util.LuceneTestCase.newDirectoryImpl(LuceneTestCase.java:945)
    [junit] org.apache.lucene.util.LuceneTestCase.newDirectory(LuceneTestCase.java:733)
    [junit] org.apache.lucene.util.LuceneTestCase.newDirectory(LuceneTestCase.java:725)
    [junit] org.apache.lucene.index.TestPersistentSnapshotDeletionPolicy.getDeletionPolicy(TestPersistentSnapshotDeletionPolicy.java:53)
    [junit] org.apache.lucene.index.TestSnapshotDeletionPolicy.testReleaseSnapshot(TestSnapshotDeletionPolicy.java:336)
{noformat}

and

{noformat}
    [junit] ------------- Standard Error -----------------
    [junit] java.io.IOException: could not delete D:\dev\lucene\lucene-3x\lucene\build\backwards\test\7\test4762963085363551376tmp\_a.fnm
    [junit]     at org.apache.lucene.util._TestUtil.rmDir(_TestUtil.java:65)
    [junit]     at org.apache.lucene.util.LuceneTestCase.afterClassLuceneTestCaseJ4(LuceneTestCase.java:291)
    [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
    [junit]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
    [junit]     at java.lang.reflect.Method.invoke(Method.java:611)
    [junit]     at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    [junit]     at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    [junit]     at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    [junit]     at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:37)
    [junit]     at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    [junit]     at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
    [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:420)
    [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:911)
    [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:743)
    [junit] path D:\dev\lucene\lucene-3x\lucene\build\backwards\test\7\test4762963085363551376tmp
allocated from
    [junit] org.apache.lucene.util.LuceneTestCase.registerTempFile(LuceneTestCase.java:930)
    [junit] org.apache.lucene.util.LuceneTestCase.newDirectoryImpl(LuceneTestCase.java:945)
    [junit] org.apache.lucene.util.LuceneTestCase.newDirectory(LuceneTestCase.java:733)
    [junit] org.apache.lucene.util.LuceneTestCase.newDirectory(LuceneTestCase.java:725)
    [junit] org.apache.lucene.TestMergeSchedulerExternal.testSubclassConcurrentMergeScheduler(TestMergeSchedulerExternal.java:85)
{noformat}

It's weird - even simple classes fail ... maybe the random dir name we make up for the test
is not random enough on my machine? (It is known for its ability to pick really interesting
seeds for Lucene tests :)).

Perhaps we should have the test method in the dirname, in addition to Random?

I see _TestUtil.getTempDir does this:

{code}
  public static File getTempDir(String desc) {
    File f = new File(LuceneTestCase.TEMP_DIR, desc + "." + new Random().nextLong());
    LuceneTestCase.registerTempFile(f);
    return f;
  }
{code}

That's bad no? Shouldn't it use LTC.random? And then we could add that seed to the print in
LTC.afterClass ...?

> LuceneTestCase.afterClass does not print enough information if a temp-test-dir fails
to delete
> ----------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-3139
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3139
>             Project: Lucene - Java
>          Issue Type: Test
>          Components: general/test
>            Reporter: Shai Erera
>            Priority: Minor
>             Fix For: 3.2, 4.0
>
>         Attachments: LUCENE-3139.patch, LUCENE-3139.patch
>
>
> I've hit an exception from LTC.afterClass when _TestUtil.rmDir failed (on write.lock,
as if some test did not release resources). However, I had no idea which test caused that
(i.e. opened the temp directory and did not release resources).
> I think we should do the following:
> * Track in LTC a map from dirName -> StackTraceElement
> * In afterClass if _TestUtil.rmDir fails, print the STE of that particular dir, so we
know where was this directory created from
> * Make tempDirs private and create accessor method, so that we control the inserts to
this map (today the Set is updated by LTC, _TestUtils and TestBackwards !)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message