apache/seatunnel · warning
Failed to logout from FTP server while disconnecting
Error message
Failed to logout from FTP server while disconnecting
What it means
During disconnect(), the client's logout() call threw an IOException (or returned false, which logs a related warning). The code deliberately logs this as a warning instead of propagating: some FTP servers close the control connection before replying to QUIT, and the preceding operation already completed. It is benign teardown noise, not a data-path failure.
Solutions
- No action needed — this is logged at WARN by design and the code still calls disconnect() in the finally block; verify the actual read/write operation succeeded.
- If it appears constantly, check server-side idle/session timeout settings and keep-alive configuration.
- Ensure the control connection is not being dropped by an intermediate firewall/proxy between client and server.
- Upgrade/inspect the FTP server if QUIT consistently fails with an error reply code (see the companion 'Logout failed ... error code' warning for the reply code).
Defensive patterns
Strategy: try-catch
Try / catch
// The library already swallows this; mirror the pattern in your own FTP code:
try {
if (!client.logout()) {
LOG.warn("Logout failed, reply code: " + client.getReplyCode());
}
} catch (IOException e) {
LOG.warn("Failed to logout during teardown (non-fatal)", e);
} finally {
try { client.disconnect(); } catch (IOException ignored) { }
} Prevention
- Treat logout/disconnect warnings during teardown as benign — check the success of the preceding read/write operation instead
- Align server idle-timeout and client keep-alive settings to avoid dropped control connections
- Monitor the companion 'Logout failed ... error code' warning for persistent server-side issues
When it happens
Trigger: client.logout() raises IOException while releasing the FTPClient after open, create, close, delete, listStatus, or getFileStatus — usually because the server already dropped the control connection, the socket timed out, or the server rejected the QUIT command with an error reply.
Common situations: FTP server with a short idle timeout that closed the connection mid-operation; server that terminates the control channel immediately after the last data transfer; flaky network between client and server; server restarting during teardown.
Related errors
- Failed to disconnect from FTP server
- Can't make directory for path
- Cannot rename under itself
- Client not connected
- Close file output stream
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/596b69efd94efdd3.
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:268
*
* @param client FTPClient
*/
void disconnect(FTPClient client) {
if (client == null || !client.isConnected()) {
return;
}
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
*/View on GitHub (pinned to cf67b549a7)