You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Jin Feng (Jira)" <ji...@apache.org> on 2020/04/17 13:39:00 UTC
[jira] [Commented] (CAMEL-14915) Trying to create directory
(FtpOperations.buildDirectory) without starting directory in ftps URI
[ https://issues.apache.org/jira/browse/CAMEL-14915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17085752#comment-17085752 ]
Jin Feng commented on CAMEL-14915:
----------------------------------
Seems like the problem is worse than I reported initially. I worked around the initial `buildDirectory()` failure and long timeout by using `autoCreate=false`, that got the route created and started successfully. But later, file retrieval always met with
{noformat}
org.apache.camel.component.file.GenericFileOperationFailedException: File operation failed: 125 Data connection already open; transfer starting.\r
Read timed out. Code: 125
\tat org.apache.camel.component.file.remote.FtpOperations.listFiles(FtpOperations.java:886)
\tat org.apache.camel.component.file.remote.strategy.FtpChangedExclusiveReadLockStrategy.acquireExclusiveReadLock(FtpChangedExclusiveReadLockStrategy.java:95)
\tat org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.begin(GenericFileProcessStrategySupport.java:64)
\tat org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.begin(GenericFileRenameProcessStrategy.java:37)
\tat org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:362)
\tat org.apache.camel.component.file.remote.RemoteFileConsumer.processExchange(RemoteFileConsumer.java:133)
\tat org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:223)
\tat org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:187)
\tat org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174)
\tat org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101)
\tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
\tat java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
\tat java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
\tat java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
\tat java.lang.Thread.run(Thread.java:748)
Caused by: java.net.SocketTimeoutException: Read timed out
\tat java.net.SocketInputStream.socketRead0(Native Method)
\tat java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
\tat java.net.SocketInputStream.read(SocketInputStream.java:171)
\tat java.net.SocketInputStream.read(SocketInputStream.java:141)
\tat sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
\tat sun.security.ssl.InputRecord.read(InputRecord.java:503)
\tat sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:975)
\tat sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1367)
\tat sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1395)
\tat sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1379)
\tat org.apache.commons.net.ftp.FTPSClient._openDataConnection_(FTPSClient.java:646)
\tat org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:785)
\tat org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:3409)
\tat org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:3339)
\tat org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:3016)
\tat org.apache.camel.component.file.remote.FtpOperations.listFiles(FtpOperations.java:878)
\t... 16 more
{noformat}
I finally worked around the problem by changing my ftp uri to:
{noformat}
ftps://filetransfer.bpost.be//
{noformat}
Notice the extra / there? Everything now worked fine. But that seems very strange and extra burden on camel user to take care of this default (missing) starting directory situation.
> Trying to create directory (FtpOperations.buildDirectory) without starting directory in ftps URI
> ------------------------------------------------------------------------------------------------
>
> Key: CAMEL-14915
> URL: https://issues.apache.org/jira/browse/CAMEL-14915
> Project: Camel
> Issue Type: Bug
> Components: camel-ftp
> Affects Versions: 2.24.0
> Environment: mac/linux
> Reporter: Jin Feng
> Priority: Major
> Fix For: 3.x
>
>
> Hi,
> I setup a route using this FTPS URI:
> {noformat}
> ftps://filetransfer.bpost.be/?bridgeErrorHandler=true&connectTimeout=60000&delay=600000&disconnect=true&idempotent=true&idempotentKey=......&idempotentRepository=%23gfpIdempotentRepository&ignoreFileNotFoundOrPermissionError=true&localWorkDirectory=%2Ftmp%2F895c3952-e3f7-401f-b38f-055fcdf44301&maxMessagesPerPoll=0&move=archive&passiveMode=true&password=xxxxxx
> {noformat}
> You can see we didn't specify starting directory which we assume it would be defaulted to "/", but actually inside the code it gets defaulted to "" empty.
> Upon debugging, I see this behavior from camel [FtpConsumer.doStart()|https://github.com/apache/camel/blob/master/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java#L77]:
> {code:java}
> try {
> connectIfNecessary();
> operations.buildDirectory(endpoint.getConfiguration().getDirectory(), true);
> } catch (GenericFileOperationFailedException e) {
> // log a WARN as we want to start the consumer.
> LOG.warn("Error auto creating directory: " + endpoint.getConfiguration().getDirectory() + " due " + e.getMessage() + ". This exception is ignored.", e);
> }
> {code}
> Now my ftp URI doesn't have starting directory, (which is optional according to [https://camel.apache.org/components/latest/ftps-component.html]), so the `getDirector()` here returns "" empty string. And then inside [FtpOperations.buildDirectory()|https://github.com/apache/camel/blob/master/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java#L359]:
> {code:java}
> try {
> // maybe the full directory already exists
> success = client.changeWorkingDirectory(directory);
> if (!success) {
> log.trace("Trying to build remote directory: {}", directory);
> success = client.makeDirectory(directory);
> if (!success) {
> // we are here if the server side doesn't create
> // intermediate folders so create the folder one by one
> success = buildDirectoryChunks(directory);
> }
> }
> return success;
> } finally {
> {code}
> It tries first to enter the "" directory, which failed. Then it tried to makeDirectory(""), which failed as well, after a very long timeout.
>
> Of course we can use "autoCreate=false" to turn this behavior off. But my question is why do we want to try to autoCreate a directory when the directory string is actually "" empty?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)