Problem creating configuration on Android Q

Hi,

I’m currently trying to build SyncthingNative v1.2.2-rc.2 for Android Q with the legacy storage handling enabled by AndroidManifest.xml.

I’ve done multiple attempts, first one using Go 1.12.1 and NDK r19c - second one using Go1.13beta1 and NDK r20. Some time ago I tried Go 1.12.1 with v1.2.1-rc.5 and NDK r19c. All those builds succeeded and I got “libSyncthing.so” for my APK.

No matter which combination of build tools/Sdk I try, I end up in the attached go crash.

EDIT: To avoid misunderstanding, upgrading an existing Syncthing instance WORKS on Android 9 and Q. SyncthingNative starts and does it’s job. Just creating a NEW config after fresh app installation is what DOES NOT work.

After the crash, the private app’s directory was populated with those files, so I think this may be a go code issue (and not a write access restriction).

ls -a -l /data/data/com.github.catfriend1.syncthingandroid/files
total 40
drwx------ 2 u0_a135 u0_a135 4096 2019-08-15 12:19 .
drwx------ 6 u0_a135 u0_a135 4096 2019-08-15 12:12 ..
-rw------- 1 u0_a135 u0_a135  615 2019-08-15 12:12 cert.pem
-rw------- 1 u0_a135 u0_a135  288 2019-08-15 12:12 key.pem
-rw-rw---- 1 u0_a135 u0_a135  265 2019-08-15 12:19 share_history.xml

Unfortunately, the log is not written to the specified place, the folder [/storage/emulated/0/Android/data/com.github.catfriend1.syncthingandroid/files] is empty. I’ve also tried Android Pie to ensure this place is write-able but got no log at all.

@imsodin: It says “nil pointer deref” in FolderConfiguration.go , any clue to this if there could be a code issue when syncthing creates a new config on Android? The crash doesn’t occur on other platforms, I’ve tested Win10 for example.

Go crash from adb logcat:

12:12:46I/FirstStartActivity User granted WRITE_EXTERNAL_STORAGE permission.
12:12:56I/FirstStartActivity User granted ACCESS_COARSE_LOCATION permission.
12:12:57I/ConfigXml (Re)Generating keys and config.
12:12:57 INFO: Device ID: 2Y4HM5Z-WTV2JFP-M43K2P6-N6PYJ7X-26WKCMD-5HZHSWL-326SQKP-YCOCUAA
12:12:57W/libsyncthing.so type=1400 audit(0.0:6847): avc: denied { read } for name="somaxconn" dev="proc" ino=114442 scontext=u:r:untrusted_app:s0:c135,c256,c512,c768 tcontext=u:object_r:proc_net:s0 tclass=file permissive=0 app=com.github.catfriend1.syncthingandroid
12:12:58E/Go       panic: runtime error: invalid memory address or nil pointer dereference
12:12:58E/Go       [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x5fd34436]
12:12:58E/Go       
12:12:58E/Go       goroutine 1 [running]:
12:12:58E/Go       github.com/syncthing/syncthing/lib/config.(*FolderConfiguration).prepare(0x628bc0b0)
12:12:58E/Go       	F:/GitHub/syncthing-android/syncthing/src/github.com/syncthing/syncthing/lib/config/folderconfiguration.go:253 +0x206
12:12:58E/Go       github.com/syncthing/syncthing/lib/config.NewFolderConfiguration(0x777638d6, 0x92749d36, 0x9f569bb3, 0x4ff8f9e6, 0x4c28ebf5, 0xca934f1f, 0x5a5d7db, 0xa870023f, 0x5ff844ee, 0x7, ...)
12:12:58E/Go       	F:/GitHub/syncthing-android/syncthing/src/github.com/syncthing/syncthing/lib/config/folderconfiguration.go:86 +0x12f
12:12:58E/Go       github.com/syncthing/syncthing/lib/syncthing.DefaultConfig(0x62a8bc20, 0x44, 0x777638d6, 0x92749d36, 0x9f569bb3, 0x4ff8f9e6, 0x4c28ebf5, 0xca934f1f, 0x5a5d7db, 0xa870023f, ...)
12:12:58E/Go       	F:/GitHub/syncthing-android/syncthing/src/github.com/syncthing/syncthing/lib/syncthing/utils.go:53 +0x2d7
12:12:58E/Go       main.generate(0xfffe9811, 0x39, 0x0, 0x0)
12:12:58E/Go       	F:/GitHub/syncthing-android/syncthing/src/github.com/syncthing/syncthing/cmd/syncthing/main.go:440 +0x452
12:12:58E/Go       main.main()
12:12:58E/Go       	F:/GitHub/syncthing-android/syncthing/src/github.com/syncthing/syncthing/cmd/syncthing/main.go:347 +0x23e
12:12:58E/Go       
12:12:58E/Go       goroutine 7 [syscall]:
12:12:58E/Go       os/signal.signal_recv(0x0)
12:12:58E/Go       	F:/GitHub/syncthing-android/syncthing/go/src/runtime/sigqueue.go:139 +0x157
12:12:58E/Go       os/signal.loop()
12:12:58E/Go       	F:/GitHub/syncthing-android/syncthing/go/src/os/signal/signal_unix.go:23 +0x1b
12:12:58E/Go       created by os/signal.init.0
12:12:58E/Go       	F:/GitHub/syncthing-android/syncthing/go/src/os/signal/signal_unix.go:29 +0x3d
12:12:58E/Go       
12:12:58E/Go       goroutine 8 [chan receive]:
12:12:58E/Go       github.com/syncthing/notify.(*nonrecursiveTree).dispatch(0x6286b2c0, 0x6286b240)
12:12:58E/Go       	F:/GitHub/syncthing-android/syncthing/pkg/mod/github.com/syncthing/notify@v0.0.0-20190709140112-69c7a957d3e2/tree_nonrecursive.go:36 +0xae
12:12:58E/Go       created by github.com/syncthing/notify.newNonrecursiveTree
12:12:58E/Go       	F:/GitHub/syncthing-android/syncthing/pkg/mod/github.com/syncthing/notify@v0.0.0-20190709140112-69c7a957d3e2/tree_nonrecursive.go:29 +0xc5
12:12:58E/Go       
12:12:58E/Go       goroutine 9 [chan receive]:
12:12:58E/Go       github.com/syncthing/notify.(*nonrecursiveTree).internal(0x6286b2c0, 0x6286b280)
12:12:58E/Go       	F:/GitHub/syncthing-android/syncthing/pkg/mod/github.com/syncthing/notify@v0.0.0-20190709140112-69c7a957d3e2/tree_nonrecursive.go:81 +0x41
12:12:58E/Go       created by github.com/syncthing/notify.newNonrecursiveTree
12:12:58E/Go       	F:/GitHub/syncthing-android/syncthing/pkg/mod/github.com/syncthing/notify@v0.0.0-20190709140112-69c7a957d3e2/tree_nonrecursive.go:30 +0xf0
12:12:58E/Go       
12:12:58E/Go       goroutine 10 [sleep]:
12:12:58E/Go       runtime.goparkunlock(...)
12:12:58E/Go       	F:/GitHub/syncthing-android/syncthing/go/src/runtime/proc.go:310
12:12:58E/Go       time.Sleep(0x1dcd6500, 0x0)
12:12:58E/Go       	F:/GitHub/syncthing-android/syncthing/go/src/runtime/time.go:105 +0x17a
12:12:58E/Go       github.com/syncthing/syncthing/lib/dialer.init.0.func2()
12:12:58E/Go       	F:/GitHub/syncthing-android/syncthing/src/github.com/syncthing/syncthing/lib/dialer/internal.go:55 +0x2a
12:12:58E/Go       created by github.com/syncthing/syncthing/lib/dialer.init.0
12:12:58E/Go       	F:/GitHub/syncthing-android/syncthing/src/github.com/syncthing/syncthing/lib/dialer/internal.go:54 +0x282
12:12:58E/Go       
12:12:58E/Go       goroutine 12 [select]:
12:12:58E/Go       github.com/syncthing/syncthing/lib/events.(*Logger).Serve(0x628744b0)
12:12:58E/Go       	F:/GitHub/syncthing-android/syncthing/src/github.com/syncthing/syncthing/lib/events/events.go:260 +0xdf
12:12:58E/Go       created by github.com/syncthing/syncthing/lib/events.init.1
12:12:58E/Go       	F:/GitHub/syncthing-android/syncthing/src/github.com/syncthing/syncthing/lib/events/events.go:234 +0x5e
12:12:58W/SyncthingRunnable exit reason = exitNoUpgradeAvailable.

This has nothing to do with anything Android Q or whatever specifics, this is a stupid mistake. Could you please open an issue on github with just the trace (goroutine 1 is enough) - thanks.

1 Like

Of course, will do. I just wanted to make sure I didn’t bother you with “tag+cherry picked code” problems on v1.2.1-rc.5 and so hold back a little before opening the request. Thanks for you help :slight_smile:

Many many thanks for the quick fix @imsodin . Confirmed this working in v1.2.2-rc.3 on emulator and different devices :). The mtime fix is also working fine now. Very very GREAT. This topic can be closed as SOLVED.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.