mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 08:23:47 +01:00
operations: fix goroutine leak in case of copy retry
Whenever transfer.Account() is called, a new goroutine acc.averageLoop() is started. This goroutine exits only when the channel acc.exit is closed. acc.exit is closed when acc.Done() is called, which happens during tr.Done(). However, if tr.Reset is called during a copy low level retry, it replaces the tr.acc, without calling acc.Done(), which results in the goroutine mentioned above never exiting. This commit calls acc.Done() during a tr.Reset()
This commit is contained in:
parent
c968c3e41c
commit
f04520a6e3
@ -132,6 +132,7 @@ func (tr *Transfer) Reset(ctx context.Context) {
|
||||
ci := fs.GetConfig(ctx)
|
||||
|
||||
if acc != nil {
|
||||
acc.Done()
|
||||
if err := acc.Close(); err != nil {
|
||||
fs.LogLevelPrintf(ci.StatsLogLevel, nil, "can't close account: %+v\n", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user