[
https://issues.apache.org/jira/browse/CAMEL-8860?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14609766#comment-14609766
]
Grzegorz Grzybek commented on CAMEL-8860:
-----------------------------------------
[~himanshu], I was checking your example and I see that I was using
{{passiveMode=true}}, you were using active mode, so:
* without using tempFileName, each send operation created one server socket on
your side (FTP active mode) to send the file to server
* when using tempFileName, each send operation create *three* server sockets
** to check if target file exists
** to check if temp file exists
** to store file
Mina FTP client doesn't provide a way to set SO_REUSEADDR option in server
socket, so it defaults to .... platform specific value. In my case (Linux
4.0.6) the value is true, so when creating another server socket, Linux can
reuse existing socket in TIME-WAIT state.
Didn't you try considering ftp passive mode?
> Too many connection in TIME_WAIT when tempfilename is set in the FTP producer
> URI.
> ----------------------------------------------------------------------------------
>
> Key: CAMEL-8860
> URL: https://issues.apache.org/jira/browse/CAMEL-8860
> Project: Camel
> Issue Type: Bug
> Components: camel-ftp
> Affects Versions: 2.14.0
> Reporter: Himanshu Mittal
> Assignee: Grzegorz Grzybek
> Attachments: ResultWithOutTempFileName.log,
> ResultWithTempfileName.log,
> Result_With_tempfileName_FTPServer_Connection_Count.PNG,
> Result_Without_tempfilename.PNG, TestFTPConnectionLeak.java
>
>
> So many connections remain in TIME_WAIT state while configuring a FTP
> producer route with tempfilename property in FTP producer.
> Files are writen using producer template.
> Producertemplate.sendBodyAndHeader(producerURI, Exchange.FILE_NAME, fileName)
> to write file to destination.
> Producer URI :
> {{ftp://<USER@MACHINE_ADDRESS>//?password=RAW(PASSWORD)&binary=true&passiveMode=false&delete=true&pollStrategy=#ConsumerPollStrategy&disconnect=false&tempFileName=/temp/hello.tmp&initialDelay=10&throwExceptionOnConnectFailed=true&reconnectDelay=10&maximumReconnectAttempts=0&maxMessagesPerPoll=100&readLock=changed&readLockCheckInterval=500&readLockMinLength=1&sendEmptyMessageWhenIdle=true}}
> fileName: {{file.tmp}}
> We are writing ~ 2000 files . First files are written to temp directory then
> moved to destination. Connections opened for tempfiles are not re used to
> write temporary files and we run out of connection after writing 1000 files.
> Route resumes once connections are released.
> Is there a way we can reuse connection to write temporary files also.
> Once tempfilename is removed from the configuration then single connection is
> used for ftp transfer.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)