FTP response 421 received. Server closed connection.

YouTrack | 3 months ago
  1. 0

    Uploading multiple files via FTP fails

    GitHub | 3 years ago | yoan-m FTP response 421 received. Server closed connection.
  2. 0

    If the connection timeout defined for the FTP server is less than the poll period defined for the channel-adapter's poller, the pool will eventually contain connections that have been dropped by the server. This results in: {code} WARNING: Failure notification received by [FtpSource] for message: null org.springframework.integration.message.MessagingException: Error while polling for messages. at org.springframework.integration.adapter.file.AbstractDirectorySource.receive( at org.springframework.integration.message.MessageExchangeTemplate.doReceive( at org.springframework.integration.message.MessageExchangeTemplate.doReceiveAndForward( at org.springframework.integration.message.MessageExchangeTemplate.receiveAndForward( at at org.springframework.integration.scheduling.spi.ProviderTaskScheduler$ at java.util.concurrent.Executors$ Source) at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source) at java.util.concurrent.FutureTask.runAndReset(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$ Source) at Source) Caused by: FTP response 421 received. Server closed connection. at at at at at at at at at at org.springframework.integration.adapter.ftp.FtpSource.populateSnapshot( at org.springframework.integration.adapter.ftp.FtpSource.refreshSnapshotAndMarkProcessing( at org.springframework.integration.adapter.file.AbstractDirectorySource.receive( ... 14 more {code} It's possible to send a NOOP (No Operation) command to the FTP Server before passing the FTPClient instance on. This should restart the "connection" timer. Here's a better version of QueuedFTPClientPool.getClient(): {code} public synchronized FTPClient getClient() throws SocketException, IOException { FTPClient client = null; boolean disconnected = true; while(disconnected) { client = pool.isEmpty() ? factory.getClient() : pool.poll(); try { if(client.sendNoOp()) disconnected = false; else disconnect(client); } catch (FTPConnectionClosedException e) { disconnect(client); } } return client; } private void disconnect(FTPClient client) { try { client.disconnect(); } catch(IOException e) { //Ignore or log } } {code} This is not perfect however, since FTP servers (at least FileZilla) also define a "no transfer timeout" (the time a user has to initiate a file transfer) in addition to the "connection timeout". There seems to be no way of restarting that timer, and if the poll period and the "no transfer timeout" are close enough to each other, we could see a race condition in which the client.sendNoOp() returns true and restarts the "connection" timer, but the "no transfer timeout" expires before the client gets to transfer a file and thus holds a "dead" connection. This should be documented so the user knows to either disable the "no transfer timeout" or to use a a pool size of zero to avoid potential problems.

    Spring JIRA | 8 years ago | Martti von Hertzen
    org.springframework.integration.message.MessagingException: Error while polling for messages.
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    MATLAB Central - Re: problem with mput & mget (file up/download to | 6 months ago FTP > response > 421 received. Server closed connection.
  5. 0

    Areca Backup / Discussion / Open Discussion:ftp timeouts | 1 year ago FTP response 421 received. Server closed connection.

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis


      FTP response 421 received. Server closed connection.

    2. Commons Net
      6 frames
    3. Commons VFS Core
      1. org.apache.commons.vfs2.provider.ftp.FTPClientWrapper.noop(
      2. org.apache.commons.vfs2.provider.ftp.JBFtpKeepAliveCommand$1.invoke(
      2 frames
    4. JetBrains plugins
      1. com.jetbrains.plugins.webDeployment.connections.PatchedFtpFileSystem$
      1 frame
    5. Openapi
      1. com.intellij.util.concurrency.QueueProcessor.runSafely(
      1 frame
    6. IDEA
      1. com.intellij.util.Alarm$Request$
      2. com.intellij.util.Alarm$
      2 frames
    7. Java RT
      1. java.util.concurrent.Executors$
      2 frames
    8. Openapi
      1. com.intellij.util.concurrency.SchedulingWrapper$
      2. com.intellij.util.concurrency.BoundedTaskExecutor$
      2 frames
    9. Java RT
      1. java.util.concurrent.ThreadPoolExecutor.runWorker(
      2. java.util.concurrent.ThreadPoolExecutor$
      3 frames