Hello. I have a synced folder that has ~11K files in the server side, ~10K files in the local side (phone). This is with the latest GrapheneOS Android 11 (no
avc denials in logcat) and the latest F-Droid Syncthing for Android, on a brand new Pixel 4.
Here is the issue. Every time I restart syncthing on the phone, the folder in question is scanned, and the Scan Time Remaining infobox in the folder (this is displayed in the Web GUI) fluctuates between “2d 4h” and something like “12m 10s”. Once the scan finishes, each file to sync takes anywhere between 15 and 30 seconds, sometimes up to a minute, and then I see the display update with a change. Logcat confirms syncing is terribly slow, with some mutexes being held in excess of 15 seconds. CPU usage of
com.android.providers.media.module is pegged at 100% if not more all the time while the scan and the sync are happening.
7230 u0_a120 20 0 106G 150M 67M S 101 2.7 18:35.97 com.android.providers.media.module
It seems like, with every file it syncs, the process gets slower and slower and slower. When the folder was syncing its first hundred files, it went by like a blitz. Then it became slower, and slower, and slower, and now we are up to a minute or more per synced file.
For the record, server side scan of the exact same folder, with (as you already know) more files, completes in a blitz. Not even one tenth of a second.
I looked a bit at the code, and there may be a situation where the Media process of Android is in the hot path of the scanning and the syncing. Not sure when that got introduced, but if that’s the case, I’d appreciate if that was removed completely from the hot path, and deferred to a separate goroutine. Media scanning in Android does not need to be in the hot path.
I will later post a logcat during syncing.
One more note: When I downgraded to Syncthing 1.9.0, the extremely slow scan problem went away (it became just slow, taking about 2 minutes to finish). However, the problem of the media process constant CPU pegging during sync continues, as does the slow sync problem.
Needless to say, this situation makes the app completely unusable. I’ve never had this issue before.