Syncthing-android: Syncthing crashes on startup 0.10.11

Created on 12 Jun 2018  路  20Comments  路  Source: syncthing/syncthing-android

syncthing crashes on startup since last update from play store

App Version 0.10.11
Version in Playstore 0.14.48
Android 7.1.2
LineageOS 14.1-20180606-NIGHTLY-bacon

Syncthing crashes on startup (also after reboot of device)
Reproducable on my sytstem

bug frozen-due-to-age

All 20 comments

here the logcat i could take. As this is my first one please let me know if more information is needed
syncthingCrash.log

Reason according to the log is this:

06-12 20:24:22.974  9556  9589 E AndroidRuntime: FATAL EXCEPTION: Thread-2
06-12 20:24:22.974  9556  9589 E AndroidRuntime: Process: com.nutomic.syncthingandroid, PID: 9556
06-12 20:24:22.974  9556  9589 E AndroidRuntime: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Set
06-12 20:24:22.974  9556  9589 E AndroidRuntime:    at android.app.SharedPreferencesImpl.getStringSet(SharedPreferencesImpl.java:244)
06-12 20:24:22.974  9556  9589 E AndroidRuntime:    at com.nutomic.syncthingandroid.service.SyncthingRunnable.buildEnvironment(SyncthingRunnable.java:435)
06-12 20:24:22.974  9556  9589 E AndroidRuntime:    at com.nutomic.syncthingandroid.service.SyncthingRunnable.run(SyncthingRunnable.java:133)
06-12 20:24:22.974  9556  9589 E AndroidRuntime:    at com.nutomic.syncthingandroid.service.SyncthingRunnable.run(SyncthingRunnable.java:106)
06-12 20:24:22.974  9556  9589 E AndroidRuntime:    at java.lang.Thread.run(Thread.java:761)

SyncthingRunnable.java:435 is building the STTRACE environment variable when launching the native part.

Seems like the old setting was stored as a string under the same key, which now breaks for every user who ever had that preference set. You can probably export your config and reinstall the app to work around this.

Thanks for the hint. I removed the "sttrace config line in , shared_prefs/com.nutomic.syncthing.andoird_preferences.xml saved and could start again.

I'll make a fix for this ready the next days. Thanks for reporting it.

Solution 1: draft
We add a migration func to SyncthingService so it works when the service gets started. May be buggy catching pref changes while disabled by run condition

If we find the sttrace pref set to string, we will remove it from the map.

Map keys = sharedPreferences.getAll();

for(Map.Entry entry : keys.entrySet())
{
Log.d("map values", entry.getKey() + ": " + entry.getValue().toString());
Log.d("data type", entry.getValue().getClass().toString());

if ( entry.getValue().getClass().equals(String.class))
"Sharedpref(key).editor.remove.commit
}

Solution 2: more easy and safe - we'll follow best pratice and rename the pref sttrace to debug_facilities_enabled
Both solutions have the downside to drop the freely given user string. I think thats okay.
Whats your suggestion? I'll implement it after a quick feedback.

Just rename it.

Sidenote: could this be fixed without losing the config and having root? (I guess "export your config" implies root, too.)

An immediate bugfix release was rejected. The fix for this is already on the master, so upgrading to the next version that contains syncthing v0.14.49 (android version 0.10.12) is expected to fix the crash on app startup.
See PR https://github.com/syncthing/syncthing-android/pull/1136 for detailed technical info why that is.

I see _why_ but I do not see _how_ am I suposed to fix it apart from losing the config. The obvious solution is waiting for the release in the unspecified time in the future which is far from ideal, and I don't see any else. (It's a problem since sync is off for weeks now, but it's my problem.) Just asked whether anyone have a bright idea apart from waiting with sync off.

@AudriusButkevicius Any chance to help him out with an unplanned release? If yes, I would sum up the commits we have to leave out as they already contain 14.49 stuff to have a working release with just enhancements and bug fixes. PR #1136 is one of them I remember. Second is the SAF stuff.

He can get a branch build off the build server, or you can explain him how to clear the preferences (not config)

I guess his problem is really bad because a debug build would not takeover his existing config because of different app id. If he uses androids clear app data the problem would be resolved but device ID, linked folders etc. Would also be gone. Without root he has no chance to manually backup Syncthing's config to be later able to restore it. He can't get into the app.
Some different idea I didn't try myself yet: maybe connecting via adb shell from a computer can help. With luck he can pull off a copy of the /data/data/com.nutomic.syncthingandroid/files folder contents. Placing them on the internal storage at /storage/emulated/0/backups/syncthing (accessible without root) would allow clearing the app data and importing a valid backup then at 0.10.11.

Heres more info about the unrooted method for pulling off android app's data: https://stackoverflow.com/a/17876731

(Sidenote: that dir isn't readable by nonroot normally, but maybe fastboot can access it, that's an idea. I'll check. I'll check the stackoverflow link as well later. Thanks!)

@grinapo Just got informed the new release is being available on google play 0.10.12
It should be visible shortly. Can you please try if it fixes your issue with the syncthing startup?

It's only rolled out to 5% of people so far.
I'll keep increasing that over tomorrow.

Got the update, and it indeed __fixed__ the issue without any problems or config losses. Thanks!

Thanks for reporting back @grinapo .

Was this page helpful?
0 / 5 - 0 ratings