Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.0
-
None
Description
I use Commons VFS to access FTP from multiple threads. In each thread I create directories and copy files on the FTP server.
Nearly everytime when i run the program a deadlock occurs which causes all threads to hang. I've created a stacktrace with "jstack" which clearly shows where the deadlock is happening.
Stacktrace:
Found one Java-level deadlock: ============================= "pool-1-thread-5": waiting to lock monitor 0x030813b4 (object 0x22f972e8, a org.apache.commons.vfs.provider.ftp.FtpFileSystem), which is held by "pool-1-thread-2" "pool-1-thread-2": waiting to lock monitor 0x03082c7c (object 0x22f999e0, a java.lang.Object), which is held by "pool-1-thread-4" "pool-1-thread-4": waiting to lock monitor 0x030813b4 (object 0x22f972e8, a org.apache.commons.vfs.provider.ftp.FtpFileSystem), which is held by "pool-1-thread-2" Java stack information for the threads listed above: =================================================== "pool-1-thread-5": at org.apache.commons.vfs.provider.AbstractFileSystem.streamOpened(AbstractFileSystem.java:569) - waiting to lock <0x22f972e8> (a org.apache.commons.vfs.provider.ftp.FtpFileSystem) at org.apache.commons.vfs.provider.DefaultFileContent.streamOpened(DefaultFileContent.java:92) at org.apache.commons.vfs.provider.DefaultFileContent.getOutputStream(DefaultFileContent.java:377) at at.js.jtransporter.transporter.VFSTransporter.createFile(VFSTransporter.java:119) at at.js.jtransporter.worker.resource.ResourceWorker.createFile(ResourceWorker.java:80) at at.js.jtransporter.worker.resource.ResourceWorker.processJob(ResourceWorker.java:51) at at.js.jtransporter.worker.AbstractRunnableWorker.run(AbstractRunnableWorker.java:82) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) at java.lang.Thread.run(Thread.java:619) "pool-1-thread-2": at org.apache.commons.vfs.provider.ftp.FtpFileSystem.putClient(FtpFileSystem.java:137) - waiting to lock <0x22f999e0> (a java.lang.Object) at org.apache.commons.vfs.provider.ftp.FtpFileObject.doGetChildren(FtpFileObject.java:158) at org.apache.commons.vfs.provider.ftp.FtpFileObject.getChildFile(FtpFileObject.java:103) at org.apache.commons.vfs.provider.ftp.FtpFileObject.getInfo(FtpFileObject.java:181) at org.apache.commons.vfs.provider.ftp.FtpFileObject.refresh(FtpFileObject.java:208) at org.apache.commons.vfs.provider.AbstractFileSystem.resolveFile(AbstractFileSystem.java:319) - locked <0x22f972e8> (a org.apache.commons.vfs.provider.ftp.FtpFileSystem) at org.apache.commons.vfs.provider.AbstractFileSystem.resolveFile(AbstractFileSystem.java:267) - locked <0x22f972e8> (a org.apache.commons.vfs.provider.ftp.FtpFileSystem) at org.apache.commons.vfs.provider.AbstractFileObject.getParent(AbstractFileObject.java:512) - locked <0x22f972e8> (a org.apache.commons.vfs.provider.ftp.FtpFileSystem) at org.apache.commons.vfs.provider.ftp.FtpFileObject.getInfo(FtpFileObject.java:177) at org.apache.commons.vfs.provider.ftp.FtpFileObject.refresh(FtpFileObject.java:208) at org.apache.commons.vfs.provider.AbstractFileSystem.resolveFile(AbstractFileSystem.java:319) - locked <0x22f972e8> (a org.apache.commons.vfs.provider.ftp.FtpFileSystem) at org.apache.commons.vfs.provider.AbstractFileSystem.resolveFile(AbstractFileSystem.java:267) - locked <0x22f972e8> (a org.apache.commons.vfs.provider.ftp.FtpFileSystem) at org.apache.commons.vfs.provider.AbstractFileObject.resolveFile(AbstractFileObject.java:670) at at.js.jtransporter.transporter.VFSTransporter.createFile(VFSTransporter.java:118) at at.js.jtransporter.worker.resource.ResourceWorker.createFile(ResourceWorker.java:80) at at.js.jtransporter.worker.resource.ResourceWorker.processJob(ResourceWorker.java:51) at at.js.jtransporter.worker.AbstractRunnableWorker.run(AbstractRunnableWorker.java:82) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) at java.lang.Thread.run(Thread.java:619) "pool-1-thread-4": at org.apache.commons.vfs.provider.AbstractFileSystem.resolveFile(AbstractFileSystem.java:267) - waiting to lock <0x22f972e8> (a org.apache.commons.vfs.provider.ftp.FtpFileSystem) at org.apache.commons.vfs.provider.AbstractFileSystem.getRoot(AbstractFileSystem.java:242) at org.apache.commons.vfs.provider.ftp.FtpFileSystem.getClient(FtpFileSystem.java:108) - locked <0x22f999e0> (a java.lang.Object) at org.apache.commons.vfs.provider.ftp.FtpFileObject.doGetOutputStream(FtpFileObject.java:490) at org.apache.commons.vfs.provider.AbstractFileObject.getOutputStream(AbstractFileObject.java:1219) at org.apache.commons.vfs.provider.DefaultFileContent.getOutputStream(DefaultFileContent.java:373) at at.js.jtransporter.transporter.VFSTransporter.createFile(VFSTransporter.java:119) at at.js.jtransporter.worker.resource.ResourceWorker.createFile(ResourceWorker.java:80) at at.js.jtransporter.worker.resource.ResourceWorker.processJob(ResourceWorker.java:51) at at.js.jtransporter.worker.AbstractRunnableWorker.run(AbstractRunnableWorker.java:82) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) at java.lang.Thread.run(Thread.java:619) Found 1 deadlock.