panpan2019 opened a new issue, #6323:
URL: https://github.com/apache/seatunnel/issues/6323

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22bug%22)
 and found no similar issues.
   
   
   ### What happened
   
   When closing SFTPInputStream after SFTP read/write completion, the 
SFTPInputStream.close method is not properly closing the file stream. This can 
lead to resource leaks.
   
   ### SeaTunnel Version
   
   2.3.2
   
   ### SeaTunnel Config
   
   ```conf
   env {
     execution.parallelism = 2
     job.mode = "BATCH"
   
   }
   source{
      SftpFile {
       path = "/home/dataos/test"
       host = "10.21.10.129"
       port = 22
       user = xxx
       password = "****"
       file_format_type = "text"
       result_table_name = SftpFile_source_4
       schema = {
        fields {
         name = string
         age = int
         }
       }
       delimiter = ","
      }
     } 
     
    transform{
       Sql{
        source_table_name = "SftpFile_source_4"
       result_table_name = "Sql-transform-4"
       query = "select name,age, DES_ENCRYPT('1111111111',name)  des_name from 
SftpFile_source_4"
       }
     }
     
     sink {
       SftpFile{
         file_format_type="text",
         path = "/home/test1"
         host = "xxx"
         port = 22
         user = xxx
         password = "****"
         file_format_type = "text"
         field_delimiter=",",
         row_delimiter= "/t",
         sink_columns = ["name","age","des_name"]
         source_table_name="Sql-transform-4" 
       }
     }
   ```
   
   
   ### Running Command
   
   ```shell
   ./bin/seatunnel.sh --config ./task/sftp2sftp
   ```
   
   
   ### Error Exception
   
   ```log
   1.Terminal shows that the SFTP connection is not released.
   2.Debugging reveals that the file stream is not closed when the 
SFTPInputStream.close method is triggered.
   ```
   
   
   ### Zeta or Flink or Spark Version
   
   _No response_
   
   ### Java or Scala Version
   
   jdk8
   
   ### Screenshots
   
   
   
![1706780364018](https://github.com/apache/seatunnel/assets/49435072/73092075-a935-45bf-aa4c-dfd9f28ffa08)
   
![1706780493923](https://github.com/apache/seatunnel/assets/49435072/ad88f660-25cf-4e36-8902-e09cb977a4b3)
   1.The initialization of SFTPInputStream.class does not pass the file stream 
to the parent class FSInputStream.class
   2.the SFTPInputStream.close method only triggers the FSInputStream.close 
method, which is unable to close the file stream actually held by 
SFTPInputStream.
   
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to