Syncthing-android: App Not Loading - Stuck

Created on 18 Mar 2017  路  48Comments  路  Source: syncthing/syncthing-android

What Happened?

When loading the application on Android 7.1.1 you get an endless loading animation. Nothing happens. I have to wipe it, kill the process 2 to 10 times before it actually loads and starts working again. During this time syncing does not work at all and my computer shows all devices offline. See screenshot -

screenshot_20170318-080121

What should happen?

The app should open without issue. Load into the options and the folders etc. The app should be syncing at all times without problem.

Steps?

There are no steps. I am using a PureNexus ROM of 7.1.1 using the latest F-Droid version of Syncthing. The app randomly does this and will randomly fix itself really.

Syncthing Version: v0.14.24
OS Version: Android 7.1.1

Let me know how to grab a log file and I can get you that.

bug frozen-due-to-age

Most helpful comment

Its effectively unusable now. Could you please pull this broken version from google play store and restore the last known good version (a few months ago) so that people receive automatic downgrades until the problem is solved?

All 48 comments

Same happens on Android 6.0.1, MIUI 8 since I have updated to the latest wrapper & engine.

On the previous versions restarting took about 30 secs, now it's close to 3 minutes. I am watching two directories, 23 files and about 105 megabytes of data. I have tried to reset database, but it didn't help.

Same on Android 4.2.2. Watching device logs, I see syncthing trying (unsuccessfully) to connect to 127.0.0.1 on port 37112. I see no other obvious problems.

After it finally loaded, I found out what that port is: the web GUI listen port. Hope that helps.

Are you saying to turn off the web GUI? And how exactly?

If you can, but I don't know how. My solution was to backup settings, and downgrade to the previous version until this gets fixed.

I can't see in the code where the web GUI gets its URL set, but it might be possible to prevent it from doing this by giving it an empty address.

App pokes at the web ui, so you can't switch it off.

Did you downgrade the wrapper or the engine to fix this?

Okay, so I have tried the following things to resolve this issue.

Downgrading

  1. Exported settings
  2. Uninstalled 0.97
  3. Installed 0.96
  4. Imported settings

Results

Original problem is gone. However, probably due to certificate issues, I was unable to use Web GUI, it just never loaded from the application. I tried resetting GUI password without luck. I could connect locally using Chrome though.

Reinstalling

  1. Uninstalled 0.97
  2. Installed 0.97
  3. Manually configured all the folders again

Results

Original problem is gone. However, with a lot of folders and/or devices this might be a huge inconvenience.

With both of the methods above restarting Syncthing took less than 10 seconds.

Yea reinstalling or otherwise is a problem. I hassle for me and many.

I do not see why that fixes it, what is the issue exactly anyway..

I have the same problem where digikam just stays in the initial loading state. I looked at the logcat output and the only lines that contain "syncthing" are (with some additional lines around):

03-20 23:05:23.020  1907  2968 I chatty  : uid=1000(system) Binder_8 expire 13 lines
03-20 23:05:52.043  9981 10025 E AndroidRuntime: FATAL EXCEPTION: Thread-11124
03-20 23:05:52.043  9981 10025 E AndroidRuntime: Process: com.nutomic.syncthingandroid, PID: 9981
03-20 23:05:52.043  9981 10025 E AndroidRuntime: java.lang.OutOfMemoryError: Failed to allocate a 30026928 byte allocation with 8388608 free bytes and 27MB until OOM
03-20 23:05:52.043  9981 10025 E AndroidRuntime:    at java.lang.AbstractStringBuilder.enlargeBuffer(AbstractStringBuilder.java:95)
03-20 23:05:52.043  9981 10025 E AndroidRuntime:    at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:146)
03-20 23:05:52.043  9981 10025 E AndroidRuntime:    at java.lang.StringBuilder.append(StringBuilder.java:216)
03-20 23:05:52.043  9981 10025 E AndroidRuntime:    at com.nutomic.syncthingandroid.service.SyncthingRunnable.lambda$trimLogFile$1(SyncthingRunnable.java:359)
03-20 23:05:52.043  9981 10025 E AndroidRuntime:    at com.nutomic.syncthingandroid.service.SyncthingRunnable$$Lambda$2.apply(Unknown Source)
03-20 23:05:52.043  9981 10025 E AndroidRuntime:    at com.annimon.stream.Stream.reduce(Stream.java:1426)
03-20 23:05:52.043  9981 10025 E AndroidRuntime:    at com.nutomic.syncthingandroid.service.SyncthingRunnable.trimLogFile(SyncthingRunnable.java:359)
03-20 23:05:52.043  9981 10025 E AndroidRuntime:    at com.nutomic.syncthingandroid.service.SyncthingRunnable.run(SyncthingRunnable.java:100)
03-20 23:05:52.043  9981 10025 E AndroidRuntime:    at java.lang.Thread.run(Thread.java:818)
03-20 23:20:09.117   412 19655 W SocketClient: write error (Broken pipe)
03-20 23:20:09.140  1907  1907 I chatty  : uid=1000 system_server expire 25 lines

I think recently the amount of saved log-lines was increased, (something like 5k lines instead of 1k?), but really that shouldn't cause out of memory, right? Sure my phone isn't top notch (Moto G3 with 1GB memory), but still.

I can also confirm that this problem goes away after reinstalling Syncthing, that's why I didn't report the first time round. Now it appeared again after using it about three times.

True, a few days after clean reinstallation, issuing a restart command in the wrapper takes about 5 minutes to complete. Syncing about 150 MB / 30 files.

Trimming the log file was done by loading the entire file into memory, and writing it back to storage afterwards. If you have a large log file, that might be more memory than what is available. I've changed it so the log file isnt loaded all at once. Hope that fixes the issue.

@Nutomic When does that happen - only when a crash/error happens or in any case?

Every time Syncthing is started, eg on app start, Syncthing restart, or when WiFi becomes available.

Its effectively unusable now. Could you please pull this broken version from google play store and restore the last known good version (a few months ago) so that people receive automatic downgrades until the problem is solved?

Current Syncthing-Android version is still 0.9.7 (see Menu > Settings > About), with this serious problem, and the only temporary workaround is to reinstall the app every few days.

When is the next version with Nutomic's fix expected? Thank you very much.

Sorry I dont know what causes this problem. Is there anything interesting in the logs when Syncthing fails to start?

@Nutomic I can't be sure, but I suspect @juan-g and others here are all experiencing the issue you fixed in https://github.com/syncthing/syncthing-android/commit/b4e991838e788a8f5c07bdb825a176d5426e20a9. At least I don't know what else changed between 0.9.6 and 0.9.7 that could also have caused this stuck in loading behaviour.

I'm not OP, but I think his original problem was caused by the same issue: slow and memory consuming startup. If his phone is like mine (Redmi 4A, MIUI 8.2.1), the main process always gets interrupted by the OS no matter what battery settings you have, so it restarts every 10 minutes or so. After a while, log file fills with restart messages then grows too big to fit in the memory and then the app can't start. But it's just a theory.

Your fix b4e9918 might have solved it, but I haven't tested it yet on my phone. If there's a compiled beta available, I'd be glad to test it, but unfortunately I don't know how to compile Android apps from source.

Yea I have no idea if that is the cause of my issue, but I don't know where to find the logs exactly? Specially since half the time I can't get into the app. Let me know where I can find those and I can attach it here.

It sounds like you may have figured it out though, would love to get the updated fixed version to test.

@imsodin Whoops I forgot about my own comment. Will push a new release and hope that fixes it.

I see the new version on Play, when/who deals with the F-Droid version?

The latest release fixed the issue for me. Will test on another device
later. Good job on the speedy fix!

EDIT: can confirm that the issue is fixed on my two devices:

  1. Samsung Galaxy S3 (GT-i9300) running Android 7.1.1 (LineageOS)
  2. Samsung Galaxy S5 (SM-G900F) running android 6.0.1 (CyanogenMod)

@nebutron F-Droid publishes new updates every few days or so, not sure about the exact schedule. You could ask on their forum or IRC.

Syncthing-Android has been updated on the Play Store to 0.9.8 (2017-03-27). Thank you. No problem with this version so far.

Sadly, after updating to the 0.9.8 version on F-Droid the same issue occurs.

Endless loading, and its offline (shows all devices offline on my desktop version)

** it seems to be random more so now. It may be improved. I think I have to do more testing. Will update again when I know more.

So it still is happening. I can now (not before) normally swipe it away and it will start working, but then does it again shortly after.

Also, I have now added a new folder to sync and its stuck "syncing(100%)" and is killing my battery. (rebooted, force closed and all that, still like that)

Check the logs

I'm getting a bunch of these in the logs

[7TYN3] 17:28:12 INFO: Puller (folder "lbvzz-dh77t", dir "AntergosCinnamon/installation/personal/Arc Colora/Arc-Red/unity/unmaximize_unfocused_prelight.svg"): symlink window-buttons/maximize_prelight.svg /storage/emulated/0/DATA/AntergosCinnamon/installation/personal/Arc Colora/Arc-Red/unity/unmaximize_unfocused_prelight.svg: permission denied

Yet that makes no sense. The folder has the same permissions as any other folder shared.

Nebutron wrote:

its offline (shows all devices offline on my desktop version)

As a workaround, you can restart the daemon on desktop, and/or restart the phone (not just the app, but the whole phone).

Just reporting in that my original issue (slow startup after a few days of install) has now been gone. Seems like the two issues were unrelated

Yes, the original issue seems fixed for me as well.

The other issue about wrongly "offline" devices has that restart workaround.

Thanks, doing those things only get it working for a short bit.

Hoping that log information above is helpful some how?

That specific file is a symlink, which I suppose fat32 does not support, so the error message is a bit of a red herring. It could also be that the directory is not owned by the right user. Anyways, support should be handled in the forum and not on the issue tracker.

Alright, will start something there. Even though its a bug.

Should I start a new ticket related to this issue still occurring for me. And what new information would be helpful? The log seems to not show anything related to this.

For me this issue just happens less often, and I can swipe away the app on Android to fix it. But then it just keeps happening. So it was changed for me but still occurs.

I have load problems, too.
Samsung Galaxy S4 with LineageOS 14.1-20170412 (Android 7.1.1)

I deinstall Syncthing 0.9.8 and install 0.9.7 (Maybe it's not really related to theres version numbers. Just a deinstall/install will fix it?!?)

Got the same problem with the last update :( Can't use Syncthing on my android xiaomi redmi4 anymore :(

@megashurik Could be #956

I'm seeing this all the time, no read-only folders, Xperia 6.0.1, F-Droid

It works fine in the background:

I SyncthingNativeCode: [2WB34] INFO: Paused state detected, possibly woke up from standby. Restarting in 1m0s.
I SyncthingNativeCode: [2WB34] INFO: Connected to already connected device (snip)
I SyncthingNativeCode: [2WB34] INFO: Restarting
I SyncthingNativeCode: [2WB34] INFO: Exiting
I SyncthingRunnable: Restarting syncthing
etc

After 20 minutes pass, I open the app manually to see something (I've put some files in a shared folder on the PC yet there where not yet on the mobile device)

I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=com.nutomic.syncthingandroid cmp=com.nutomic.syncthingandroid/.activities.FirstStartActivity} from uid 10102 on display 0
I ActivityManager: START u0 {cmp=com.nutomic.syncthingandroid/.activities.MainActivity (has extras)} from uid 10162 on display 0
D bootingxapp: CLEAR event: com.nutomic.syncthingandroid class name: com.nutomic.syncthingandroid.activities.MainActivity dev: Sony
D bootingx : --- event sent: com.nutomic.syncthingandroid class name: com.nutomic.syncthingandroid.activities.MainActivity
I ActivityManager: Displayed com.nutomic.syncthingandroid/.activities.MainActivity: +912ms (total +1s64ms)

...stuck here... with "Loading"

Turning the screen off and on yields:

D bootingxapp: CLEAR event: com.nutomic.syncthingandroid class name: android.app.AlertDialog dev: Sony
D bootingx : --- event sent: com.nutomic.syncthingandroid class name: android.app.AlertDialog

While stuck here it appears as offline to the PC.

I FC the app, and then it opens fine.

Your logs are incomplete, I can't tell anything from that. Can you post full logs please? Might be that Android is just killing the app, have you tried the experimental settings?

There isn't anything else in the logs (those posted are grepped on "sync"), no crashing, it runs fine if I don't actually open it.

I have checked "run in foreground".

I have it on "only Wi-Fi with one specific network".

I've improved a lot of things regarding run conditions and such. I suggest you wait for the next release and see if you still have those problems.

0.10.0 F-Droid
Still seeing this.
I'll come back when I'll take a look at the logs.
A step forward is that at least I'll get the "taking too long see the log" prompt.

A quick workaround is to close and reopen the Syncthing app. That is, press the Recent button (formerly the Menu button) near the Home button of your Android phone, to see the list of running apps. From that screen, close Syncthing with its "X". Then, go to its icon, e.g. with the Home button if you have the Syncthing icon handy on the main screen, and start the Syncthing app again.

@juan-g Depending on app settings (keep in foreground) and Android setup that does not guarantee an app close. I need to go to Android Settings->Apps->Syncthing->Force Close :(

@licaon-kter Or maybe just restart the phone if needed. But usually the quick close-reopen app workaround that I've mentioned is enough in my case. This also works to force a sync.

@nebutron @licaon-kter Are those problems still present in the most recent version 0.10.8?

Closing this, as this is a convoluted issue about 3 seemingly different problems plus adhoc support questions in between. If you still have issues, reopen a new issue with a good description, repro and logs.

Was this page helpful?
0 / 5 - 0 ratings