]
James Perkins commented on WFCORE-4158:
---------------------------------------
I can't seem to duplicate this locally. However I noticed the test {{KernelServices}}
has a {{shutdown()}} method which is never being invoked in the logging tests. This could
be the issue if this would close the handlers.
There may be a need for a special shutdown hook, not a {{Runtime.addShutdownHook()}}, that
would clean up the {{LogContextConfiguration}} closing the handlers which should free the
file lock.
RootSubsystemOperationsTestCase periodically fails on Windows
-------------------------------------------------------------
Key: WFCORE-4158
URL:
https://issues.jboss.org/browse/WFCORE-4158
Project: WildFly Core
Issue Type: Bug
Components: Logging
Reporter: James Perkins
Assignee: James Perkins
Priority: Major
The {{RootSubsystemOperationsTestCase}} periodically fails on Windows. The failure occurs
in a {{@BeforeClass}} setup which attempts to clear the log directory. A file appears to
still be locked by something from a previous test, likely the
{{LoggingSubsystemTestCase}}. The failures seem to be consistent with the {{another.log}}
being locked.
{code}
[00:47:20][Step 3/5] [INFO] Running org.jboss.as.logging.LoggingSubsystemTestCase
[00:47:34][Step 3/5] [INFO] Tests run: 9, Failures: 0, Errors: 0, Skipped: 0, Time
elapsed: 14.059 s - in org.jboss.as.logging.LoggingSubsystemTestCase
[00:47:34][Step 3/5] [INFO] Running
org.jboss.as.logging.logmanager.Log4jAppenderTestCase
[00:47:34][Step 3/5] [INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time
elapsed: 0 s - in org.jboss.as.logging.logmanager.Log4jAppenderTestCase
[00:47:34][Step 3/5] [INFO] Running org.jboss.as.logging.RootSubsystemOperationsTestCase
[00:47:34][Step 3/5] [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time
elapsed: 0.001 s <<< FAILURE! - in
org.jboss.as.logging.RootSubsystemOperationsTestCase
[00:47:34][Step 3/5] [ERROR] org.jboss.as.logging.RootSubsystemOperationsTestCase Time
elapsed: 0.001 s <<< ERROR!
[00:47:34][Step 3/5] java.nio.file.FileSystemException:
[00:47:34][Step 3/5] C:\buildAgent\work\e9bccef30f12678d\logging\target\logs\another.log:
The process cannot access the file because it is being used by another process.
[00:47:34][Step 3/5]
[00:47:34][Step 3/5] at
sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:86)
[00:47:34][Step 3/5] at
sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
[00:47:34][Step 3/5] at
sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
[00:47:34][Step 3/5] at
sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:269)
[00:47:34][Step 3/5] at
sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103)
[00:47:34][Step 3/5] at java.nio.file.Files.delete(Files.java:1126)
[00:47:34][Step 3/5] at
org.jboss.as.logging.AbstractLoggingSubsystemTest$1.visitFile(AbstractLoggingSubsystemTest.java:502)
[00:47:34][Step 3/5] at
org.jboss.as.logging.AbstractLoggingSubsystemTest$1.visitFile(AbstractLoggingSubsystemTest.java:499)
[00:47:34][Step 3/5] at java.nio.file.Files.walkFileTree(Files.java:2670)
[00:47:34][Step 3/5] at java.nio.file.Files.walkFileTree(Files.java:2742)
[00:47:34][Step 3/5] at
org.jboss.as.logging.AbstractLoggingSubsystemTest.clearDirectory(AbstractLoggingSubsystemTest.java:499)
[00:47:34][Step 3/5] at
org.jboss.as.logging.AbstractOperationsTestCase.setupLoggingDir(AbstractOperationsTestCase.java:53)
[00:47:34][Step 3/5] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[00:47:34][Step 3/5] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[00:47:34][Step 3/5] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[00:47:34][Step 3/5] at java.lang.reflect.Method.invoke(Method.java:498)
[00:47:34][Step 3/5] at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
[00:47:34][Step 3/5] at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
[00:47:34][Step 3/5] at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
[00:47:34][Step 3/5] at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
[00:47:34][Step 3/5] at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
[00:47:34][Step 3/5] at org.junit.runners.Suite.runChild(Suite.java:128)
[00:47:34][Step 3/5] at org.junit.runners.Suite.runChild(Suite.java:27)
[00:47:34][Step 3/5] at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
[00:47:34][Step 3/5] at
org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
[00:47:34][Step 3/5] at
org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
[00:47:34][Step 3/5] at
org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
[00:47:34][Step 3/5] at
org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
[00:47:34][Step 3/5] at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
[00:47:34][Step 3/5] at
org.apache.maven.surefire.junitcore.JUnitCore.run(JUnitCore.java:55)
[00:47:34][Step 3/5] at
org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:137)
[00:47:34][Step 3/5] at
org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeEager(JUnitCoreWrapper.java:107)
[00:47:34][Step 3/5] at
org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:83)
[00:47:34][Step 3/5] at
org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:75)
[00:47:34][Step 3/5] at
org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:158)
[00:47:34][Step 3/5] at
org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:383)
[00:47:34][Step 3/5] at
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:344)
[00:47:34][Step 3/5] at
org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:125)
[00:47:34][Step 3/5] at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:417)
[00:47:34][Step 3/5]
[00:47:34][Step 3/5] [INFO] Running
org.jboss.as.logging.validators.SuffixValidatorTestCase
[00:47:34][Step 3/5] [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time
elapsed: 0 s - in org.jboss.as.logging.validators.SuffixValidatorTestCase
[00:47:34][Step 3/5] org.jboss.as.logging.RootSubsystemOperationsTestCase
[00:47:34][org.jboss.as.logging.RootSubsystemOperationsTestCase]
RootSubsystemOperationsTestCase
[00:47:34][RootSubsystemOperationsTestCase] java.nio.file.FileSystemException:
C:\buildAgent\work\e9bccef30f12678d\logging\target\logs\another.log: The process cannot
access the file because it is being used by another process.
[00:47:34][RootSubsystemOperationsTestCase] java.nio.file.FileSystemException:
C:\buildAgent\work\e9bccef30f12678d\logging\target\logs\another.log: The process cannot
access the file because it is being used by another process.
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:86)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at
sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:269)
at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103)
at java.nio.file.Files.delete(Files.java:1126)
at
org.jboss.as.logging.AbstractLoggingSubsystemTest$1.visitFile(AbstractLoggingSubsystemTest.java:502)
at
org.jboss.as.logging.AbstractLoggingSubsystemTest$1.visitFile(AbstractLoggingSubsystemTest.java:499)
at java.nio.file.Files.walkFileTree(Files.java:2670)
at java.nio.file.Files.walkFileTree(Files.java:2742)
at
org.jboss.as.logging.AbstractLoggingSubsystemTest.clearDirectory(AbstractLoggingSubsystemTest.java:499)
at
org.jboss.as.logging.AbstractOperationsTestCase.setupLoggingDir(AbstractOperationsTestCase.java:53)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.apache.maven.surefire.junitcore.JUnitCore.run(JUnitCore.java:55)
at
org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:137)
at
org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeEager(JUnitCoreWrapper.java:107)
at
org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:83)
at
org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:75)
at
org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:158)
at
org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:383)
at
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:344)
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:125)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:417)
[00:47:08][Step 3/5] Failed tests detected
[00:47:34][Step 3/5] [INFO]
[00:47:34][Step 3/5] [INFO] Results:
[00:47:34][Step 3/5] [INFO]
[00:47:34][Step 3/5] [ERROR] Errors:
[00:47:34][Step 3/5] [ERROR]
RootSubsystemOperationsTestCase>AbstractOperationsTestCase.setupLoggingDir:53->AbstractLoggingSubsystemTest.clearDirectory:499
¯ FileSystem
[00:47:34][Step 3/5] [INFO]
[00:47:34][Step 3/5] [ERROR] Tests run: 71, Failures: 0, Errors: 1, Skipped: 9
[00:47:34][Step 3/5] [INFO]
[00:47:34][Step 3/5] [ERROR] There are test failures.
{code}