Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The process cannot access the file because it is being used by another process. #33

Open
oraix opened this issue Mar 15, 2016 · 2 comments

Comments

@oraix
Copy link

oraix commented Mar 15, 2016

总是出现这个错误,并无限循环
The process cannot access the file because it is being used by another process.

用proexp查看并未发现那个进程在占用,查看目标目录中,能找到play-jdbc-api_2.11-2.5.0-sources.jar.sha1这个文件,里面也有内容。也可正常删除。

SBT改用oschina源后没有问题。

Using client of fast-upstream for koala
03-15 08:45:55.383 �[1;31mERROR�[0;39m akka.actor.OneForOneStrategy akka://repox/user/RequestQueueMaster/GetQueueWorker_187535/GetMaster_187536
�[34mC:\Users\me.repox\storage\temp\repox9210516608242367649.tmp -> C:\Users\me.repox\storage\com\typesafe\play\play-jdbc-api_2.11\2.5.0\play-jdbc-api_2.11-2.5.0-sources.jar.sha1: The process cannot access the file because it is being used by another process.
�[0;39m

java.nio.file.FileSystemException: C:\Users\me.repox\storage\temp\repox9210516608242367649.tmp -> C:\Users\me.repox\storage\com\typesafe\play\play-jdbc-api_2.11\2.5.0\play-jdbc-api_2.11-2.5.0-sources.jar.sha1: The process cannot access the file because it is being used by another process.

    at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:86) ~[na:1.8.0_45]
    at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97) ~[na:1.8.0_45]
    at sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:301) ~[na:1.8.0_45]
    at sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:287) ~[na:1.8.0_45]
    at java.nio.file.Files.move(Files.java:1395) ~[na:1.8.0_45]
    at com.gtan.repox.GetMaster$$anonfun$gettingChecksum$1.applyOrElse(GetMaster.scala:181) ~[repox-assembly-0.1-SNAPSHOT.jar:0.1-SNAPSHOT]
    at akka.actor.Actor$class.aroundReceive(Actor.scala:480) ~[repox-assembly-0.1-SNAPSHOT.jar:0.1-SNAPSHOT]
    at com.gtan.repox.GetMaster.aroundReceive(GetMaster.scala:31) ~[repox-assembly-0.1-SNAPSHOT.jar:0.1-SNAPSHOT]
    at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526) [repox-assembly-0.1-SNAPSHOT.jar:0.1-SNAPSHOT]
    at akka.actor.ActorCell.invoke(ActorCell.scala:495) [repox-assembly-0.1-SNAPSHOT.jar:0.1-SNAPSHOT]
    at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257) [repox-assembly-0.1-SNAPSHOT.jar:0.1-SNAPSHOT]
    at akka.dispatch.Mailbox.run(Mailbox.scala:224) [repox-assembly-0.1-SNAPSHOT.jar:0.1-SNAPSHOT]
    at akka.dispatch.Mailbox.exec(Mailbox.scala:234) [repox-assembly-0.1-SNAPSHOT.jar:0.1-SNAPSHOT]
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) [repox-assembly-0.1-SNAPSHOT.jar:0.1-SNAPSHOT]
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) [repox-assembly-0.1-SNAPSHOT.jar:0.1-SNAPSHOT]
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) [repox-assembly-0.1-SNAPSHOT.jar:0.1-SNAPSHOT]
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) [repox-assembly-0.1-SNAPSHOT.jar:0.1-SNAPSHOT]

Using client of fast-upstream for oschina
03-15 08:45:55.390 �[39mDEBUG�[0;39m com.gtan.repox.GetMaster akka://repox/user/RequestQueueMaster/GetQueueWorker_187535/GetMaster_187536

@Centaur
Copy link
Owner

Centaur commented Mar 15, 2016

感谢提交此问题。

目标文件存在这个事实应该就是问题所在。此时repox所做的操作是将刚从上游下载到临时文件移动为目标文件,只有当目标文件之前不存在时才会触发下载操作。可能是哪里的时序出现了问题。看 stacktrace 你应该是在 windows 上运行的 repox. Windows 环境下确实缺乏测试。有待重现。

一个题外话是koala仓库似乎对外部用户不是特别友好,在社区公服上已经把koala仓库禁掉了。目前公服上优先级为 1 的三个主要 maven 仓库是:

oschina: http://maven.oschina.net/content/groups/public
tmatesoft: http://maven.tmatesoft.com/content/groups/public
google-mirror: https://maven-central.storage.googleapis.com (是的,国内可以正常访问)

@irhawks
Copy link

irhawks commented Nov 29, 2017

使用Windows下面的Oracle JDK8,遇到同样的问题:

主要表现:持续下载文件,但是每次从临时文件中拷贝jar文件时总是出现错误

Using client of fast-upstream for koala
11-29 10:39:18.831 �[39mDEBUG�[0;39m com.gtan.repox.GetWorker akka://repox/user/
RequestQueueMaster/GetQueueWorker_29/GetMaster_30/GetWorker_sonatype_56
�[34mdownloaded 40 bytes. 100.00 %�[0;39m

11-29 10:39:18.832 �[34mINFO �[0;39m com.gtan.repox.GetMaster akka://repox/user/
RequestQueueMaster/GetQueueWorker_29/GetMaster_30
�[34mGetWorker GetWorker_sonatype_56 completed /com/stratio/datasource/spark-mo
ngodb_2.11/0.12.0/spark-mongodb_2.11-0.12.0.jar. Checksum success�[0;39m

11-29 10:39:18.834 �[1;31mERROR�[0;39m akka.actor.OneForOneStrategy akka://repox
/user/RequestQueueMaster/GetQueueWorker_29/GetMaster_30
�[34mC:\Users\user9.repox\storage\temp\6302\repox1795478119027292363.tmp -> C:
\Users\user9.repox\storage\com\stratio\datasource\spark-mongodb_2.11\0.12.0\spa
rk-mongodb_2.11-0.12.0.jar: 另一个程序正在使用此文件,进程无法访问。
�[0;39m

java.nio.file.FileSystemException: C:\Users\user9.repox\storage\temp\6302\repox
1795478119027292363.tmp -> C:\Users\user9.repox\storage\com\stratio\datasource
spark-mongodb_2.11\0.12.0\spark-mongodb_2.11-0.12.0.jar: 另一个程序正在使用此文
件,进程无法访问。

    at sun.nio.fs.WindowsException.translateToIOException(WindowsException.j

ava:86)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.jav
a:97)
at sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:301)
at sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.j
ava:287)
at java.nio.file.Files.move(Files.java:1395)
at com.gtan.repox.GetMaster$$anonfun$gettingChecksum$1.applyOrElse(GetMa
ster.scala:193)
at akka.actor.Actor.aroundReceive(Actor.scala:497)
at akka.actor.Actor.aroundReceive$(Actor.scala:495)
at com.gtan.repox.GetMaster.aroundReceive(GetMaster.scala:43)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526)
at akka.actor.ActorCell.invoke(ActorCell.scala:495)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)
at akka.dispatch.Mailbox.run(Mailbox.scala:224)
at akka.dispatch.Mailbox.exec(Mailbox.scala:234)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java
:902)
at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1689)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1644)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.ja
va:157)
11-29 10:39:18.840 �[39mDEBUG�[0;39m com.gtan.repox.GetMaster akka://repox/user/
RequestQueueMaster/GetQueueWorker_29/GetMaster_30
�[34mTry Vector(Vector(koala), Vector(sonatype, oschina), Vector(central)) /com
/stratio/datasource/spark-mongodb_2.11/0.12.0/spark-mongodb_2.11-0.12.0.jar�[0;3
9m

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants