Syncthing-android: inotify not working on Android 6+

Created on 19 Nov 2016  路  5Comments  路  Source: syncthing/syncthing-android

https://code.google.com/p/android/issues/detail?id=189231

To verify, use the following steps while Syncthing is running:

  1. run adb logcat -s FolderObserver:v
  2. in a second terminal, run adb shell and cd into a Syncthing folder
  3. create/modify/delete files with touch, mkdir, rm etc
  4. each of these modifications should be shown in the logcat

I tried this on Android 6 devices, and Android 7.0/7.1 emulators, and none of them reported the events correctly. As a workaround, I changed the rescan interval to 60 seconds on these devices.

bug upstream frozen-due-to-age

All 5 comments

I just tested this with my Pixel (Android 7.1) and it works:

$ adb logcat -s FolderObserver:v
--------- beginning of crash
--------- beginning of system
--------- beginning of main
11-19 11:48:33.118  4606  5164 V FolderObserver: Received inotify event 100 at /test1.tmp
11-19 11:48:33.122  4606  5164 V FolderObserver: Received inotify event 4 at /test1.tmp
11-19 11:48:50.486  4606  5164 V FolderObserver: Received inotify event 200 at /test1.tmp
$ adb shell
sailfish:/ $ cd /storage/emulated/0/Download/
sailfish:/storage/emulated/0/Download $ touch test1.tmp
sailfish:/storage/emulated/0/Download $ rm test1.tmp

Also, according to post 30 in that thread, it seems to be fixed since Android 7.0 preview 5: https://code.google.com/p/android/issues/detail?id=189231#c30

Yeah I saw that, but like I said, it's still broken on the emulator. Weird that the behaviour is different there. Would be nice of someone could also try this on a 7.0 device.

Works on Nexus 6p with Android 7.0:

angler:/storage/emulated/0/Sync $ touch f
angler:/storage/emulated/0/Sync $ rm f
angler:/storage/emulated/0/Sync $ mkdir d
angler:/storage/emulated/0/Sync $ rmdir d
angler:/storage/emulated/0/Sync $ cd /sdcard/Sync/                             
angler:/sdcard/Sync $ touch f
angler:/sdcard/Sync $ rm f
angler:/sdcard/Sync $ mkdir d
angler:/sdcard/Sync $ rmdir d
11-19 15:48:30.338  7132  7194 V FolderObserver: Received inotify event 100 at /f
11-19 15:48:30.340  7132  7194 V FolderObserver: Received inotify event 4 at /f
11-19 15:48:33.024  7132  7194 V FolderObserver: Received inotify event 200 at /f
11-19 15:48:35.318  7132  7194 V FolderObserver: Received inotify event 100 at /d
11-19 15:48:35.318  7132  7194 V FolderObserver: observer created for /storage/emulated/0/Sync/d (folder qqhkm-qjvjb)
11-19 15:48:37.535  7132  7194 V FolderObserver: Received inotify event 400 at /d
11-19 15:48:37.536  7132  7194 V FolderObserver: Received inotify event 200 at /d
11-19 15:48:46.029  7132  7194 V FolderObserver: Received inotify event 100 at /f
11-19 15:48:46.031  7132  7194 V FolderObserver: Received inotify event 4 at /f
11-19 15:48:47.173  7132  7194 V FolderObserver: Received inotify event 200 at /f
11-19 15:48:50.074  7132  7194 V FolderObserver: Received inotify event 100 at /d
11-19 15:48:50.074  7132  7194 V FolderObserver: observer created for /storage/emulated/0/Sync/d (folder qqhkm-qjvjb)
11-19 15:48:51.715  7132  7194 V FolderObserver: Received inotify event 400 at /d
11-19 15:48:51.715  7132  7194 V FolderObserver: Received inotify event 200 at /d

Okay thanks for confirming that. I'll set the short rescan interval only on Android 6 then.

Was this page helpful?
0 / 5 - 0 ratings