Skip to content

FtpSession readRaw + finalizeRaw blocking until 421 timeout #8786

Closed
@rcwinder

Description

@rcwinder

In what version(s) of Spring Integration are you seeing this issue?

6.1.2 - 6.1.4, and probably older too

Describe the bug

I am using the spring integration ftp package to connect to an ftp server to try and download some files.
Before downloading the actual files I created a check to see if the file is actually downloadable in the following way:

  1. Open inputStream using FtpSession readRaw(String source) method.
  2. Check if inputStream is not null and if no Exception is thrown
  3. Close inputStream
  4. call FtpSession finalizeRaw() to complete the transaction

However, when I do this for a file to which my ftpuser does not have access by OS permissions, the readRaw method will throw an Exception because of a 550 FTP error. This makes sense.
Then when I call finalizeRaw to allow to check or download another file afterwards, the readingRaw atomic boolean is correctly set to false. However when the finalizeRaw method calls this.client.completePendingCommand() it hangs until it receives a 421 (timeout) error.

Therefore my assumption that it seems the completePendingCommand should not be called when readRaw throws an Exception.
However the atomic boolean readingRaw is still set to true, so I am not able to skip the finalizeRaw call since this would not allow me to do another readRaw call.

To Reproduce

See above, when using readraw + finalizeraw on a path to a file to which the ftp user does not have os permissions

Expected behavior

Either of 3 possibilities:

  1. The readRaw method should put the atomicBoolean readingRaw to false because the process is no longer active
  2. There should be a (different) way to call finalize when readRaw threw an IOException
  3. The finalizeRaw method should not block upon completePendingCommand

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions