jonasoreland / runnerup

A open source run tracker
GNU General Public License v3.0
743 stars 274 forks source link

RunnerUp stops recording for no obvious reason #365

Open jugglerchris opened 8 years ago

jugglerchris commented 8 years ago

I've been for a couple of walks recently where the track stopped after a couple of miles. The first time was about the time I was fiddling with my phone anyway so I assumed it was user error, but today it definitely stopped after just under 30 minutes/4km.

On the UI it seemed to think it was ok (the Pause and Stop buttons were available). I had autopause disabled, but I had sound turned off, so I couldn't say whether it thought it was autopaused. At the time it stopped I was on a footpath through some woods, so there's a possibility the GPS signal went bad at around that point.

I'm not expecting a diagnosis/fix from the above, but any suggestions on what I can do to get more information in case it happens again would be welcome.

Cagier commented 8 years ago

Hi Chris,

This happens to me too occasionally. It used to be a lot worse and happened with a variety of apps, including MapMyRun and RunKeeper. It is almost definitely due to the GPS losing the signal.

I use the "GPS Fix" app to calibrate the GPS data before I run (or the Manage A-GPS Download option in the "GPS Status" app also does the same thing.) This seems to help a good bit.

If you want to confirm that it is the GPS then switch to one of those GPS apps (or something similar) to see if they have a lock on a GPS signal or not. I can't remember if RunnerUp displays any sort of GPS status when actually running (but RunKeeper does).

Sometimes it will catch up if you're lucky and the GPS kicks back in. But then you get a straight line between that and the last data point on the map afterwards. Rebooting the phone can also help. I find also standing still until it gets a GPS lock can help too. However, I have ruined many a run by running/stopping/jogging along trying to switch things on and off for half the time.

One recommendation from RunkKeeper is leaving google maps running in the background sometimes if you have this issue but I don't think it makes much difference. I think running "GPS Status" has the same effect and will also have the advantage of giving you a great visual indicator of how many satellites are locked in, etc.

The ultimate solution is to use an external GPS device that synchs with your phone but that is obviously expensive and something else to carry so try the above and hopefully it will help a bit. You can also edit your route afterwards in something like RunKeeper to fill in the gaps and then synch it with your other accounts, but it is all a bit of a pain.

It would be good if RunnerUp detected that the GPS signal is lost and gave an audio warning as you can be running for a while before you realise that it has all gone just a bit too quiet! Maybe that could be considered as a feature request in future...

jonasoreland commented 8 years ago

Hi,

just want to agree with what has been said. it happens for me too, quite rare, but when it happens it's due to loosing gps signal. i have thought about giving a warning, but has not yet got around to it...

/Jonas

On Wed, Feb 10, 2016 at 4:06 PM, Keith Garland notifications@github.com wrote:

Hi Chris,

This happens to me too occasionally. It used to be a lot worse and happened with a variety of apps, including MapMyRun and RunKeeper. It is almost definitely due to the GPS losing the signal.

I use the "GPS Fix" app to calibrate the GPS data before I run (or the Manage A-GPS Download option in the "GPS Status" app also does the same thing.) This seems to help a good bit.

If you want to confirm that it is the GPS then switch to one of those GPS apps (or something similar) to see if they have a lock on a GPS signal or not. I can't remember if RunnerUp displays any sort of GPS status when actually running (but RunKeeper does).

Sometimes it will catch up if you're lucky and the GPS kicks back in. But then you get a straight line between that and the last data point on the map afterwards. Rebooting the phone can also help. I find also standing still until it gets a GPS lock can help too. However, I have ruined many a run by running/stopping/jogging along trying to switch things on and off for half the time.

One recommendation from RunkKeeper is leaving google maps running in the background sometimes if you have this issue but I don't think it makes much difference. I think running "GPS Status" has the same effect and will also have the advantage of giving you a great visual indicator of how many satellites are locked in, etc.

The ultimate solution is to use an external GPS device that synchs with your phone but that is obviously expensive and something else to carry so try the above and hopefully it will help a bit. You can also edit your route afterwards in something like RunKeeper to fill in the gaps and then synch it with your other accounts, but it is all a bit of a pain.

It would be good if RunnerUp detected that the GPS signal is lost and gave an audio warning as you can be running for a while before you realise that it has all gone just a bit too quiet! Maybe that could be considered as a feature request in future...

— Reply to this email directly or view it on GitHub https://github.com/jonasoreland/runnerup/issues/365#issuecomment-182413203 .

jugglerchris commented 8 years ago

To try to summarise/clarify the above, here are some statements which may or may not be true. :)

  1. When you lose the GPS signal, RunnerUp stops recording (kind of obvious)
  2. Some other GPS-based apps might keep the GPS alive for longer
    • If so, I guess RunnerUp ought to do the same as whatever they do
    • However I've also had nearly an hour's recording work fine without stopping
  3. Sometimes when the GPS signal is lost but returns, RunnerUp doesn't ever start again
    • This is what I think this issue, which I think is a bug, is about

Have I got any of that wrong?

Thanks,

Chris

ghost commented 8 years ago

This happens to me rather frequently. RunnerUp will sometimes pause and then resume within just a second or two, rarely more than ten seconds apart, presumably because GPS lock was restored. This makes me wonder if perhaps RunnerUp could wait for a brief period, say five or ten seconds, before pausing when GPS lock is lost while trying to reestablish it? That shouldn't significantly affect the tracking data, I think.

zebeuz commented 7 years ago

Same problem. I 'll try the gps fix or other one (google maps navigate without problem or interrupt)

gerhardol commented 7 years ago

RunnerUp does not drop GPS until recording is stopped (or app crashes). So when GPS coverage is OK again, RU should reconnect. However, if there are no GPS updates, RU will not record anything or update the time.

If you have occasional paused/started, it is likely the auto pause that kicks in. If GPS signal is weak, it could result in the distance being slow enough to enable auto pause. See for instance #598

The enhancement from this issue is to give an audio cue if GPS is lost/regained. (The issue discusses a possible bug that RU stops recording for other reasons or do not restart recording, hard to investigate unless there are more information how it occurs.)

djibux commented 6 years ago

@jugglerchris, does the recording stop on on a round number? I'm having a similar issue where, about once in every 5 run, the app stops, and it's always on an round number (4km, 6km…).

When this happens, I am left with the screen habitually displayed during runs, but without any number displayed. The two buttons at the bottom are unresponsive.

jugglerchris commented 6 years ago

@djibux Sorry, I haven't used the app for a while now. I don't remember it being obviously round numbers, but it's been long enough I might not remember.

djibux commented 6 years ago

Here are screen captures of the problem I explained above.

Current session seems dead, all text disappears, buttons on the bottom are unresponsive.

Session (27/05) appears with no duration and no length.

When clicking on the session, some laps have been recorded, but not all. Crash always appears on a round number. In the case above, lap 4.

djibux commented 6 years ago

Should I open a new bug request for my issue?

gerhardol commented 6 years ago

Should I open a new bug request for my issue?

I assume this is the same problem so that would not be necessary

djibux commented 6 years ago

What can I do to help debug that issue? It's really frustrating when I go for a run and realize the app missed part of it.

djibux commented 6 years ago

Hello,

I used adb logcat today and discovered the ActivityManager is killing the process:

07-02 12:10:12.357 1307-1344/? I/ActivityManager: Killing 22594:org.runnerup/u0a333 (adj 200): [BgDetect][RNK] kill org.runnerup (uid 10333) usage 9
07-02 12:10:12.357 1307-1344/? D/ActivityManager: Process org.runnerup has 0 services
07-02 12:10:12.360 1307-1344/? D/EmbryoManager: prepare org.runnerup user 0
07-02 12:10:12.364 3693-3693/? D/NotificationListener: onNotificationRemoved# hash: 52851878 sbn: StatusBarNotification(pkg=org.runnerup user=UserHandle{0} id=1 tag=null key=0|org.runnerup|1|null|10333: Notification(channel=null pri=0 contentView=null vibrate=null sound=null tick defaults=0x0 flags=0x16a color=0x00000000 category=service vis=PUBLIC))
07-02 12:10:12.433 1307-1543/? W/InputDispatcher: channel '2bc9fcd org.runnerup/org.runnerup.view.RunActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
07-02 12:10:12.433 1307-1543/? E/InputDispatcher: channel '2bc9fcd org.runnerup/org.runnerup.view.RunActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
07-02 12:10:12.437 1307-1543/? W/InputDispatcher: channel 'a08052d org.runnerup/org.runnerup.view.MainLayout (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
07-02 12:10:12.437 1307-1543/? E/InputDispatcher: channel 'a08052d org.runnerup/org.runnerup.view.MainLayout (server)' ~ Channel is unrecoverably broken and will be disposed!
07-02 12:10:12.439 1307-20815/? I/WindowManager: WIN DEATH: Window{a08052d u0 org.runnerup/org.runnerup.view.MainLayout}
07-02 12:10:12.439 1307-20815/? W/InputDispatcher: Attempted to unregister already unregistered input channel 'a08052d org.runnerup/org.runnerup.view.MainLayout (server)'
07-02 12:10:12.447 1307-20960/? I/WindowManager: WIN DEATH: Window{2bc9fcd u0 org.runnerup/org.runnerup.view.RunActivity}
07-02 12:10:12.447 1307-20960/? W/InputDispatcher: Attempted to unregister already unregistered input channel '2bc9fcd org.runnerup/org.runnerup.view.RunActivity (server)'
07-02 12:10:15.389 1307-1343/? I/ActivityManager: Start proc 15897:org.runnerup/u0a333 for embryo org.runnerup
07-02 12:10:15.390 1307-1343/? D/Embryo_Uterus: Embryo created.org.runnerup, pid=15897
07-02 12:10:15.564 15897-15897/? D/Embryo: preload org.runnerup, 34ms, hwui=true, layout=true, decor=false

I'm not too sure where to go from there.

gerhardol commented 6 years ago

@djibux The printout says 0 services, I do not know if that is before or after the app is killed. Any logcat prior to the problem? Device, android version? Was RU running in the foreground? What other apps are running?

djibux commented 6 years ago

Hello,

It seems the app has no running services.

I own a OnePlus 5T running Android 8.1. My wife has the same issue on a OnePlus 3T running Android 8.0. That issue happens even if the application is in the foreground (I haven't tried leaving the display on but I guess the app wouldn't be closed by the Activity Manager).

I have a bunch of other apps running, mainly email, instant messaging, and basically all apps that frequently seek for new information but there is plenty of memory left on my device. You can also see that some apps have a huge uptime but all those apps have at least one running service.

Here is a logcat of the crash.

Marx2 commented 6 years ago

Don't you use power saving mode? When my s7 is in this mode, doesn't register anything

śr., 4.07.2018, 00:07 użytkownik djib notifications@github.com napisał:

Hello,

It seems the app has no running services.

https://user-images.githubusercontent.com/6897338/42245499-5522538a-7f19-11e8-9d73-3fdd1a43c5cc.jpg

I own a OnePlus 5T running Android 8.1. My wife has the same issue on a OnePlus 3T running Android 8.0. That issue happens even if the application is in the foreground (I haven't tried leaving the display on but I guess the app wouldn't be closed by the Activity Manager).

I have a bunch of other apps running, mainly email, instant messaging, and basically all apps that frequently seek for new information but there is plenty of memory left on my device. You can also see that some apps have a huge uptime but all those apps have at least one running service.

Here is a logcat https://framabin.org/p/?61cafc545ec6f1de#QqjbvYvFcFWikrE+Kock0NUzw2gkLhqlhVbVRncWosY= of the crash.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jonasoreland/runnerup/issues/365#issuecomment-402306060, or mute the thread https://github.com/notifications/unsubscribe-auth/AAyOZkQk2LdEUfqdU0tvTFYw54YzoTy_ks5uC-slgaJpZM4HXSmv .

djibux commented 6 years ago

I don't, or at least not in the tests above.

My phone doesn't kill other apps such as Endomondo or ForRunners. -- djib

gerhardol commented 6 years ago

The log says that the service is gone, but I do not see any explanation why. I still do not know what is causing the problem.

djibux commented 6 years ago

Hello.

What line makes you think a service is gone ?

According to the first screen capture, RunnerUp doesn't seem to register any service (at least on my phone). -- djib

gerhardol commented 6 years ago

I was sure RU started some services... None are declared in the manifest and none is started (with startService() at least). So it may explain why the aggressive ActivityManager in OP is killing the app (with that much RAM, why?)

In some way, no service simplifies the GPS handling as there are GPS restrictions for services (the notification is required too). Maybe a dummy service is needed.

How easy is it to reproduce?

djibux commented 6 years ago

Hey,

The issue is easy to reproduce: I just have to leave the app running and it is killed between half an hour to an hour.

The aggressiveness of the ActivityManager has probably changed within the last year (with the upgrade to Android 8?) because the crash used to be random, and is now systematic.

Le 6 juillet 2018 00:42:46 GMT+02:00, Gerhard Olsson notifications@github.com a écrit :

I was sure RU started some services... None are declared in the manifest and none is started (with startService() at least). So it may explain why the aggressive ActivityManager in OP is killing the app (with that much RAM, why?)

In some way, no service simplifies the GPS handling as there are GPS restrictions for services (the notification is required too). Maybe a dummy service is needed.

How easy is it to reproduce?

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/jonasoreland/runnerup/issues/365#issuecomment-402873475

-- djib

djibux commented 6 years ago

Hey,

I had a go at implementing a dummy background service. Unfortunately it didn't work (the service was kept alive, but the process killed anyway). I probably need to bind the service to the RunActivity instead of just running it in the background… but even if that might end up working, it feels like a weird workaround to me.

So I did some research and it seems that OxygenOS (OnePlus's implementation of Android) has a very aggressive memory management and battery optimization algorithm (and it is strongly criticized). I read that pinning the app in the recent apps keeps the app alive. I tried, it seems to work (managed to go for a couple of hour-long runs).

So the issue I was experimenting seems to be experienced on OnePlus devices only and has a workaround.

Sorry for the trouble, and I hope that message will help others.

gerhardol commented 6 years ago

The Tracker (the service that records the activities) is not in the manifest, maybe it need to be added. (Not just OP has a too aggressive memory management.)

djibux commented 6 years ago

I checked and it seems to be in the manifest:

        <service android:name=".tracker.Tracker" />

But I don't know why it doesn't appear in the list of running services…