Closed jamoros closed 2 years ago
I'm starting to wonder if this is a permissions issue, or something else, maybe its not the file but the server itself.
I just created a test file and ran the test again:
/home/test/test/test.csv
So the code is now
stat("/home/test/test/test.csv")
Is there a way to LOG what stat is actually searching for? Beyond permissions Im wondering if the issue is the path Im passing in itself.
Here is the TRACE logging after authentication to cut it short:
09 Feb 2022 18:51:10,883 [ pool-1-thread-1] TRACE - Checking window space on channel=0 window=1023819 cached=0 extended=0
09 Feb 2022 18:51:10,883 [ pool-1-thread-1] TRACE - There are 1 SFTP responses waiting to be processed
Working directory: /
File Path stat: /home/test/test/test.csv
09 Feb 2022 18:51:10,947 [ pool-1-thread-1] DEBUG - Queue Buffer rem=39 pos=0 limit=39 capacity=35004
09 Feb 2022 18:51:10,947 [ pool-1-thread-1] TRACE - Final Buffer rem=39 pos=0 limit=39, capacity=35004
09 Feb 2022 18:51:10,947 [ pool-1-thread-1] DEBUG - Posting message com.sshtools.synergy.ssh.ChannelNG$ChannelData to queue
09 Feb 2022 18:51:10,947 [ pool-1-thread-1] TRACE - Waiting for sent data notification
09 Feb 2022 18:51:10,947 [ SSHD-TRANSFER-1] TRACE - Flag selector as READ/WRITE
09 Feb 2022 18:51:10,947 [ SSHD-TRANSFER-1] TRACE - Selected key
09 Feb 2022 18:51:10,949 [ SSHD-TRANSFER-1] TRACE - Processing transport-client WRITE
09 Feb 2022 18:51:10,950 [ SSHD-TRANSFER-1] TRACE - transport-protocol: Starting new subsystem task
09 Feb 2022 18:51:10,950 [ pool-4-thread-1] TRACE - transport-protocol: Operation task is starting
09 Feb 2022 18:51:10,950 [ pool-4-thread-1] TRACE - Starting transport-client WRITE
09 Feb 2022 18:51:10,950 [ pool-4-thread-1] TRACE - Processing socket WRITE event
09 Feb 2022 18:51:10,950 [ pool-4-thread-1] DEBUG - Processing APPLICATION WRITE event
09 Feb 2022 18:51:10,950 [ pool-4-thread-1] TRACE - Written 132 bytes to socket
09 Feb 2022 18:51:10,950 [ pool-4-thread-1] DEBUG - Sent SSH_MSG_CHANNEL_DATA seq=11 len=39 channel=0 remote=0 localWindow=1023819 remoteWindow=2097091
09 Feb 2022 18:51:10,951 [ pool-1-thread-1] TRACE - Received sent data notification
09 Feb 2022 18:51:10,951 [ pool-1-thread-1] TRACE - connection-protocol: Starting new subsystem task
09 Feb 2022 18:51:10,951 [ pool-1-thread-1] TRACE - Checking window space on channel=0 window=1023819 cached=0 extended=0
09 Feb 2022 18:51:10,951 [ SSHD-TRANSFER-1] TRACE - transport-client has state ops=1 READ
09 Feb 2022 18:51:10,951 [ pool-4-thread-1] TRACE - transport-protocol: No more tasks, will wait for a few more seconds before completing task
09 Feb 2022 18:51:10,951 [ pool-4-thread-1] TRACE - {}: Operation task has ended
09 Feb 2022 18:51:10,951 [ pool-3-thread-1] TRACE - connection-protocol: Operation task is starting
09 Feb 2022 18:51:10,951 [ pool-3-thread-1] TRACE - connection-protocol: No more tasks, will wait for a few more seconds before completing task
09 Feb 2022 18:51:10,951 [ pool-3-thread-1] TRACE - {}: Operation task has ended
09 Feb 2022 18:51:11,033 [ SSHD-TRANSFER-1] TRACE - Selected key
09 Feb 2022 18:51:11,033 [ SSHD-TRANSFER-1] TRACE - Processing transport-client READ
09 Feb 2022 18:51:11,033 [ SSHD-TRANSFER-1] TRACE - transport-protocol: Starting new subsystem task
09 Feb 2022 18:51:11,033 [ pool-3-thread-1] TRACE - transport-protocol: Operation task is starting
09 Feb 2022 18:51:11,033 [ pool-3-thread-1] TRACE - Starting transport-client READ
09 Feb 2022 18:51:11,033 [ pool-3-thread-1] TRACE - Processing socket READ event
09 Feb 2022 18:51:11,033 [ pool-3-thread-1] TRACE - Read 116 bytes from socket
09 Feb 2022 18:51:11,033 [ pool-3-thread-1] TRACE - Processing APPLICATION READ data
09 Feb 2022 18:51:11,033 [ pool-3-thread-1] TRACE -
5e 00 00 00 00 00 00 00 21 00 00 00 1d 65 00 00 00 02 00 00 00 02 00 00 00 0c 4e 6f 20 73 75 63 [ ^.......!....e............No suc ]
68 20 66 69 6c 65 00 00 00 00 [ h file.... ]
09 Feb 2022 18:51:11,034 [ pool-3-thread-1] DEBUG - Processing transport protocol message id 94
09 Feb 2022 18:51:11,034 [ pool-3-thread-1] TRACE - Posting mesage id 94 to active service for processing
09 Feb 2022 18:51:11,034 [ pool-3-thread-1] TRACE - transport-protocol: Starting new subsystem task
09 Feb 2022 18:51:11,034 [ pool-3-thread-1] TRACE - Transport protocol is expecting another packet
09 Feb 2022 18:51:11,034 [ pool-3-thread-1] TRACE - There is 0 bytes left to process on socket
09 Feb 2022 18:51:11,034 [ pool-4-thread-1] TRACE - transport-protocol: Operation task is starting
09 Feb 2022 18:51:11,034 [ SSHD-TRANSFER-1] TRACE - transport-client has state ops=1 READ
09 Feb 2022 18:51:11,034 [ pool-3-thread-1] TRACE - transport-protocol: No more tasks, will wait for a few more seconds before completing task
09 Feb 2022 18:51:11,034 [ pool-3-thread-1] TRACE - {}: Operation task has ended
09 Feb 2022 18:51:11,034 [ pool-4-thread-1] TRACE - Processing active service message id 94
09 Feb 2022 18:51:11,034 [ pool-4-thread-1] TRACE - connection-protocol: Starting new subsystem task
09 Feb 2022 18:51:11,034 [ pool-4-thread-1] TRACE - transport-protocol: No more tasks, will wait for a few more seconds before completing task
09 Feb 2022 18:51:11,034 [ pool-4-thread-1] TRACE - {}: Operation task has ended
09 Feb 2022 18:51:11,034 [ pool-3-thread-1] TRACE - connection-protocol: Operation task is starting
09 Feb 2022 18:51:11,034 [ pool-3-thread-1] DEBUG - Consuming 33 bytes local window space before=1023819 after=1023786 channel=0 remote=0 localWindow=1023819 remoteWindow=2097091
09 Feb 2022 18:51:11,034 [ pool-3-thread-1] DEBUG - Received SSH_MSG_CHANNEL_DATA len=33 channel=0 remote=0 localWindow=1023786 remoteWindow=2097091
09 Feb 2022 18:51:11,034 [ pool-3-thread-1] TRACE - Written 33 bytes from cached data window position=0 remaining=33 limit=33
09 Feb 2022 18:51:11,034 [ pool-3-thread-1] TRACE - connection-protocol: No more tasks, will wait for a few more seconds before completing task
09 Feb 2022 18:51:11,034 [ pool-3-thread-1] TRACE - {}: Operation task has ended
09 Feb 2022 18:51:11,034 [ pool-1-thread-1] TRACE - Read 1 bytes from cached data window position=1 remaining=32 limit=33
09 Feb 2022 18:51:11,034 [ pool-1-thread-1] TRACE - Checking window space on channel=0 window=1023786 cached=32 extended=0
09 Feb 2022 18:51:11,034 [ pool-1-thread-1] TRACE - Read returning 0
09 Feb 2022 18:51:11,034 [ pool-1-thread-1] TRACE - Checking window space on channel=0 window=1023786 cached=32 extended=0
09 Feb 2022 18:51:11,034 [ pool-1-thread-1] TRACE - Read 1 bytes from cached data window position=2 remaining=31 limit=33
09 Feb 2022 18:51:11,034 [ pool-1-thread-1] TRACE - Checking window space on channel=0 window=1023786 cached=31 extended=0
09 Feb 2022 18:51:11,034 [ pool-1-thread-1] TRACE - Read returning 0
09 Feb 2022 18:51:11,034 [ pool-1-thread-1] TRACE - Checking window space on channel=0 window=1023786 cached=31 extended=0
09 Feb 2022 18:51:11,034 [ pool-1-thread-1] TRACE - Read 1 bytes from cached data window position=3 remaining=30 limit=33
09 Feb 2022 18:51:11,034 [ pool-1-thread-1] TRACE - Checking window space on channel=0 window=1023786 cached=30 extended=0
09 Feb 2022 18:51:11,034 [ pool-1-thread-1] TRACE - Read returning 0
09 Feb 2022 18:51:11,034 [ pool-1-thread-1] TRACE - Checking window space on channel=0 window=1023786 cached=30 extended=0
09 Feb 2022 18:51:11,034 [ pool-1-thread-1] TRACE - Read 1 bytes from cached data window position=4 remaining=29 limit=33
09 Feb 2022 18:51:11,034 [ pool-1-thread-1] TRACE - Checking window space on channel=0 window=1023786 cached=29 extended=0
09 Feb 2022 18:51:11,034 [ pool-1-thread-1] TRACE - Read returning 29
09 Feb 2022 18:51:11,034 [ pool-1-thread-1] TRACE - Checking window space on channel=0 window=1023786 cached=29 extended=0
09 Feb 2022 18:51:11,034 [ pool-1-thread-1] TRACE - Read 29 bytes from cached data window position=33 remaining=0 limit=33
09 Feb 2022 18:51:11,034 [ pool-1-thread-1] TRACE - Checking window space on channel=0 window=1023786 cached=0 extended=0
09 Feb 2022 18:51:11,034 [ pool-1-thread-1] TRACE - There are 1 SFTP responses waiting to be processed
Exception: SftpStatusException
Exception message: No such file
09 Feb 2022 18:51:11,035 [ pool-1-thread-1] DEBUG - Checking close state force=false channelType=session channel=0 remote=0 localWindow=1023786 remoteWindow=2097091
09 Feb 2022 18:51:11,035 [ pool-1-thread-1] DEBUG - Adding our close message to queue channel=0 remote=0 localWindow=1023786 remoteWindow=2097091
09 Feb 2022 18:51:11,035 [ main] INFO - Disconnect /10.0.2.15:55864 By Application
09 Feb 2022 18:51:11,035 [ main] DEBUG - Posting message com.sshtools.synergy.ssh.TransportProtocol$DisconnectMessage to queue
End of SFTP Download
09 Feb 2022 18:51:11,035 [ SSHD-TRANSFER-1] TRACE - Flag selector as READ/WRITE
09 Feb 2022 18:51:11,035 [ SSHD-TRANSFER-1] TRACE - Selected key
09 Feb 2022 18:51:11,036 [ SSHD-TRANSFER-1] TRACE - Processing transport-client WRITE
09 Feb 2022 18:51:11,036 [ SSHD-TRANSFER-1] TRACE - transport-protocol: Starting new subsystem task
09 Feb 2022 18:51:11,036 [ pool-3-thread-1] TRACE - transport-protocol: Operation task is starting
09 Feb 2022 18:51:11,036 [ pool-3-thread-1] TRACE - Starting transport-client WRITE
09 Feb 2022 18:51:11,036 [ pool-3-thread-1] TRACE - Processing socket WRITE event
09 Feb 2022 18:51:11,036 [ pool-1-thread-1] DEBUG - Posting message com.sshtools.synergy.ssh.ChannelNG$ChannelClose to queue
09 Feb 2022 18:51:11,036 [ SSHD-TRANSFER-1] TRACE - Flag selector as READ/WRITE
09 Feb 2022 18:51:11,036 [ SSHD-TRANSFER-1] TRACE - Selected key
09 Feb 2022 18:51:11,036 [ SSHD-TRANSFER-1] TRACE - Processing transport-client WRITE
09 Feb 2022 18:51:11,036 [ pool-3-thread-1] DEBUG - Processing APPLICATION WRITE event
09 Feb 2022 18:51:11,036 [ pool-3-thread-1] TRACE - Written 100 bytes to socket
09 Feb 2022 18:51:11,036 [ pool-3-thread-1] DEBUG - Sent SSH_MSG_DISCONNECT reason=11 By Application
09 Feb 2022 18:51:11,036 [ pool-3-thread-1] TRACE - Closing socket
09 Feb 2022 18:51:11,037 [ pool-3-thread-1] TRACE - Closing protocol engine
09 Feb 2022 18:51:11,037 [ pool-3-thread-1] INFO - Connection closed /10.0.2.15:55864
09 Feb 2022 18:51:11,037 [ pool-3-thread-1] DEBUG - Performing internal disconnect 866e83a4-5435-4e20-9e35-168122a4fe78
09 Feb 2022 18:51:11,037 [ pool-3-thread-1] DEBUG - Stopping the active service
09 Feb 2022 18:51:11,037 [ pool-3-thread-1] DEBUG - Cleaning up connection protocol references
09 Feb 2022 18:51:11,038 [ pool-3-thread-1] DEBUG - Checking close state force=true channelType=session channel=0 remote=0 localWindow=1023786 remoteWindow=2097091
09 Feb 2022 18:51:11,038 [ pool-3-thread-1] DEBUG - Requesting to complete the close operation connected=false forceClose=true channel=0 remote=0 localWindow=1023786 remoteWindow=2097091
09 Feb 2022 18:51:11,038 [ pool-3-thread-1] TRACE - connection-protocol: Starting new subsystem task
09 Feb 2022 18:51:11,038 [ pool-3-thread-1] DEBUG - Logging off user
09 Feb 2022 18:51:11,038 [ pool-3-thread-1] DEBUG - Submitting transport cleanup to executor service
09 Feb 2022 18:51:11,038 [ pool-1-thread-1] TRACE - connection-protocol: Operation task is starting
09 Feb 2022 18:51:11,038 [ pool-1-thread-1] DEBUG - Completing the close operation channel=0 remote=0 localWindow=1023786 remoteWindow=2097091
09 Feb 2022 18:51:11,038 [ pool-3-thread-1] TRACE - transport-protocol: Starting new subsystem task
09 Feb 2022 18:51:11,038 [ pool-4-thread-1] TRACE - transport-protocol: Operation task is starting
09 Feb 2022 18:51:11,039 [ pool-4-thread-1] TRACE - transport-protocol: Submitting clean up operation to executor service
09 Feb 2022 18:51:11,039 [ pool-3-thread-1] TRACE - transport-protocol: No more tasks, will wait for a few more seconds before completing task
09 Feb 2022 18:51:11,039 [ pool-2-thread-1] TRACE - transport-protocol: Cleaning up operations
09 Feb 2022 18:51:11,039 [ pool-2-thread-1] TRACE - transport-protocol: Waiting for operations to complete
09 Feb 2022 18:51:11,039 [ pool-1-thread-1] DEBUG - Freeing channel=0
09 Feb 2022 18:51:11,039 [ pool-1-thread-1] DEBUG - Freeing channel channel=0 remote=0 localWindow=1023786 remoteWindow=2097091
09 Feb 2022 18:51:11,039 [ pool-3-thread-1] TRACE - {}: Operation task has ended
09 Feb 2022 18:51:11,039 [ pool-1-thread-1] TRACE - connection-protocol: No more tasks, will wait for a few more seconds before completing task
09 Feb 2022 18:51:11,039 [ pool-1-thread-1] TRACE - {}: Operation task has ended
09 Feb 2022 18:51:11,039 [ pool-4-thread-1] DEBUG - Firing EVENT_DISCONNECTED success=true
09 Feb 2022 18:51:11,039 [ pool-4-thread-1] TRACE - transport-protocol: No more tasks, will wait for a few more seconds before completing task
09 Feb 2022 18:51:11,039 [ pool-4-thread-1] TRACE - {}: Operation task has ended
09 Feb 2022 18:51:11,039 [ pool-2-thread-1] TRACE - transport-protocol: All opera
Is there anything in the log that stands out that could be the issue now that I simplified the remote file path?
Thank you!
So after a nights rest and more digging it seems that this one particular server just doesn't allow stat
. I updated the code to do something like
try {
stat(filePath);
catch(SftpStatusException) {
LOG.debug("stat did not work");
}
// Ignore error try getting file anyway
get(filePath);
And this worked. So I am going to do some more investigating on my end against the server. I wish I knew why stat
won't work but if I have a workaround then I am ok with it for now.
I guess another question would be is there an alternative to stat
? I looked at the old API documentation and there was a ls
command that was deprecated I believe, is there anything similar I can try?
So after digging it has nothing to do with the library but this server and the SFTP account I was trying to use itself. We can close this ticket. Sorry for the noise.
No worries.
Greetings!
I have ran into a new problem and I tried searching the documentation but no avail. I am trying to use
stat
on a file that exists in the remote server however the file name itself has spaces. The file in question looks like this/home/test/test/1.31.22 TEST File.csv
When I use the stat command I get
SftpStatusException: No such file
When I log into the server manually I am able to see the file if I run the following command
ls "/home/test/test/1.31.22 TEST File.csv"
When logging into the remote server via maverick it informs me I am at the root when I use the pwd() command, however I don't think this should be an issue since I am passing in the full path when I do:
stat("/home/test/test/1.31.22 TEST File.csv")
I've tried wrapping both the file name and the whole file path in quotes but I still get the same error. I am running out of ideas as to what I can do to get the information for this file so that I can download it. The exception doesn't tell me much except the file is not found. Is there another function that I may have to use? Do I need to encode the String so that it allows me to use spaces? Any help would be greatly appreciated!
Thank you!