alist icon indicating copy to clipboard operation
alist copied to clipboard

百度网盘bug

Open djhons opened this issue 1 year ago • 22 comments

Please make sure of the following things

  • [X] I have read the documentation. 我已经阅读了文档

  • [X] I'm sure there are no duplicate issues or discussions. 我确定没有重复的issue或讨论。

  • [X] I'm sure it's due to AList and not something else(such as Network ,Dependencies or Operational). 我确定是AList的问题,而不是其他原因(例如网络依赖操作)。

  • [X] I'm sure this issue is not fixed in the latest version. 我确定这个问题在最新版本中没有被修复。

AList Version / AList 版本

v3.29.0

Driver used / 使用的存储驱动

百度网盘

Describe the bug / 问题描述

上传时间超过30秒就会报错,即取决文件大小和上传速度。我看见有人在几周前提出过这个问题并提交了代码,我尝试自己下载源码编译后同样存在这个问题。是否用百度网盘官方的sdk就能解决这个问题。我的账号是svip3 image

Reproduction / 复现链接

百度url

https://d.pcs.baidu.com/rest/2.0/pcs/superfile2?*************************************************************************************************method=upload&partseq=0&path=%2FNAS%2FShare%2FBurpCrypto-*******-full.jar&type=tmpfile&uploadid=N1-NDMuMTM2LjQwLjE3OToxNzAzNzcxMDc1OjMyMzE3MDY2MDYzNjcyOTcyMg%3D%3D": context deadline exceeded 

上传链接

https://43.136.40.179/api/fs/put

Config / 配置

{
  "force": false,
  "site_url": "",
  "cdn": "",
  "jwt_secret": "EcDrw7NgM4QuHROV",
  "token_expires_in": 48,
  "database": {
    "type": "sqlite3",
    "host": "",
    "port": 0,
    "user": "",
    "password": "",
    "name": "",
    "db_file": "data/data.db",
    "table_prefix": "x_",
    "ssl_mode": ""
  },
  "scheme": {
    "address": "0.0.0.0",
    "http_port": -1,
    "https_port": 443,
    "force_https": true,
    "cert_file": "/etc/nginx/ssl/fullchain1.pem",
    "key_file": "/etc/nginx/ssl/privkey1.pem",
    "unix_file": "",
    "unix_file_perm": ""
  },
  "temp_dir": "data/temp",
  "bleve_dir": "data/bleve",
  "dist_dir": "",
  "log": {
    "enable": true,
    "name": "data/log/log.log",
    "max_size": 50,
    "max_backups": 30,
    "max_age": 28,
    "compress": false
  },
  "delayed_start": 0,
  "max_connections": 0,
  "tls_insecure_skip_verify": true,
  "tasks": {
    "download": {
      "workers": 5,
      "max_retry": 1
    },
    "transfer": {
      "workers": 5,
      "max_retry": 2
    },
    "upload": {
      "workers": 5,
      "max_retry": 0
    },
    "copy": {
      "workers": 5,
      "max_retry": 2
    }
  },
  "cors": {
    "allow_origins": [
      "*"
    ],
    "allow_methods": [
      "*"
    ],
    "allow_headers": [
      "*"
    ]
  }
}r

Logs / 日志

ERRO[2023-12-28 21:50:40] failed put /baidu/Share/: All attempts fail:
#1: Post "https://d.pcs.baidu.com/rest/2.0/pcs/superfile2?access_token=access_token&method=upload&partseq=0&path=%2FNAS%2FShare%2FBurpCrypto-0.1.9.1-full.jar&type=tmpfile&uploadid=what is this": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
#2: Post "https://d.pcs.baidu.com/rest/2.0/pcs/superfile2?access_token=access_token&method=upload&partseq=0&path=%2FNAS%2FShare%2FBurpCrypto-0.1.9.1-full.jar&type=tmpfile&uploadid=what is this": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
#3: Post "https://d.pcs.baidu.com/rest/2.0/pcs/superfile2?access_token=access_token&method=upload&partseq=0&path=%2FNAS%2FShare%2FBurpCrypto-0.1.9.1-full.jar&type=tmpfile&uploadid=what is this": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
github.com/alist-org/alist/v3/internal/op.Put
        /home/kali/alist/internal/op/fs.go:580
github.com/alist-org/alist/v3/internal/fs.putDirectly
        /home/kali/alist/internal/fs/put.go:70
github.com/alist-org/alist/v3/internal/fs.PutDirectly
        /home/kali/alist/internal/fs/fs.go:97
github.com/alist-org/alist/v3/server/handles.FsStream
        /home/kali/alist/server/handles/fsup.go:65
github.com/gin-gonic/gin.(*Context).Next
        /root/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174
github.com/alist-org/alist/v3/server/middlewares.FsUp
        /home/kali/alist/server/middlewares/fsup.go:43
github.com/gin-gonic/gin.(*Context).Next
        /root/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174
github.com/alist-org/alist/v3/server/middlewares.Auth
        /home/kali/alist/server/middlewares/auth.go:73
github.com/gin-gonic/gin.(*Context).Next
        /root/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174
github.com/alist-org/alist/v3/server/middlewares.StoragesLoaded
        /home/kali/alist/server/middlewares/check.go:14
github.com/gin-gonic/gin.(*Context).Next
        /root/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174
github.com/gin-gonic/gin.CustomRecoveryWithWriter.func1
        /root/go/pkg/mod/github.com/gin-gonic/[email protected]/recovery.go:102
github.com/gin-gonic/gin.(*Context).Next
        /root/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174
github.com/gin-gonic/gin.LoggerWithConfig.func1
        /root/go/pkg/mod/github.com/gin-gonic/[email protected]/logger.go:240
github.com/gin-gonic/gin.(*Context).Next
        /root/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest
        /root/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:620
github.com/gin-gonic/gin.(*Engine).ServeHTTP
        /root/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:576
net/http.serverHandler.ServeHTTP
        /usr/local/go/src/net/http/server.go:2938
net/http.initALPNRequest.ServeHTTP
        /usr/local/go/src/net/http/server.go:3546
net/http.(*http2serverConn).runHandler
        /usr/local/go/src/net/http/h2_bundle.go:6193
runtime.goexit
        /usr/local/go/src/runtime/asm_amd64.s:1650

djhons avatar Dec 28 '23 13:12 djhons

Thanks for opening your first issue here! Be sure to follow the issue template!

welcome[bot] avatar Dec 28 '23 13:12 welcome[bot]

See

  1. 56% #4173
  2. 50% #3242
  3. 50% #979
  4. 50% #731
  5. 50% #449

github-actions[bot] avatar Dec 28 '23 13:12 github-actions[bot]

已经解决这个问题。 原因: 分块太大导致30秒内无法上传一个分块。 家庭上传最多4MB/S,默认是三个线程,所以每一个线程上传速度最多1.3MB/S。如果是svip用户,每一个分块将是32MB,如果上传网速稍有影响30秒内将无法上传完成一个分块。 image 解决办法: 方法一:提高上传网速 方法二:降低线程数 方法三:修改代码中的分块大小,但不确定这样修改会不会有其他bug,至少现在没遇到。

func (d *BaiduNetdisk) getSliceSize() int64 {
	return VipSliceSize
}

djhons avatar Jan 10 '24 05:01 djhons

@djhons 还是 reopen 吧,repo 代码没改。这个东西最好能做成变量,可以在设置里自行修改。最最最好是,遇到超时失败后能自动回退到小分块,成功传输若干个分片之后再自动切换到更大的分块。


(更新)

alist.zip 我自己编译的,只编译了 windows 上的 exe 。 按照你的方法改了代码,不过我直接用了3个之中最小的切片大小,return DefaultSliceSize。4MB虽然太小了点,但是在网速很差的时候用得着。


(更新)

如果网速慢的情况下,还要用 rclone 的话,那边的 timeout 也要注意一下,默认是5分钟。大文件,网速慢的话,5分钟不够,rclone 会超时,然后重试。

https://github.com/alist-org/alist/discussions/4859#discussioncomment-6678769

mo-han avatar Jan 26 '24 01:01 mo-han

不知道分块大小有啥影响,至少小一点的分块没有bug。如果是对上传速度有影响,一个分块一秒,三个线程也有12M/S。上传很少有能超过10M/S的带宽。

djhons avatar Feb 01 '24 01:02 djhons

分块只要不是特别特别小,就没啥关系。 咱们网速还没大到,能把MB大小的块,在ms级的时间内上传。

但是还是reopen吧,这算是个bug,而且项目代码没修复。

mo-han avatar Feb 02 '24 08:02 mo-han

Mar 9 15:01:24 iZ7xv11yolbwcl52hzde27Z alist[257939]: 2024/03/09 15:01:24.314658 WARN RESTY Post "https://d.pcs.baidu.com/rest/2.0/pcs/superfile2?access_token=121.b281a055ad3d8f701f2c3257318ec128.YmiZTbU0r3aPQGaFLkZefqzcJZUUW-IgVw4j248.CzzDzQ&method=upload&partseq=0&path=%2FAlist%2FiCloud%2FDocuments%2FNacos%E6%9E%B6%E6%9E%84%26%E5%8E%9F%E7%90%86.pdf&type=tmpfile&uploadid=N1-OC4xMzguMTI4LjE5NjoxNzA5OTY3NDQxOjQzODY0MzU2MzE5MzA4NjY4NQ%3D%3D": context deadline exceeded (Client.Timeout exceeded while awaiting headers), Attempt 4 Mar 9 15:01:24 iZ7xv11yolbwcl52hzde27Z alist[257939]: 2024/03/09 15:01:24.314705 ERROR RESTY Post "https://d.pcs.baidu.com/rest/2.0/pcs/superfile2?access_token=121.b281a055ad3d8f701f2c3257318ec128.YmiZTbU0r3aPQGaFLkZefqzcJZUUW-IgVw4j248.CzzDzQ&method=upload&partseq=0&path=%2FAlist%2FiCloud%2FDocuments%2FNacos%E6%9E%B6%E6%9E%84%26%E5%8E%9F%E7%90%86.pdf&type=tmpfile&uploadid=N1-OC4xMzguMTI4LjE5NjoxNzA5OTY3NDQxOjQzODY0MzU2MzE5MzA4NjY4NQ%3D%3D": context deadline exceeded (Client.Timeout exceeded while awaiting headers) Mar 9 15:01:33 iZ7xv11yolbwcl52hzde27Z alist[257939]: 2024/03/09 15:01:33.044804 WARN RESTY Post "https://d.pcs.baidu.com/rest/2.0/pcs/superfile2?access_token=121.b281a055ad3d8f701f2c3257318ec128.YmiZTbU0r3aPQGaFLkZefqzcJZUUW-IgVw4j248.CzzDzQ&method=upload&partseq=0&path=%2FAlist%2FiCloud%2FDocuments%2FNacos%E6%9E%B6%E6%9E%84%26%E5%8E%9F%E7%90%86.pdf&type=tmpfile&uploadid=N1-OC4xMzguMTI4LjE5NjoxNzA5OTY3NjYyOjQzODcwMjg1NjI4OTQxNjAzNA%3D%3D": context deadline exceeded (Client.Timeout exceeded while awaiting headers), Attempt 1 Mar 9 15:01:56 iZ7xv11yolbwcl52hzde27Z alist[257939]: 2024/03/09 15:01:56.351933 WARN RESTY Post "https://d.pcs.baidu.com/rest/2.0/pcs/superfile2?access_token=121.b281a055ad3d8f701f2c3257318ec128.YmiZTbU0r3aPQGaFLkZefqzcJZUUW-IgVw4j248.CzzDzQ&method=upload&partseq=0&path=%2FAlist%2FiCloud%2FDocuments%2FNacos%E6%9E%B6%E6%9E%84%26%E5%8E%9F%E7%90%86.pdf&type=tmpfile&uploadid=N1-OC4xMzguMTI4LjE5NjoxNzA5OTY3NDQxOjQzODY0MzU2MzE5MzA4NjY4NQ%3D%3D": context deadline exceeded (Client.Timeout exceeded while awaiting headers), Attempt 1 Mar 9 15:02:03 iZ7xv11yolbwcl52hzde27Z alist[257939]: 2024/03/09 15:02:03.174016 WARN RESTY Post "https://d.pcs.baidu.com/rest/2.0/pcs/superfile2?access_token=121.b281a055ad3d8f701f2c3257318ec128.YmiZTbU0r3aPQGaFLkZefqzcJZUUW-IgVw4j248.CzzDzQ&method=upload&partseq=0&path=%2FAlist%2FiCloud%2FDocuments%2FNacos%E6%9E%B6%E6%9E%84%26%E5%8E%9F%E7%90%86.pdf&type=tmpfile&uploadid=N1-OC4xMzguMTI4LjE5NjoxNzA5OTY3NjYyOjQzODcwMjg1NjI4OTQxNjAzNA%3D%3D": context deadline exceeded (Client.Timeout exceeded while awaiting headers), Attempt 2

遇到同样问题

wangeDear avatar Mar 09 '24 07:03 wangeDear

Mar 9 15:01:24 iZ7xv11yolbwcl52hzde27Z alist[257939]: 2024/03/09 15:01:24.314658 WARN RESTY Post "https://d.pcs.baidu.com/rest/2.0/pcs/superfile2?access_token=121.b281a055ad3d8f701f2c3257318ec128.YmiZTbU0r3aPQGaFLkZefqzcJZUUW-IgVw4j248.CzzDzQ&method=upload&partseq=0&path=%2FAlist%2FiCloud%2FDocuments%2FNacos%E6%9E%B6%E6%9E%84%26%E5%8E%9F%E7%90%86.pdf&type=tmpfile&uploadid=N1-OC4xMzguMTI4LjE5NjoxNzA5OTY3NDQxOjQzODY0MzU2MzE5MzA4NjY4NQ%3D%3D": context deadline exceeded (Client.Timeout exceeded while awaiting headers), Attempt 4 Mar 9 15:01:24 iZ7xv11yolbwcl52hzde27Z alist[257939]: 2024/03/09 15:01:24.314705 ERROR RESTY Post "https://d.pcs.baidu.com/rest/2.0/pcs/superfile2?access_token=121.b281a055ad3d8f701f2c3257318ec128.YmiZTbU0r3aPQGaFLkZefqzcJZUUW-IgVw4j248.CzzDzQ&method=upload&partseq=0&path=%2FAlist%2FiCloud%2FDocuments%2FNacos%E6%9E%B6%E6%9E%84%26%E5%8E%9F%E7%90%86.pdf&type=tmpfile&uploadid=N1-OC4xMzguMTI4LjE5NjoxNzA5OTY3NDQxOjQzODY0MzU2MzE5MzA4NjY4NQ%3D%3D": context deadline exceeded (Client.Timeout exceeded while awaiting headers) Mar 9 15:01:33 iZ7xv11yolbwcl52hzde27Z alist[257939]: 2024/03/09 15:01:33.044804 WARN RESTY Post "https://d.pcs.baidu.com/rest/2.0/pcs/superfile2?access_token=121.b281a055ad3d8f701f2c3257318ec128.YmiZTbU0r3aPQGaFLkZefqzcJZUUW-IgVw4j248.CzzDzQ&method=upload&partseq=0&path=%2FAlist%2FiCloud%2FDocuments%2FNacos%E6%9E%B6%E6%9E%84%26%E5%8E%9F%E7%90%86.pdf&type=tmpfile&uploadid=N1-OC4xMzguMTI4LjE5NjoxNzA5OTY3NjYyOjQzODcwMjg1NjI4OTQxNjAzNA%3D%3D": context deadline exceeded (Client.Timeout exceeded while awaiting headers), Attempt 1 Mar 9 15:01:56 iZ7xv11yolbwcl52hzde27Z alist[257939]: 2024/03/09 15:01:56.351933 WARN RESTY Post "https://d.pcs.baidu.com/rest/2.0/pcs/superfile2?access_token=121.b281a055ad3d8f701f2c3257318ec128.YmiZTbU0r3aPQGaFLkZefqzcJZUUW-IgVw4j248.CzzDzQ&method=upload&partseq=0&path=%2FAlist%2FiCloud%2FDocuments%2FNacos%E6%9E%B6%E6%9E%84%26%E5%8E%9F%E7%90%86.pdf&type=tmpfile&uploadid=N1-OC4xMzguMTI4LjE5NjoxNzA5OTY3NDQxOjQzODY0MzU2MzE5MzA4NjY4NQ%3D%3D": context deadline exceeded (Client.Timeout exceeded while awaiting headers), Attempt 1 Mar 9 15:02:03 iZ7xv11yolbwcl52hzde27Z alist[257939]: 2024/03/09 15:02:03.174016 WARN RESTY Post "https://d.pcs.baidu.com/rest/2.0/pcs/superfile2?access_token=121.b281a055ad3d8f701f2c3257318ec128.YmiZTbU0r3aPQGaFLkZefqzcJZUUW-IgVw4j248.CzzDzQ&method=upload&partseq=0&path=%2FAlist%2FiCloud%2FDocuments%2FNacos%E6%9E%B6%E6%9E%84%26%E5%8E%9F%E7%90%86.pdf&type=tmpfile&uploadid=N1-OC4xMzguMTI4LjE5NjoxNzA5OTY3NjYyOjQzODcwMjg1NjI4OTQxNjAzNA%3D%3D": context deadline exceeded (Client.Timeout exceeded while awaiting headers), Attempt 2

遇到同样问题

改改代码就行了

djhons avatar Mar 14 '24 02:03 djhons

改改代码就行了

移动端、嵌入式 这些平台 还是需要 预编译 的可执行文件的,不然用起来太不方便了。 只有仓库代码修改了,才能一劳永逸解决这个问题。

mo-han avatar Mar 29 '24 03:03 mo-han

改改代码就行了

移动端、嵌入式 这些平台 还是需要 预编译 的可执行文件的,不然用起来太不方便了。 只有仓库代码修改了,才能一劳永逸解决这个问题。

交叉编译啊

djhons avatar Apr 01 '24 09:04 djhons

你要是这么说的话,那这话可就不能这么说了。PR和release都可以关掉了,全从issue里复制代码改动自己编译得了。

mo-han avatar Apr 01 '24 11:04 mo-han

你要是这么说的话,那这话可就不能这么说了。PR和release都可以关掉了,全从issue里复制代码改动自己编译得了。

是的,在作者没修改代码的情况下只能自己修改代码交叉编译。不过建议能自己编译还是自己编译好点,可以参考最近出现的xz投毒。

djhons avatar Apr 02 '24 09:04 djhons

所以把本issue reopen呀,这不是仓库里的代码还没改嘛

mo-han avatar Apr 03 '24 03:04 mo-han

所以把本issue reopen呀,这不是仓库里的代码还没改嘛

很多人提过这个issue,也提过解决办法

djhons avatar Apr 03 '24 15:04 djhons

还改吗?不编译能不能行,有没有办法通过配置解决呢?

bibichuan avatar Apr 21 '24 02:04 bibichuan

还改吗?不编译能不能行,有没有办法通过配置解决呢?

不行,必须要改源码再编译

djhons avatar Apr 23 '24 05:04 djhons

文档里说分片数量不得超过1024个 所以改成4m最多只能传4G的文件,分片数量超出了就报31299,如果要传20g的文件,得改到20M 截图_20240428103303

pongfcnkl avatar Apr 28 '24 02:04 pongfcnkl

文档里说分片数量不得超过1024个 所以改成4m最多只能传4G的文件,分片数量超出了就报31299,如果要传20g的文件,得改到20M 截图_20240428103303

应该不受这个的限制

cancundeyingzi avatar Apr 28 '24 02:04 cancundeyingzi

@cancundeyingzi 反正我测试的时候,就是这样的。最好还是让百度把超时时间延长,这样就不用改分片大小了 百度反馈:https://help.baidu.com/question?prod_id=257&class=792&id=1002099

pongfcnkl avatar Apr 28 '24 03:04 pongfcnkl

@cancundeyingzi 反正我测试的时候,就是这样的。最好还是让百度把超时时间延长,这样就不用改分片大小了 百度反馈:https://help.baidu.com/question?prod_id=257&class=792&id=1002099

用alist测的?alist用的不是这个官方api吧

cancundeyingzi avatar Apr 28 '24 03:04 cancundeyingzi

用alist测的?alist用的不是这个官方api吧

@cancundeyingzi alist的百度网盘接口有两个,官方的接口还是稳定,默认用的是官方的

最好还是让百度把超时时间延长

@pongfcnkl 看来只能按你说的来了。但是百度这个限制好蠢啊,要限制文件总长度就直接判断总长度不就行了,它非得这样绕个弯、间接地来。


不过最近我把移动上网的速度问题解决了(锁频段,忽略附近的信号强但是网速慢的基站,强制选择那些网速快的高频基站、哪怕离得远信号比较弱网速也比较快)。现在网速能保底有个20~30Mbps,单个上传任务的话哪怕32MB也能来得及上传完成,宽带焦虑缓解了,我也不太需要继续关注这个issue了。

mo-han avatar Apr 30 '24 02:04 mo-han


用alist测的?alist用的不是这个官方api吧

@cancundeyingzi alist的百度网盘接口有两个,官方的接口还是稳定,默认用的是官方的

最好还是让百度把超时时间延长

@pongfcnkl 看来只能按你说的来了。但是百度这个限制好蠢啊,要限制文件总长度就直接判断总长度不就行了,它非得这样绕个弯、间接地来。

不过最近我把移动上网的速度问题解决了(锁频段,忽略附近的信号强但是网速慢的基站,强制选择那些网速快的高频基站、哪怕离得远信号比较弱网速也比较快)。现在网速能保底有个20~30Mbps,单个上传任务的话哪怕32MB也能来得及上传完成,宽带焦虑缓解了,我也不太需要继续关注这个issue了。

这个不是宽带焦虑,而是bug吧。就算分块改的非常小也不太影响上传速度。

djhons avatar Apr 30 '24 09:04 djhons

这个不是宽带焦虑,而是bug吧。就算分块改的非常小也不太影响上传速度。

不影响上传速度,但是速度影响上传捏。之前我上班那地方,电信卡不锁频连5Mbps都没有,大分块永远上传不成功。

mo-han avatar Apr 30 '24 23:04 mo-han

感觉遇到这个问题的人很多啊,我编译一版出来吧。

djhons avatar May 01 '24 15:05 djhons

链接:https://pan.baidu.com/s/1aXUq1bwTJxAxQduk-LOFUA 提取码:tnht

没有用upx压缩,体积比较大,可自行用upx压缩,压缩后减小到原体积的40%。

djhons avatar May 01 '24 16:05 djhons