Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib/model: Remove runner during folder cleanup (fixes syncthing#9269)
Before introducing the service map and using it for folder runners, the entries in folderCfgs and folderRunners for the same key/folder were removed under a single lock. Stopping the folder happens separately before that with just the read lock. Now with the service map stopping the folder and removing it from the map is a single operation. And that still happens with just a read-lock. However even with a full lock it’s still problematic: After the folder stopped, the runner isn’t present anymore while the folder-config still is and sais the folder isn't paused. The index handler in turn looks at the folder config that is not paused, thus assumes the runner has to be present -> nil deref on the runner. A better solution would like be to push most of these fmut maps into the folder - they anyway are needed in there. Then there's just a single map/source of info that's necessarily consistent.
- Loading branch information