-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Nil deref in index handler #9234
Labels
bug
A problem with current functionality, as opposed to missing functionality (enhancement)
Milestone
Comments
imsodin
added
bug
A problem with current functionality, as opposed to missing functionality (enhancement)
needs-triage
New issues needed to be validated
and removed
needs-triage
New issues needed to be validated
labels
Nov 19, 2023
imsodin
added a commit
that referenced
this issue
Nov 19, 2023
Towards the end of the function f.folderCfgs and f.folderRunners are read without the lock.
calmh
added a commit
to calmh/syncthing
that referenced
this issue
Dec 5, 2023
* main: lib/fs: Reduce memory usage in xattrs handling (syncthing#9251) lib/model: Improve LastSeen handling (syncthing#9256) lib/scanner: Record inode change time for directories and symlinks (syncthing#9250) lib/api: Improve ignore loading error handling (fixes syncthing#9253) (syncthing#9254) gui, man, authors: Update docs, translations, and contributors lib/fs: Better equality comparison in mtimefs cmd/stcrashreceiver: Add metrics for diskstore inventory cmd/stcrashreceiver: Minor cleanup, stricter file permissions cmd/stcrashreceiver: Add metrics for incoming reports cmd/ursrv: Add metrics for incoming reports gui, man, authors: Update docs, translations, and contributors gui: Specialize a special-purpose checkbox style (syncthing#9236) gui, man, authors: Update docs, translations, and contributors build: Support new nested namespaces in Weblate downloads lib/model: Acquire fmut lock in ensureIndexHandler (fixes syncthing#9234) (syncthing#9235) gui: Allow to translate "unknown device" (syncthing#9229)
Unfortunately this is still happening in 1.27.0, as reported here: Same panic. I already have a new thing to fix :) |
imsodin
added a commit
to imsodin/syncthing
that referenced
this issue
Dec 7, 2023
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.
New issue is where we track this, this stays closed :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Panic were reported in android a few times and then here an actual/ful panic trace was referenced:
https://forum.syncthing.net/t/syncthing-1-26-crashing-on-android-in-syncthing-fork/21115/2
There's recently changed/added code that sets up index handlers and access fmut protected fields without holding the lock: https://github.com/syncthing/syncthing/blob/main/lib/model/model.go#L1370
I don't see how exactly this can lead to the panic, but presumably some race around pausing a folder.
I am sending a PR shortly.
The text was updated successfully, but these errors were encountered: