happyfish100 / fastdfs

FastDFS is an open source high performance distributed file system (DFS). It's major functions include: file storing, file syncing and file accessing, and design for high capacity and load balance. Wechat/Weixin public account (Chinese Language): fastdfs
GNU General Public License v3.0
8.91k stars 1.97k forks source link

上传文件报错:java.io.IOException: recv body length: 70 is not correct, expect length: 40 #679

Open Yuuu8 opened 7 months ago

Yuuu8 commented 7 months ago

java.io.IOException: recv body length: 70 is not correct, expect length: 40 at csource.fastdfs.ProtoCommon.recvHeader(ProtoCommon.java:186) at csource.fastdfs.ProtoCommon.recvPackage(ProtoCommon.java:201) at csource.fastdfs.TrackerClient.getStoreStorage(TrackerClient.java:130) at csource.fastdfs.StorageClient.newWritableStorageConnection(StorageClient.java:1628) at csource.fastdfs.StorageClient.do_upload_file(StorageClient.java:640) at csource.fastdfs.StorageClient.upload_file(StorageClient.java:163) at csource.fastdfs.StorageClient.upload_file(StorageClient.java:181) at rent.basecore.fastdfs.FileManager.upload(FileManager.java:71)

请问大佬这个是什么问题

Yuuu8 commented 7 months ago

我之前用的版本是fastdfs5.11这套代码没问题,现在升级到6.11 就会出现这样的报错

senmaowang commented 7 months ago

这个是 fastdfs-clint-java 1.31版本的问题,回退回1.30或者更早版本就好了

happyfish100 commented 7 months ago

server 端使用 V6.11,fastdfs-clint-java需要使用最新的 V1.31

Yuuu8 commented 7 months ago

服务器端使用V6.11,fastdfs-clint-java需要使用最新的V1.31

按照此修复了代码,已修复,谢谢

condywl commented 6 months ago

server 端使用 V6.11,fastdfs-clint-java需要使用最新的 V1.31

大佬,python的客户端 fdfs-client-py3==1.0.0 也报这个错误,求教如何解决。

happyfish100 commented 6 months ago

为了支持IPv6,返回的IP地址长度由16增大到 46,C client API 和 Java client SDK均已更新。 需要把FDFS的python SDK升级一下。

condywl commented 6 months ago

为了支持IPv6,返回的IP地址长度由16增大到 46,C client API 和 Java client SDK均已更新。 需要把FDFS的python SDK升级一下。

还请大佬解答一下新sdk的包名。

waketzheng commented 2 months ago

@condywl Python可用这个fastdfs-client-python

Usage::

from fastdfs_client import FastdfsClient  # pip install fastdfs-client

tracker_conf_path = "./tracker.conf"  # tracker配置文件的地址
client = FastdfsClient(tracker_conf_path)

ret = client.upload_by_filename('kitty.jpg')  # 本地文件路径
print(ret)
happyfish100 commented 2 months ago

FDFS 通信协议中涉及 IP 地址的地方,长度由之前的 16 改为 46 了。 请在 client SDK 中做相应修改即可。

waketzheng commented 2 months ago

FDFS 通信协议中涉及 IP 地址的地方,长度由之前的 16 改为 46 了。 请在 client SDK 中做相应修改即可。

感谢大神的耐心解答~

修改fdfs_client/fdfs_protol.py中的IP_ADDRESS_SIZE后报错就修复了,其他人如果也遇到这个报错,可以用下面的命令来升级Python版fdfs_client SDK,从而无需修改代码

pip install 'git+https://github.com/waketzheng/fastdfs-client-python@1.0.1#egg=fdfs-client'