[ 
https://issues.apache.org/jira/browse/SSHD-1215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17418615#comment-17418615
 ] 

Thomas Wolf commented on SSHD-1215:
-----------------------------------

# AFAIK this is not a known problem.
# Your front-end server indeed forwards the second chunk with offset 0 again. 
See your logs. Are you sure the problem is not in your implementation of that 
front-end server?
# A JUnit test case showing this problem would be best. But if you can show the 
full Java code of that part of the front-end server that does the forwarding 
(receive blocks from the client, send received blocks to the back-end server) 
that might help.

Regarding (2), see your logs:

{code}
[16/09/21 09:18:27:473 CEST] 00000175 id=00000000 
org.apache.sshd.sftp.client.impl.SftpRemotePathChannel       1 doWrite 
doWrite(/upload/rsa.key)[position=-1] write 1 buffers using copySize=8192
[16/09/21 09:18:27:473 CEST] 00000175 id=00000000 
org.apache.sshd.sftp.client.impl.SftpRemotePathChannel       1 beginBlocking 
beginBlocking(/upload/rsa.key)[doWrite]
[16/09/21 09:18:27:473 CEST] 00000175 id=00000000 
org.apache.sshd.sftp.client.impl.AbstractSftpClient          3 write 
write(SftpChannelSubsystem[id=0, 
recipient=0]-ClientSessionImpl[DMZ/172.18.202.33/allfuser1@/10.6.6.22:6471][sftp])
 handle=/upload/rsa.key: 
6338386366643535646435313463636464303432383537313139316635656131, 
file-offset=0, buf-offset=57, writeSize=32704, remLen=0
[16/09/21 09:18:27:473 CEST] 00000175 id=00000000 
org.apache.sshd.sftp.client.impl.DefaultSftpClient           3 send 
send(SftpChannelSubsystem[id=0, 
recipient=0]-ClientSessionImpl[DMZ/172.18.202.33/allfuser1@/10.6.6.22:6471][sftp])
 cmd=SSH_FXP_WRITE, len=32752, id=141
[16/09/21 09:18:27:473 CEST] 00000175 id=00000000 
org.apache.sshd.common.channel.ChannelAsyncOutputStream      3 
doWriteIfPossible doWriteIfPossible([SftpChannelSubsystem[id=0, 
recipient=0]-ClientSessionImpl[DMZ/172.18.202.33/allfuser1@/10.6.6.22:6471][sftp]]
 cmd=SSH_MSG_CHANNEL_DATA)[resume=false] attempting to write 32761 bytes
[16/09/21 09:18:27:473 CEST] 00000175 id=00000000 
org.apache.sshd.common.channel.Window                        3 consume Consume 
Window[client/remote](SftpChannelSubsystem[id=0, 
recipient=0]-ClientSessionImpl[DMZ/172.18.202.33/allfuser1@/10.6.6.22:6471][sftp])
 by 32761 down to 2030612
[16/09/21 09:18:27:473 CEST] 00000175 id=00000000 
org.apache.sshd.common.session.helpers.AbstractSession       1 encode 
encode(ClientSessionImpl[DMZ/172.18.202.33/allfuser1@/10.6.6.22:6471]) packet 
#49 sending command=94[SSH_MSG_CHANNEL_DATA] len=32770
[16/09/21 09:18:27:473 CEST] 00000175 id=00000000 
org.apache.sshd.common.util.logging.LoggingUtils             3 logMessage 
encode(ClientSessionImpl[DMZ/172.18.202.33/allfuser1@/10.6.6.22:6471]) packet 
#49 [chunk #1](64/32770) 5e 00 00 00 00 00 00 7f f9 00 00 7f f5 06 00 00 00 8d 
00 00 00 20 63 38 38 63 66 64 35 35 64 64 35 31 34 63 63 64 64 30 34 32 38 35 
37 31 31 39 31 66 35 65 61 31 00 00 00 00 00 00 00 00 00 00    
^.....................c88cfd55dd514ccdd0428571191f5ea1..........
{code}

Note file-offset = 0 in the third line. The ten 00 bytes at the end of the last 
line are the offset (8 bytes), plus the two high bytes of the data length (also 
zero, since the full length is 00 00 7f c0).

> WinsCP transfer failure to Apache SSHD Server
> ---------------------------------------------
>
>                 Key: SSHD-1215
>                 URL: https://issues.apache.org/jira/browse/SSHD-1215
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 2.6.0
>            Reporter: Roberto Deandrea
>            Priority: Major
>         Attachments: logs.zip
>
>
> Hi
> I have a failure transferring small files from a WinSCP SFTP client version 
> 5.19.2 to a front-end Apache SSHD Server 2.6.0.
> The front-end Apache SSHD server is configured with a Filesystem built upon 
> SFTPFileSystemProvider to proxy files to an Apache SSHD back-end server.
> WinSCP SFTP transfer files successfully directly to back-end Apache SSHD 
> Server.
> I traced the SFTP file transfer on the front-end server and back-end server 
> and it seems that something get wrong in the remote FileSystem set on the 
> front-end server.
> From traces it seems that the first chunk of file is received correctly by 
> the back-end server, but something is wrong on the second chuck of file 
> transmitted.
> -------------------------------------------------------------------------------------------------------------------------
> First SSH_FXP_WRITE chunk received from front-end server :
> [16/09/21 09:18:26:364 CEST] 00000175 id=00000000 
> org.apache.sshd.sftp.server.AbstractSftpSubsystemHelper 1 process 
> process(ServerSessionImpl[allfuser1@/172.18.202.33:55400])[length=32757, 
> type=SSH_FXP_WRITE, id=19718] processing
> [16/09/21 09:18:26:364 CEST] 00000175 id=00000000 
> org.apache.sshd.sftp.server.SftpSubsystem 3 doWrite 
> doWrite(ServerSessionImpl[allfuser1@/172.18.202.33:55400])[id=19718] 
> *SSH_FXP_WRITE 
> (handle=de6fcf635cb34b0e6d3d56643b7539a3[[/upload/rsa.key|https://issues.apache.org/upload/rsa.key]],
>  offset=0, data=byte[32704])*
> First SSH_FXP_WRITE chunk sent by front-end SFTP client to back.end-server :
> [16/09/21 09:18:26:913 CEST] 00000175 id=00000000 
> org.apache.sshd.sftp.client.impl.DefaultSftpClient 3 send 
> send(SftpChannelSubsystem[id=0, 
> recipient=0]-ClientSessionImpl[DMZ/172.18.202.33/allfuser1@/10.6.6.22:6471][sftp])
>  cmd=SSH_FXP_WRITE, len=32752, id=139
> [16/09/21 09:18:27:010 CEST] 00000175 id=00000000 
> org.apache.sshd.sftp.client.impl.AbstractSftpClient 3 checkResponseStatus 
> checkResponseStatus(SftpChannelSubsystem[id=0, 
> recipient=0]-ClientSessionImpl[DMZ/172.18.202.33/allfuser1@/10.6.6.22:6471][sftp])[id=139]
>  cmd=SSH_FXP_WRITE status=SSH_FX_OK lang= msg=
>  
> First SSH_FXP_WRITE chunk received succesfully from back-end server :
> [16/09/21 09:18:27:007 CEST] 00005c15 id=00000000 
> org.apache.sshd.sftp.server.SftpSubsystem 3 doWrite 
> doWrite(ServerSessionImpl[DMZ/172.18.202.33/allfuser1@/10.6.6.22:34445])[id=139]
>  *SSH_FXP_WRITE 
> (handle=c88cfd55dd514ccdd0428571191f5ea1[[/upload/rsa.key|https://issues.apache.org/upload/rsa.key]],
>  offset=0, data=byte[32704])*
> [16/09/21 09:18:27:545 CEST] 00005c15 id=00000000 
> org.apache.sshd.sftp.server.AbstractSftpSubsystemHelper 1 process 
> process(ServerSessionImpl[DMZ/172.18.202.33/allfuser1@/10.6.6.22:34445])[length=32757,
>  
> -----------------------------------------------------------------------------------------------------
> Second SSH_FXP_WRITE chunk received from front-end server:
> [16/09/21 09:18:27:012 CEST] 00000175 id=00000000 
> org.apache.sshd.sftp.server.AbstractSftpSubsystemHelper 1 process 
> process(ServerSessionImpl[allfuser1@/172.18.202.33:55400])[length=32757, 
> type=SSH_FXP_WRITE, id=19974] processing
> [16/09/21 09:18:27:013 CEST] 00000175 id=00000000 
> org.apache.sshd.sftp.server.SftpSubsystem 3 doWrite 
> doWrite(ServerSessionImpl[allfuser1@/172.18.202.33:55400])[id=19974] 
> *SSH_FXP_WRITE 
> (handle=de6fcf635cb34b0e6d3d56643b7539a3[[/upload/rsa.key|https://issues.apache.org/upload/rsa.key]],
>  offset=32704, data=byte[32704])*
>  
> Second SSH_FXP_WRITE chunk sent by front-end SFTP client to back-end server:
> [16/09/21 09:18:27:473 CEST] 00000175 id=00000000 
> org.apache.sshd.sftp.client.impl.DefaultSftpClient 3 send 
> send(SftpChannelSubsystem[id=0, 
> recipient=0]-ClientSessionImpl[DMZ/172.18.202.33/allfuser1@/10.6.6.22:6471][sftp])
>  cmd=SSH_FXP_WRITE, len=32752, *id=141*
>  
> Second SSH_FXP_WRITE chunk received from back-end server:
> type=SSH_FXP_WRITE, *id=141*] processing
> [16/09/21 09:18:27:545 CEST] 00005c15 id=00000000 
> org.apache.sshd.sftp.server.SftpSubsystem 3 doWrite 
> doWrite(ServerSessionImpl[DMZ/172.18.202.33/allfuser1@/10.6.6.22:34445])[*id=141*]
>  SSH_FXP_WRITE 
> (handle=c88cfd55dd514ccdd0428571191f5ea1[[/upload/rsa.key|https://issues.apache.org/upload/rsa.key]],
>  *offset=0, data=byte[32704*])
> Now the back-end server complains about this data. The back-end server is 
> expecting a chunk of data at offset=32704 and not offset = 0. 
> java.io.IOException: 
> position([/upload/rsa.key|https://issues.apache.org/upload/rsa.key]) *illegal 
> file channel position, expected frsPosition: 32704, found: 0*
> This is a blocking error and causes the connection closing of the parts 
> involved.
> ----------------------------------------------------------------------------------------------------------------------
> Full traces are attached to this jira.
>  
> Questions and considerations.
>  # Is this a known problem and is fixed in the latest release of Apache SSHD?
>  # If this is a new problem can you suggest me how to fix it, or better 
> troubleshoot it
>  # Let me know if you need further info for troubleshooting
>  
> Thanks in advance  for your support
>  
> Kind Regards
> Roberto Deandrea
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org

Reply via email to