alist icon indicating copy to clipboard operation
alist copied to clipboard

[data race] smb驱动中存在潜在的data race

Open fregie opened this issue 2 years ago • 1 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.
  • [X] I'm sure it's due to alist and not something else(such as Dependencies or Operational).
  • [x] I'm sure I'm using the latest version

Alist Version / Alist 版本

latest

Driver used / 使用的存储驱动

smb

Describe the bug / 问题描述

smb驱动中多个方法调用和updateLastConnTime()来更新d.lastConnTime,同时也存在直接读取该变量的情况.
并发的读写该变量可能会产生不可预料的问题,建议改成int64类型并用原子操作进行读写

func (d *SMB) updateLastConnTime() {
  d.lastConnTime = time.Now()
}

我愿意提交一个PR来修复此问题.

Reproduction / 复现链接

N/A

Logs / 日志

No response

fregie avatar Mar 09 '23 09:03 fregie

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

welcome[bot] avatar Mar 09 '23 09:03 welcome[bot]

@Xhofe 已提交PR

fregie avatar Mar 10 '23 03:03 fregie