andreasnef commented on issue #2127:
URL: https://github.com/apache/jena/issues/2127#issuecomment-1851629952

   Adapted `org.apache.jena.tdb2.sys.DatabaseOps` to use 
`java.nio.Files.delete()` and extended logging a bit, seems that on Windows we 
have other processes accessing these files:
   
   ```
   10:16:20 DEBUG DatabaseOps     :: Deleting old database after successful 
compaction (old db path='D:\data\fuseki\repository\Data-0009')...
   10:16:20 DEBUG DatabaseOps     :: deleting path 
D:\data\fuseki\repository\Data-0009\tdb.lock
   10:16:20 DEBUG DatabaseOps     :: deleting path 
D:\data\fuseki\repository\Data-0009\SPOG.idn
   10:16:20 ERROR DatabaseOps     :: --> failed
   java.nio.file.FileSystemException: 
D:\data\fuseki\repository\Data-0009\SPOG.idn: The process cannot access the 
file because it is being used by another process.
   
        at 
sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:92) 
~[?:?]
        at 
sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103) 
~[?:?]
        at 
sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108) 
~[?:?]
        at 
sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:274)
 ~[?:?]
        at 
sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:105)
 ~[?:?]
        at java.nio.file.Files.delete(Files.java:1142) ~[?:?]
        at 
org.apache.jena.tdb2.sys.DatabaseOps.lambda$deleteDatabase$1(DatabaseOps.java:297)
 ~[fuseki-server.jar:4.8.0]
        at 
java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[?:?]
        at java.util.ArrayList.forEach(ArrayList.java:1541) ~[?:?]
        at java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:395) 
~[?:?]
        at java.util.stream.Sink$ChainedReference.end(Sink.java:258) ~[?:?]
        at 
java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485) ~[?:?]
        at 
java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) 
~[?:?]
        at 
java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) 
~[?:?]
        at 
java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
 ~[?:?]
        at 
java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
        at 
java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497) ~[?:?]
        at 
org.apache.jena.tdb2.sys.DatabaseOps.deleteDatabase(DatabaseOps.java:294) 
~[fuseki-server.jar:4.8.0]
        at org.apache.jena.tdb2.sys.DatabaseOps.compact(DatabaseOps.java:286) 
~[fuseki-server.jar:4.8.0]
        at org.apache.jena.tdb2.DatabaseMgr.compact(DatabaseMgr.java:81) 
~[fuseki-server.jar:4.8.0]
        at 
org.apache.jena.fuseki.ctl.ActionCompact$CompactTask.run(ActionCompact.java:109)
 ~[fuseki-server.jar:4.8.0]
        at 
org.apache.jena.fuseki.async.AsyncPool.lambda$submit$0(AsyncPool.java:66) 
~[fuseki-server.jar:4.8.0]
        at org.apache.jena.fuseki.async.AsyncTask.call(AsyncTask.java:100) 
[fuseki-server.jar:4.8.0]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) 
[?:?]
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) 
[?:?]
        at java.lang.Thread.run(Thread.java:829) [?:?]
   10:16:20 WARN  Compact         :: [9] **** Exception in compact
   org.apache.jena.atlas.RuntimeIOException: java.nio.file.FileSystemException: 
D:\data\fuseki\repository\Data-0009\SPOG.idn: The process cannot access the 
file because it is being used by another process.
   
        at org.apache.jena.atlas.io.IOX.exception(IOX.java:52) 
~[fuseki-server.jar:4.8.0]
        at 
org.apache.jena.tdb2.sys.DatabaseOps.lambda$deleteDatabase$1(DatabaseOps.java:300)
 ~[fuseki-server.jar:4.8.0]
        at 
java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[?:?]
        at java.util.ArrayList.forEach(ArrayList.java:1541) ~[?:?]
        at java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:395) 
~[?:?]
        at java.util.stream.Sink$ChainedReference.end(Sink.java:258) ~[?:?]
        at 
java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485) ~[?:?]
        at 
java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) 
~[?:?]
        at 
java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) 
~[?:?]
        at 
java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
 ~[?:?]
        at 
java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
        at 
java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497) ~[?:?]
        at 
org.apache.jena.tdb2.sys.DatabaseOps.deleteDatabase(DatabaseOps.java:294) 
~[fuseki-server.jar:4.8.0]
        at org.apache.jena.tdb2.sys.DatabaseOps.compact(DatabaseOps.java:286) 
~[fuseki-server.jar:4.8.0]
        at org.apache.jena.tdb2.DatabaseMgr.compact(DatabaseMgr.java:81) 
~[fuseki-server.jar:4.8.0]
        at 
org.apache.jena.fuseki.ctl.ActionCompact$CompactTask.run(ActionCompact.java:109)
 ~[fuseki-server.jar:4.8.0]
        at 
org.apache.jena.fuseki.async.AsyncPool.lambda$submit$0(AsyncPool.java:66) 
~[fuseki-server.jar:4.8.0]
        at org.apache.jena.fuseki.async.AsyncTask.call(AsyncTask.java:100) 
[fuseki-server.jar:4.8.0]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) 
[?:?]
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) 
[?:?]
        at java.lang.Thread.run(Thread.java:829) [?:?]
   Caused by: java.nio.file.FileSystemException: 
D:\data\fuseki\repository\Data-0009\SPOG.idn: The process cannot access the 
file because it is being used by another process.
   
        at 
sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:92) 
~[?:?]
        at 
sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103) 
~[?:?]
        at 
sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108) 
~[?:?]
        at 
sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:274)
 ~[?:?]
        at 
sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:105)
 ~[?:?]
        at java.nio.file.Files.delete(Files.java:1142) ~[?:?]
        at 
org.apache.jena.tdb2.sys.DatabaseOps.lambda$deleteDatabase$1(DatabaseOps.java:297)
 ~[fuseki-server.jar:4.8.0]
        ... 20 more
   10:16:20 ERROR Server          :: Exception in task 1 execution
   org.apache.jena.atlas.RuntimeIOException: java.nio.file.FileSystemException: 
D:\data\fuseki\repository\Data-0009\SPOG.idn: The process cannot access the 
file because it is being used by another process.
   
        at org.apache.jena.atlas.io.IOX.exception(IOX.java:52) 
~[fuseki-server.jar:4.8.0]
        at 
org.apache.jena.tdb2.sys.DatabaseOps.lambda$deleteDatabase$1(DatabaseOps.java:300)
 ~[fuseki-server.jar:4.8.0]
        at 
java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[?:?]
        at java.util.ArrayList.forEach(ArrayList.java:1541) ~[?:?]
        at java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:395) 
~[?:?]
        at java.util.stream.Sink$ChainedReference.end(Sink.java:258) ~[?:?]
        at 
java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485) ~[?:?]
        at 
java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) 
~[?:?]
        at 
java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) 
~[?:?]
        at 
java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
 ~[?:?]
        at 
java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
        at 
java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497) ~[?:?]
        at 
org.apache.jena.tdb2.sys.DatabaseOps.deleteDatabase(DatabaseOps.java:294) 
~[fuseki-server.jar:4.8.0]
        at org.apache.jena.tdb2.sys.DatabaseOps.compact(DatabaseOps.java:286) 
~[fuseki-server.jar:4.8.0]
        at org.apache.jena.tdb2.DatabaseMgr.compact(DatabaseMgr.java:81) 
~[fuseki-server.jar:4.8.0]
        at 
org.apache.jena.fuseki.ctl.ActionCompact$CompactTask.run(ActionCompact.java:109)
 ~[fuseki-server.jar:4.8.0]
        at 
org.apache.jena.fuseki.async.AsyncPool.lambda$submit$0(AsyncPool.java:66) 
~[fuseki-server.jar:4.8.0]
        at org.apache.jena.fuseki.async.AsyncTask.call(AsyncTask.java:100) 
[fuseki-server.jar:4.8.0]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) 
[?:?]
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) 
[?:?]
        at java.lang.Thread.run(Thread.java:829) [?:?]
   Caused by: java.nio.file.FileSystemException: 
D:\data\fuseki\repository\Data-0009\SPOG.idn: The process cannot access the 
file because it is being used by another process.
   
        at 
sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:92) 
~[?:?]
        at 
sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103) 
~[?:?]
        at 
sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108) 
~[?:?]
        at 
sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:274)
 ~[?:?]
        at 
sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:105)
 ~[?:?]
        at java.nio.file.Files.delete(Files.java:1142) ~[?:?]
        at 
org.apache.jena.tdb2.sys.DatabaseOps.lambda$deleteDatabase$1(DatabaseOps.java:297)
 ~[fuseki-server.jar:4.8.0]
        ... 20 more
   10:16:20 INFO  Server          :: [Task 1] finishes : Compact
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to