EMCECS / nfs-client-java

Native Java NFS client
Apache License 2.0
70 stars 33 forks source link

Client fix #37

Open Hujiabei1997 opened 2 years ago

Hujiabei1997 commented 2 years ago

When using nfs-client to transfer a file greater than 1024 1024, the following error occurs: Tcp IO error on the connection,the reason for this may be that the pipeline reader is closed, BROKEN PIPE error is generated, and Tcp IO error exception is thrown. Because the server source code is not clear, my guess about this problem is as follows: In channel.write (), the CompositeChannelBuffer is sent as a message. The size of the message is limited to 1024 1024 on the server, while in NfsFileOutputStream, _ buffer is the byte array that actually stores the data (size 1024 1024), which must be filled before the data is sent. But,message = metadata + data. So one possibility is that the server limits the size of an overall message, while message contains metadata, so the actual data carried can only be less than 1024 1024. So I think one way to solve bug is to adjust the default size of _ buffer: _ buffer = new byte [(int) Math.min ( nfsFile.fsinfo () .getFsInfo () .wtpref, Integer.MAXVALUE)-bufferSize]. Set aside some space for metadata storage to ensure that the whole message is not greater than 1024 * 1024