MuleSoft / Anypoint Connectors
SFTP Connector | Pooled Connection Is Not Released When a Listener File Read Fails After a Connection Reset, Exhausting the Pool
- Reported
- Nov 25, 2026
- Updated
- Nov 26, 2026
- Fixed
- —
- Reports
- 0
- Found in
- —
- Reference
- W-25001660
Summary
When an SFTP listener (On New or Updated File) is reading a file's content and the connection to the SFTP server is reset, the connector tries to reconnect and read the file again once. If that retry also fails, the pooled connection used for the read is not returned to the connection pool.
Each such failure permanently uses up one connection in the pool. After the number of failures reaches the pool's maxActive value, every poll and every file read fails with "Connection pool is exhausted", even after the network is healthy again. Eviction settings do not recover the pool. No files are processed until the application is restarted.
The error logged for the failed read can say that the file was read but does not exist anymore, even though the file is still on the server.
Workaround
Disable connection pooling for the affected SFTP connection, so that each operation opens a new connection and closes it when done. A failed read then cannot use up the pool. Use either form:
- <pooling-profile disabled="true"/>
- <pooling-profile maxActive="0" maxIdle="0" maxWait="0"/>
This opens one new SSH connection per operation, so confirm that the SFTP server and your file volumes allow this. Test the change in a non-production environment first.
If pooling must stay enabled, a larger maxActive only delays the issue. Monitor the application logs for "Connection pool is exhausted" and restart the application if it appears.
Steps to reproduce
1. Configure an SFTP connection with connection pooling enabled, for example: pooling-profile maxActive="3" maxIdle="3" maxWait="100" exhaustedAction="WHEN_EXHAUSTED_WAIT".
2. Add an SFTP listener (On New or Updated File) on a directory, with autoDelete="true", and a flow that reads the file content.
3. Place files in the directory and cause file reads to fail. For example, reset the network connection to the SFTP server repeatedly while files are being read, or make the files unreadable on the server.
4. After as many failed reads as maxActive, restore normal conditions.
5. Observe that every subsequent poll fails with "Connection pool is exhausted" and no files are processed until the application is restarted.
Error details
Could not obtain connection while trying to poll directory '/your/directory'. Connection pool is exhausted Timeout waiting for idle object, borrowMaxWaitDuration=PT0.1S SFTP client is closed. Attempting to reconnect... DeletedFileWhileReadException: File on path /your/directory/file.xml was read but does not exist anymore. IOException: Connection reset
Status timeline
Nov 30, 2026
created · In Review · 0 reports
Nov 30, 2026
content changed · In Review · 0 reports