Android fragility and logging

I have a OnePlus 3T running the latest standard source (9.0.6) and Syncthing 1.4.2. It has always been somewhat fragile in that it disappears once every day or two for no reason I can think of. While it runs, it has been fine.

But recently, it has gotten more fragile, disappearing several times a day. It has stopped twice this morning, and it’s not even 09:00 yet.

Are there logs I can look at? I know about the log from the hamburger menu; all it has is “Established connection”, nothing about crashes, even though the time period covers half a dozen disappearances.

(By “disappear”, I mean the notification icon vanishes, and when I tap the app to start, it begins with “Scanning” for a few seconds before settling down to “Idle”; when it is already running, tapping the app immediately shows “Idle”.)

It’s probably killed by the battery optimiser or something like that. I don’t think that would be shown in any of our logs, as we don’t just exit because we feel like it, you could check system logs.

Android always complains about it draining power, but it complains just as much about other apps – the texting app, camera, etc. It happens with a full battery, low battery, and all levels between. I don’t think those complaints have increased recently.

I turned off battery optimization for Syncthing. Maybe that will help. (And Syncthing had disappeared again)

Also, I hope I didn’t imply that Syncthing just exits for the fun of it – it’s remarkably stable, whether Linux, Androis, or Mac, which is a fine achievement from my experience. I am very happy with it. I am sure this is an Android problem, but I don’t have enough Android knowledge to understand it.

1 Like

As I said, it’s usually killed due to battery optimisations. I know some distributions have two different battery optimisation applications, one shipped by Android, one by OEM, so I’d make sure you are not in the same boat. Other than that, I can only suggest to look at android logs. If the notification is allowed to be permanently visible, it should not get killed by the battery optimiser thing.

Fellow 3t user here. Pinning the app and disabling battery optimizations works for me. But I’m using the forked version which might or might not behave a bit differently.

Also: https://dontkillmyapp.com/oneplus

disabling battery optimizations

Yes, the forked version enforces this as much as possible. This is often misunderstood by users assuming it will drain more battery than usual but that isn’t the case. It’s used to keep the SyncthingNative alive.

This can also be done in the official version by going into Android settings > Search for “battery” > Battery Optimizations. Select “all apps”, look for “Syncthing” and click that item. Then select “Do not optimize” and you’re done. It should then work as stable as the forked version.

1 Like

Tried disabling battery optimization; it exited within two hours, and again an hour or two later, but then remained overnight, which is more or less as usual recently.

I’m running vanilla OxygenOS 9.0.6, if that matters. I use the Nova launcher.

I’m not sure what “pinning” means – I don’t see the lock icon mentioned in the link, and all google results refer to pinning the screen so no other app can be started.

Part of my reason for posting this in the Syncthing forum is that it seems to have gradually gotten worse recently, although I don’t have any time span for “recently” – a month or two? It’s always done this since I first installed it, but not as often at first, whatever that means. Maybe that is from OnePlus Android updates and not Syncthing updates. My money is on the OnePlus updates, although I don’t know why they’d affect Syncthing so much.

I will probably get a new phone sometime this year, and that will be an interesting comparison. This 3T will remain as a WiFi-only phone and I will be able to make direct comparisons.

Did you try the fork? https://play.google.com/store/apps/details?id=com.github.catfriend1.syncthingandroid

1 Like

I had not tried the fork; I just ass-u-med that it was some side load. I just started it; seems I will need to configure it from scratch.

Thanks.

It may also be worthwhile to look here:

The article implies it is only relevant starting with the OnePlus 5, but it may have been backported at some point.

The fork is more stable so far. No hiccups yet. Reconfiguration surprised me only in not automatically picking up the unfork configuration, but once it got going, no more surprised.

1 Like

The fork exited overnight. Restarted it without problem. More stable than the release version though.

Thanks to everyone. An amazing project.

1 Like

Perhaps, you could grab a log for me please before and at the time it exits, please? ADB logs preferred because they show more info about what the os and probably app killers do.

I’d be glad to … but the last time I used adb was with an old Nexus phone which I had rooted. You’ll have to tell me how to get adb logs. I do have programming experience and run Linux at home and work. But the adb world may as well be foreign to me for all I remember now.

Oh come on, please google “how to get adb log”. If you install your phone vendor drivers and download adb from xda (fastboot adb minimal package - I think it was called) you just need to connect your phone via USB and enter “adb logcat v” in a command line window. Please don’t forget to mention when you started the app and when the exit occured.

Link: https://support.citrix.com/article/CTX232375

Not all obvious things are obvious. Is there a single adb log, or one for each app, or …? I don’t know how the answers vary at all, let alone how they vary for what you want. Not all stupid questions are stupid.

Android has one ADB log containing everything whats running on the system.

So I’ve discovered :slight_smile: Then work intervened, so I’ll get back to this tonight.

1 Like

Sorry for the long delay. Got swamped with work, then helping friends with moving, and lost track of everything else. Now Syncthing is exiting many times a day, sometimes within minutes, seldom lasting for more than an hour or two. Guess I need to prioritize this.

1 Like