1 year ago

#209270

test-img

banjara

jsch thread hanging while reading from SFTP

I have noticed slowness in reading data from SFTP server, I have 10 parallel processes running in the different containers which are reading this data and slowness is usually observed in one container randomly. I am using commons-vfs to read data from SFTP server and I have extended SFTP related classes to add come sort logic. I am using centos-7.9 to host my SFTP server. I have noticed the reader thread is in blocked state and waiting for monitor thread to release lock.

Can someone please guide me on how to fix this issue.

"Thread-135" #150 prio=5 os_prio=0 tid=0x00007f1e3808d800 nid=0x3a2 waiting for monitor entry [0x00007f1ea5eed000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at org.apache.commons.vfs2.provider.AbstractFileSystem.resolveFile(AbstractFileSystem.java:306)
        - waiting to lock <0x00000005cedf23f8> (a org.apache.commons.vfs2.provider.sftp.MySftpFileSystem)
        at org.apache.commons.vfs2.provider.AbstractFileSystem.resolveFile(AbstractFileSystem.java:301)
        at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:76)
        at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:56)
        at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:711)
        at org.apache.commons.vfs2.impl.DefaultVfsComponentContext.resolveFile(DefaultVfsComponentContext.java:46)
        at org.apache.commons.vfs2.provider.AbstractLayeredFileProvider.findFile(AbstractLayeredFileProvider.java:54)
        at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:711)
        at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:677)
        at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:632)
        at com.sqlstream.aspen.namespace.filevfs.FileVFSInputSource$FileReader.run(FileVFSInputSource.java:894)
        at java.lang.Thread.run(Thread.java:748)

"Thread-134" #149 daemon prio=1 os_prio=0 tid=0x00007f1e381e7800 nid=0x3a1 in Object.wait() [0x00007f1ea6af9000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        at java.io.PipedInputStream.read(PipedInputStream.java:326)
        - eliminated <0x00000005d821ea90> (a com.jcraft.jsch.Channel$MyPipedInputStream)
        at java.io.PipedInputStream.read(PipedInputStream.java:377)
        - locked <0x00000005d821ea90> (a com.jcraft.jsch.Channel$MyPipedInputStream)
        at com.jcraft.jsch.ChannelSftp.fill(ChannelSftp.java:2909)
        at com.jcraft.jsch.ChannelSftp.header(ChannelSftp.java:2935)
        at com.jcraft.jsch.ChannelSftp.ls(ChannelSftp.java:1643)
        at com.jcraft.jsch.ChannelSftp.ls(ChannelSftp.java:1553)
        at org.apache.commons.vfs2.provider.sftp.MySftpFileObject.doListChildrenResolved(MySftpFileObject.java:376)
        at org.apache.commons.vfs2.provider.AbstractFileObject.getChildren(AbstractFileObject.java:1081)
        - locked <0x00000005cedf23f8> (a org.apache.commons.vfs2.provider.sftp.MySftpFileSystem)
        at com.sqlstream.aspen.namespace.filevfs.MyFileMonitor$FileMonitorAgent.checkForNewChildren(MyFileMonitor.java:458)
        at com.sqlstream.aspen.namespace.filevfs.MyFileMonitor$FileMonitorAgent.check(MyFileMonitor.java:543)
        at com.sqlstream.aspen.namespace.filevfs.MyFileMonitor$FileMonitorAgent.access$200(MyFileMonitor.java:376)
        at com.sqlstream.aspen.namespace.filevfs.MyFileMonitor.run(MyFileMonitor.java:321)
        at java.lang.Thread.run(Thread.java:748)

java

multithreading

java-threads

vfs

apache-commons-vfs

0 Answers

Your Answer

Accepted video resources