Uploaded image for project: 'Spring Integration'
  1. Spring Integration
  2. INT-3537

FTP locks file if server not available

    XMLWordPrintable

    Details

      Description

      When trying to upload a file to an FTP / SFTP server, if the server is not available, the file remains locked. This blocks the rename / deletion of the file in post-processing.

      Looking in RemoteFileTemplate, within the integration-file jar, it seems that inputStreamHolder is not closed if the FTP session could not be created. It will be closed successfully if there is an error once the session has been created ok; such as incorrect remote folder but not if the error occurs during session creation.

      The code in question where the stream is opened:

      public String send(final Message<?> message, final String subDirectory) {
      		Assert.notNull(this.directoryExpressionProcessor, "'remoteDirectoryExpression' is required");
      		final StreamHolder inputStreamHolder = this.payloadToInputStream(message);
      		if (inputStreamHolder != null) {
      			return this.execute(new SessionCallback<F, String>() {
      ...
      

      Looking at the github master branch, this problem probably still exists in 4.1.

        Attachments

          Activity

            People

            Assignee:
            grussell Gary Russell
            Reporter:
            mcauleyt Tim McAuley
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: