apache/seatunnel · warning
Failed to disconnect from FTP server
Error message
Failed to disconnect from FTP server
What it means
In disconnect()'s finally block, the physical disconnect() call on a still-connected FTPClient threw an IOException. Like the logout warning, this is swallowed and logged at WARN because the session is being discarded anyway; the connection release cannot fail the enclosing operation.
Solutions
- No action needed — the exception is intentionally logged at WARN; the connection object is abandoned afterward and garbage collected.
- If sockets accumulate (fd leak), confirm this is the only disconnect path and check whether clients are shared across threads.
- Investigate network middleboxes (NAT/firewall) that may be dropping idle control connections abruptly; enable keep-alive or reduce session idle time.
Defensive patterns
Strategy: try-catch
Try / catch
// Same swallow-and-log pattern the connector uses:
if (client.isConnected()) {
try {
client.disconnect();
} catch (IOException e) {
LOG.warn("Failed to disconnect from FTP server (non-fatal)", e);
}
} Prevention
- Never reuse an FTPClient after a failed disconnect — create a fresh one
- Check for NAT/firewall devices that reset idle control connections
- If socket/file-descriptor leaks appear, ensure every client passes through disconnect() in a finally block
When it happens
Trigger: client.isConnected() is still true in the finally block after logout failed, and the subsequent client.disconnect() raises IOException — e.g. the socket is already half-closed by the server, a reset (RST) arrives, or the underlying socket is in an inconsistent state.
Common situations: Server forcefully reset the connection (connection reset) before the client could close it; half-open TCP connection after a network drop; double-close races in pooled/reused clients; FTP server crash during session teardown.
Related errors
- Failed to logout from FTP server while disconnecting
- Can't make directory for path
- Cannot rename under itself
- Client not connected
- Collector authentication timeout from
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/263d4b5b40ffc652.
Report an issue: GitHub.
Appendix: source
Thrown at seatunnel-connectors-v2/connector-file/connector-file-ftp/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/ftp/system/SeaTunnelFTPFileSystem.java:274
}
try {
boolean logoutSuccess = client.logout();
if (!logoutSuccess) {
LOG.warn(
"Logout failed while disconnecting, error code - " + client.getReplyCode());
}
} catch (IOException e) {
// Some FTP servers close the control connection before responding to QUIT. The
// preceding operation has already completed, so do not turn a successful operation
// into a failure while releasing the connection.
LOG.warn("Failed to logout from FTP server while disconnecting", e);
} finally {
if (client.isConnected()) {
try {
client.disconnect();
} catch (IOException e) {
LOG.warn("Failed to disconnect from FTP server", e);
}
}
}
}
/**
* Resolve against given working directory. *
*
* @param workDir workDir
* @param path path
* @return Path
*/
private Path makeAbsolute(Path workDir, Path path) {
if (path.isAbsolute()) {
String filePath = path.toUri().getPath();
if (filePath.equals("/")) {
return workDir;
}View on GitHub (pinned to cf67b549a7)