mirror of
https://github.com/rclone/rclone.git
synced 2026-09-25 07:16:00 -04:00
The march janitor goroutine, which discards queued jobs when the context is cancelled, only ever returned on context cancellation. A march that finished normally never cancels its context, so on an async rc job (whose context descends from context.Background and is only cancelled by job/stop) the janitor parked forever, leaking one goroutine per run and pinning that run's directory listings in memory. A long-running rcd driving async sync or bisync jobs accumulated these until it ran out of memory. Signal the janitor to exit once the march completes so it returns on both normal completion and cancellation.