Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

将文件上传到百度云出错,out of range #244

Closed
Ted-bug opened this issue Dec 24, 2022 · 1 comment
Closed

将文件上传到百度云出错,out of range #244

Ted-bug opened this issue Dec 24, 2022 · 1 comment

Comments

@Ted-bug
Copy link

Ted-bug commented Dec 24, 2022

panic: runtime error: slice bounds out of range [1:0]

goroutine 9 [running]:
github.com/qjfoidnh/BaiduPCS-Go/internal/pcsfunctions/pcsupload.(*UploadingDatabase).deleteIndex(...)
/home/liu/Projects/BaiduPCS-Go/internal/pcsfunctions/pcsupload/upload_database.go:116
github.com/qjfoidnh/BaiduPCS-Go/internal/pcsfunctions/pcsupload.(*UploadingDatabase).clearModTimeChange(0xa2a4fd8)
/home/liu/Projects/BaiduPCS-Go/internal/pcsfunctions/pcsupload/upload_database.go:183 +0x4cb
github.com/qjfoidnh/BaiduPCS-Go/internal/pcsfunctions/pcsupload.(*UploadingDatabase).Search(0xa2a4fd8, 0xa0c8f00, 0xa2d8480)
/home/liu/Projects/BaiduPCS-Go/internal/pcsfunctions/pcsupload/upload_database.go:145 +0x39
github.com/qjfoidnh/BaiduPCS-Go/internal/pcsfunctions/pcsupload.(*UploadTaskUnit).prepareFile(0xa0c8f50)
/home/liu/Projects/BaiduPCS-Go/internal/pcsfunctions/pcsupload/upload_task_unit.go:77 +0xca
github.com/qjfoidnh/BaiduPCS-Go/internal/pcsfunctions/pcsupload.(*UploadTaskUnit).Run(0xa0c8f50, 0x0)
/home/liu/Projects/BaiduPCS-Go/internal/pcsfunctions/pcsupload/upload_task_unit.go:356 +0x1dc
github.com/qjfoidnh/BaiduPCS-Go/pcsutil/taskframework.(*TaskExecutor).Execute.func1(0xa2b5080, 0xa2c8f18, 0xa2c4d10)
/home/liu/Projects/BaiduPCS-Go/pcsutil/taskframework/executor.go:94 +0x54
created by github.com/qjfoidnh/BaiduPCS-Go/pcsutil/taskframework.(*TaskExecutor).Execute
/home/liu/Projects/BaiduPCS-Go/pcsutil/taskframework/executor.go:91 +0x68
panic: runtime error: slice bounds out of range [1:0]

goroutine 6 [running]:
github.com/qjfoidnh/BaiduPCS-Go/internal/pcsfunctions/pcsupload.(*UploadingDatabase).deleteIndex(...)
/home/liu/Projects/BaiduPCS-Go/internal/pcsfunctions/pcsupload/upload_database.go:116
github.com/qjfoidnh/BaiduPCS-Go/internal/pcsfunctions/pcsupload.(*UploadingDatabase).clearModTimeChange(0xa2a4fd8)
/home/liu/Projects/BaiduPCS-Go/internal/pcsfunctions/pcsupload/upload_database.go:183 +0x4cb
github.com/qjfoidnh/BaiduPCS-Go/internal/pcsfunctions/pcsupload.(*UploadingDatabase).Search(0xa2a4fd8, 0xa0c8d20, 0xa2d8000)
/home/liu/Projects/BaiduPCS-Go/internal/pcsfunctions/pcsupload/upload_database.go:145 +0x39
github.com/qjfoidnh/BaiduPCS-Go/internal/pcsfunctions/pcsupload.(*UploadTaskUnit).prepareFile(0xa0c8d70)
/home/liu/Projects/BaiduPCS-Go/internal/pcsfunctions/pcsupload/upload_task_unit.go:77 +0xca
github.com/qjfoidnh/BaiduPCS-Go/internal/pcsfunctions/pcsupload.(*UploadTaskUnit).Run(0xa0c8d70, 0x0)
/home/liu/Projects/BaiduPCS-Go/internal/pcsfunctions/pcsupload/upload_task_unit.go:356 +0x1dc
github.com/qjfoidnh/BaiduPCS-Go/pcsutil/taskframework.(*TaskExecutor).Execute.func1(0xa2b5080, 0xa2c8f18, 0xa2c4cb0)
/home/liu/Projects/BaiduPCS-Go/pcsutil/taskframework/executor.go:94 +0x54
created by github.com/qjfoidnh/BaiduPCS-Go/pcsutil/taskframework.(*TaskExecutor).Execute
/home/liu/Projects/BaiduPCS-Go/pcsutil/taskframework/executor.go:91 +0x68
panic: runtime error: slice bounds out of range [1:0]

goroutine 8 [running]:
github.com/qjfoidnh/BaiduPCS-Go/internal/pcsfunctions/pcsupload.(*UploadingDatabase).deleteIndex(...)
/home/liu/Projects/BaiduPCS-Go/internal/pcsfunctions/pcsupload/upload_database.go:116
github.com/qjfoidnh/BaiduPCS-Go/internal/pcsfunctions/pcsupload.(*UploadingDatabase).clearModTimeChange(0xa2a4fd8)
/home/liu/Projects/BaiduPCS-Go/internal/pcsfunctions/pcsupload/upload_database.go:183 +0x4cb
github.com/qjfoidnh/BaiduPCS-Go/internal/pcsfunctions/pcsupload.(*UploadingDatabase).Search(0xa2a4fd8, 0xa0c8e60, 0xa2d8300)
/home/liu/Projects/BaiduPCS-Go/internal/pcsfunctions/pcsupload/upload_database.go:145 +0x39
github.com/qjfoidnh/BaiduPCS-Go/internal/pcsfunctions/pcsupload.(*UploadTaskUnit).prepareFile(0xa0c8eb0)
/home/liu/Projects/BaiduPCS-Go/internal/pcsfunctions/pcsupload/upload_task_unit.go:77 +0xca
github.com/qjfoidnh/BaiduPCS-Go/internal/pcsfunctions/pcsupload.(*UploadTaskUnit).Run(0xa0c8eb0, 0x0)
/home/liu/Projects/BaiduPCS-Go/internal/pcsfunctions/pcsupload/upload_task_unit.go:356 +0x1dc
github.com/qjfoidnh/BaiduPCS-Go/pcsutil/taskframework.(*TaskExecutor).Execute.func1(0xa2b5080, 0xa2c8f18, 0xa2c4cf0)
/home/liu/Projects/BaiduPCS-Go/pcsutil/taskframework/executor.go:94 +0x54
created by github.com/qjfoidnh/BaiduPCS-Go/pcsutil/taskframework.(*TaskExecutor).Execute
/home/liu/Projects/BaiduPCS-Go/pcsutil/taskframework/executor.go:91 +0x68

@Ted-bug Ted-bug closed this as completed Jan 6, 2023
@Ted-bug Ted-bug changed the title 将文件上传到百度云,panic了,单次上传大小有限制? 将文件上传到百度云出错,out of range Aug 31, 2023
@Ted-bug
Copy link
Author

Ted-bug commented Aug 31, 2023

OD26WMIB05_AXSLMCE{O7
图中我加了点自定义的输出信息,可以发现:文件夹上传时,读取了两次pcs_uploading.json中获取到的信息(代码中并发上传文件,共用database)。
当获取到的上传中文件路径不存在时,会执行切片删除元素操作,此时便会出错。
解决方式:手动删除pcs_uploading.json文件,或者更换使用为线程安全的sync.Map

qjfoidnh added a commit that referenced this issue Sep 4, 2023
enefry pushed a commit to enefry/BaiduPCS-Go that referenced this issue May 10, 2024
* main-3.9.5: (27 commits)
  Update prepare.go
  Update cloud_dl.go
  修复转存失败问题
  v3.9.5
  del bdstoken
  Update util.go
  随机修改文件名
  rtype=3
  恢复秒传功能
  fix qjfoidnh#244, qjfoidnh#295
  v3.9.4
  Update README.md
  v3.9.3
  v3.9.2
  fix rapidupload
  fix rapidupload
  v3.9.1
  Create xpanerrorinfo.go
  update rapidupload
  fix rapidupload
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant