AlistGo / alist

🗂️A file list/WebDAV program that supports multiple storages, powered by Gin and Solidjs. / 一个支持多存储的文件列表/WebDAV程序,使用 Gin 和 Solidjs。
https://alist.nn.ci
GNU Affero General Public License v3.0
43.75k stars 5.67k forks source link

更新v3.29.1后使用aria2离线下载上传至阿里云盘报错panic: sync: negative WaitGroup counter #5595

Closed TwooSix closed 11 months ago

TwooSix commented 11 months ago

Please make sure of the following things

AList Version / AList 版本

v3.29.1

Driver used / 使用的存储驱动

阿里云盘Open

Describe the bug / 问题描述

更新v3.29.1后使用aria2离线下载成功,但在上传至阿里云盘时报错panic: sync: negative WaitGroup counter

Reproduction / 复现链接

magnet:?xt=urn:btih:a00b446d134f3adc22ffdb7bf2322b7ecc7ed376&tr=http%3a%2f%2ft.nyaatracker.com%2fannounce&tr=http%3a%2f%2ftracker.kamigami.org%3a2710%2fannounce&tr=http%3a%2f%2fshare.camoe.cn%3a8080%2fannounce&tr=http%3a%2f%2fopentracker.acgnx.se%2fannounce&tr=http%3a%2f%2fanidex.moe%3a6969%2fannounce&tr=http%3a%2f%2ft.acg.rip%3a6699%2fannounce&tr=https%3a%2f%2ftr.bangumi.moe%3a9696%2fannounce&tr=udp%3a%2f%2ftr.bangumi.moe%3a6969%2fannounce&tr=http%3a%2f%2fopen.acgtracker.com%3a1096%2fannounce&tr=udp%3a%2f%2ftracker.opentrackr.org%3a1337%2fannounce

Config / 配置

{
  "force": false,
  "site_url": "",
  "cdn": "",
  "jwt_secret": "",
  "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": 5244,
    "https_port": -1,
    "force_https": false,
    "cert_file": "",
    "key_file": "",
    "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": [
      "*"
    ]
  }
}

Logs / 日志

2023/11/28 01:56:47 error [sync: negative WaitGroup counter] while run task [EohVIxTkrT5wFafU6xX90],stack trace:
goroutine 629 [running]:
github.com/xhofe/tache.getCurrentGoroutineStack(...)
    /home/runner/go/pkg/mod/github.com/xhofe/tache@v0.1.0/utils.go:22
github.com/xhofe/tache.Worker[...].Execute.func2()
    /home/runner/go/pkg/mod/github.com/xhofe/tache@v0.1.0/worker.go:41 +0xa5
panic({0x1885c60?, 0x3421c40?})
    /opt/hostedtoolcache/go/1.21.4/x64/src/runtime/panic.go:914 +0x21f
sync.(*WaitGroup).Add(0x0?, 0x0?)
    /opt/hostedtoolcache/go/1.21.4/x64/src/sync/waitgroup.go:62 +0xd8
sync.(*WaitGroup).Done(0xc0009d3c50?)
    /opt/hostedtoolcache/go/1.21.4/x64/src/sync/waitgroup.go:87 +0x1a
github.com/alist-org/alist/v3/internal/offline_download/tool.(*TransferTask).Run(0xc0004d03c0)
    /home/runner/work/alist/alist/internal/offline_download/tool/transfer.go:55 +0x5e8
github.com/xhofe/tache.Worker[...].Execute(0x343e8a0?, 0xc0004d03c0)
    /home/runner/go/pkg/mod/github.com/xhofe/tache@v0.1.0/worker.go:46 +0x12a
github.com/xhofe/tache.(*Manager[...]).next.func1()
    /home/runner/go/pkg/mod/github.com/xhofe/tache@v0.1.0/manager.go:133 +0x247
created by github.com/xhofe/tache.(*Manager[...]).next in goroutine 593
    /home/runner/go/pkg/mod/github.com/xhofe/tache@v0.1.0/manager.go:114 +0x230
lifei6671 commented 11 months ago

https://github.com/alist-org/alist/blob/f4dcf4599c8c5cf6ab1044b42e155ac2c81d1e6f/internal/offline_download/tool/transfer.go#L27C7-L27C7

func (t *TransferTask) Run() error {
    defer t.wg.Done()
    // check dstDir again

这里有问题。这个t.wg没有Add的地方,就直接done了,肯定会panic。

The-GO commented 11 months ago

我也有这个问题,上传到其他网盘,也是报错这个! IMG_20231130_045534