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

fix(storage): delete storage fails if a panic occurred during initialization #7501

Merged
merged 2 commits into from
Nov 16, 2024

Conversation

Jason-Fly
Copy link
Contributor

@Jason-Fly Jason-Fly commented Nov 14, 2024

修复问题

#7487 中的第2个问题:如果在alist启动时,某个storage的初始化过程中发生panic,之后删除这个storage时会报错:failed get storage driver: no mount path for an storage is: XXXX.

问题原因

  1. 在删除storage时,会去storagesMap中查询,如果查不到则会报错;
  2. initStorage流程中,如果storageDriver.Init()发生了panic,在recover()中没有向storagesMap写入这个storage,所以后续的删除操作会报错。

修复方案

  1. 发生了panic时,在recover()中向storagesMap写入这个storage
  2. 对所有类型driverDrop方法完善nil检查。

自测

2024-11-14.16.03.00-1.mp4
Snipaste_2024-11-14_16-05-07

@xhofe xhofe merged commit 1c01dc6 into AlistGo:main Nov 16, 2024
2 of 3 checks passed
xrgzs pushed a commit to xrgzs/alist that referenced this pull request Nov 16, 2024
…ization (AlistGo#7501)

* fix(storage): store storages map when init storage panic

* fix(drivers): add nil check to drop method
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

Successfully merging this pull request may close these issues.

2 participants