Loading

Tips For FTP/SFTP Servers That Close Connection Early Due To Security But Successful Retries With "Caused by: java.io.IOException: Pipe closed"

Fecha de publicación: Jul 24, 2025
Pasos

CONTENTS

Here are tips for tuning the FTP/SFTP connector where the FTP/SFTP server closes the connection early due to security reasons. It will show an error like "Caused by: java.io.IOException: Pipe" closed." However, subsequent retries are fine.

 
org.mule.runtime.api.exception.MuleRuntimeException: Found exception trying to obtain path /test
at org.mule.extension.file.common.api.command.AbstractFileCommand.exception(AbstractFileCommand.java:209)
at org.mule.extension.sftp.internal.command.SftpCommand.getFile(SftpCommand.java:92)
at org.mule.extension.sftp.internal.command.SftpCommand.getExistingFile(SftpCommand.java:71)
at org.mule.extension.sftp.internal.command.SftpListCommand.list(SftpListCommand.java:77)
at org.mule.extension.file.common.api.AbstractFileSystem.list(AbstractFileSystem.java:112)
at org.mule.extension.sftp.internal.source.SftpDirectoryListener.poll(SftpDirectoryListener.java:184)
at org.mule.runtime.module.extension.internal.runtime.source.poll.PollingSourceWrapper.lambda$poll$3(PollingSourceWrapper.java:192)
at org.mule.runtime.core.api.util.func.CheckedRunnable.run(CheckedRunnable.java:22)
at org.mule.runtime.module.extension.internal.runtime.source.poll.PollingSourceWrapper.withWatermarkLock(PollingSourceWrapper.java:497)
at org.mule.runtime.module.extension.internal.runtime.source.poll.PollingSourceWrapper.poll(PollingSourceWrapper.java:189)
at org.mule.runtime.module.extension.internal.runtime.source.poll.PollingSourceWrapper.lambda$onStart$0(PollingSourceWrapper.java:136)
at org.mule.runtime.module.extension.internal.runtime.source.poll.DelegateRunnable.run(DelegateRunnable.java:41)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.mule.service.scheduler.internal.AbstractRunnableFutureDecorator.doRun(AbstractRunnableFutureDecorator.java:111)
at org.mule.service.scheduler.internal.RunnableRepeatableFutureDecorator.run(RunnableRepeatableFutureDecorator.java:83)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.mule.runtime.api.exception.MuleRuntimeException: Could not obtain attributes for path /test
at org.mule.extension.sftp.internal.connection.SftpClient.exception(SftpClient.java:415)
at org.mule.extension.sftp.internal.connection.SftpClient.exception(SftpClient.java:409)
at org.mule.extension.sftp.internal.connection.SftpClient.getAttributes(SftpClient.java:142)
at org.mule.extension.sftp.internal.command.SftpCommand.getFile(SftpCommand.java:88)
... 17 more
Caused by: org.mule.runtime.api.connection.ConnectionException:
... 20 more
Caused by: 4:
at com.jcraft.jsch.ChannelSftp.stat(ChannelSftp.java:2204)
at org.mule.extension.sftp.internal.connection.SftpClient.getAttributes(SftpClient.java:137)
... 18 more
Caused by: java.io.IOException: Pipe closed
at java.io.PipedInputStream.read(PipedInputStream.java:307)
at com.jcraft.jsch.Channel$MyPipedInputStream.updateReadSide(Channel.java:362)
at com.jcraft.jsch.ChannelSftp.stat(ChannelSftp.java:2194)
... 19 more
 

STEPS TO FOLLOW

This scenario happens for apps running on a FTP / SFTP scheduler where once a connection is made and transaction is finished, connection will not be used again until 1 hour or x amount of time later. During the time that the last transaction finishes and the next transaction starts, there is no data going through the connection and it will be considered idle. FTP / SFTP server may disconnect sooner than the x amount of time. Please try adjusting the values per the tips below.

1) Enabling FTP/SFTP connection pooling:
SFTP: link 
FTP: link
2) Please set a smaller max idle time, such as 10 seconds. You will need to tune this so that the idle time will kill the connection before retrying the stale connection. This is useful in preparation for the next time the connection is used, and you want the idle connections to get destroyed so new connections can be rebuilt to avoid the above error.
3) Repeat the same tuning exercise for the eviction times as well. This will set the time for the process to check eviction eligibility, as well as the "eviction check" to ensure it runs at an interval convenient for your scenario.

Refer to the following article for a sample configuration:
SFTP Connector | Intermittent errors received as "Found exception trying to obtain path" or "Could not obtain attributes for path" or "Error occurred while trying to connect to host"
Número del artículo de conocimiento

001116180

 
Cargando
Salesforce Help | Article