[ 
https://issues.apache.org/jira/browse/SLING-7090?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robert Munteanu resolved SLING-7090.
------------------------------------
    Resolution: Fixed

Applied in [r1806584|https://svn.apache.org/r1806584], thanks for the fix!

> RRD4J metrics reporter does not close file on deactivate
> --------------------------------------------------------
>
>                 Key: SLING-7090
>                 URL: https://issues.apache.org/jira/browse/SLING-7090
>             Project: Sling
>          Issue Type: Bug
>          Components: Commons
>            Reporter: Marcel Reutegger
>            Assignee: Robert Munteanu
>            Priority: Minor
>             Fix For: Commons Metrics RRD4J 1.0.0
>
>         Attachments: SLING-7090.patch
>
>
> The RRD4J metrics reporter does not close the underlying database file on 
> deactivate. Running the tests on windows will show the following failure:
> {noformat}
> java.lang.RuntimeException: Unable to invoke method 'activate' for class 
> org.apache.sling.commons.metrics.rrd4j.impl.CodahaleMetricsReporter
>       at 
> org.apache.sling.testing.mock.osgi.OsgiServiceUtil.invokeMethod(OsgiServiceUtil.java:320)
>       at 
> org.apache.sling.testing.mock.osgi.OsgiServiceUtil.invokeLifecycleMethod(OsgiServiceUtil.java:213)
>       at 
> org.apache.sling.testing.mock.osgi.OsgiServiceUtil.activateDeactivate(OsgiServiceUtil.java:84)
>       at 
> org.apache.sling.testing.mock.osgi.MockOsgi.activate(MockOsgi.java:171)
>       at 
> org.apache.sling.testing.mock.osgi.MockOsgi.activate(MockOsgi.java:182)
>       at 
> org.apache.sling.commons.metrics.rrd4j.impl.ReporterTest.reconfigure(ReporterTest.java:91)
>       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.InvokeMethod.evaluate(InvokeMethod.java:17)
>       at 
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
>       at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
>       at org.junit.rules.RunRules.evaluate(RunRules.java:20)
>       at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
>       at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
>       at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
>       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.junit.runner.JUnitCore.run(JUnitCore.java:137)
>       at 
> com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
>       at 
> com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
>       at 
> com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
>       at 
> com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
> Caused by: java.nio.file.FileSystemException: target\metrics\metrics.rrd -> 
> target\metrics\metrics.rrd.0: 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.WindowsFileCopy.move(WindowsFileCopy.java:387)
>       at 
> sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:287)
>       at java.nio.file.Files.move(Files.java:1395)
>       at 
> org.apache.sling.commons.metrics.rrd4j.impl.RRD4JReporter.rename(RRD4JReporter.java:387)
>       at 
> org.apache.sling.commons.metrics.rrd4j.impl.RRD4JReporter.renameDB(RRD4JReporter.java:369)
>       at 
> org.apache.sling.commons.metrics.rrd4j.impl.RRD4JReporter.createDB(RRD4JReporter.java:350)
>       at 
> org.apache.sling.commons.metrics.rrd4j.impl.RRD4JReporter.<init>(RRD4JReporter.java:195)
>       at 
> org.apache.sling.commons.metrics.rrd4j.impl.RRD4JReporter$Builder.build(RRD4JReporter.java:161)
>       at 
> org.apache.sling.commons.metrics.rrd4j.impl.CodahaleMetricsReporter.activate(CodahaleMetricsReporter.java:138)
>       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.apache.sling.testing.mock.osgi.OsgiServiceUtil.invokeMethod(OsgiServiceUtil.java:311)
> {noformat}
> This was also reported on the sling mailing list: 
> https://lists.apache.org/thread.html/7cda3b819f4138e31e9c084511e53ca3eebffbeb56cc689396d438cd@%3Cdev.sling.apache.org%3E
>  



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to