timfraedrich / OutRun

OutRun is an open-source, privacy oriented, outdoor fitness tracker.
https://outrun.tadris.de
GNU General Public License v3.0
750 stars 65 forks source link

Crashes in background due to CPU usage #23

Open nano9g opened 4 years ago

nano9g commented 4 years ago

Describe the bug Sometimes while recording a workout with the phone locked, OutRun crashes, losing the workout. The crash logs indicate this is due to CPU usage (cpu_resource_fatal).

To Reproduce Unfortunately I don't have a way to reproduce this consistently.

Expected behavior OutRun doesn't crash.

Screenshots No screenshots, but crash logs are below.

Device Information (please complete the following information):

Crash Logs

{"app_cohort":"2|date=1597802400000&sf=143441&tid=ee6d14f45c0254981965d99bd41a4ba1c3aa0709a77c3ac635bd5db03b1f249d&ttype=e","app_name":"OutRun","app_version":"1.2.1","timestamp":"2020-08-31 06:29:31.00 -0700","slice_uuid":"16897B6D-1DC9-3E27-880F-64C7E8BE6F19","adam_id":1477511092,"build_version":"1","bundleID":"de.tadris.OutRun","share_with_app_devs":0,"is_first_party":0,"bug_type":"206","os_version":"iPhone OS 13.6.1 (17G80)","incident_id":"47DE3FF9-8EB2-4BD4-8CE3-0FC68A83C35A","name":"OutRun","is_beta":1}
Date/Time:        2020-08-31 06:28:40 -0700
End time:         2020-08-31 06:29:30 -0700
OS Version:       iPhone OS 13.6.1 (Build 17G80)
Architecture:     arm64
Report Version:   29
Incident Identifier: 47DE3FF9-8EB2-4BD4-8CE3-0FC68A83C35A

Data Source:      Microstackshots
Shared Cache:     0x7ee8000 A0272339-EEC2-3EA9-9009-7910B8BC1928

Command:          OutRun
Path:             /private/var/containers/Bundle/Application/52CAF9F6-730C-4E54-9973-DA52B0F3BE23/OutRun.app/OutRun
Identifier:       de.tadris.OutRun
Version:          1.2.1 (1)
Beta Identifier:  F09BCF22-0C58-4808-93E8-18DFCDC00CCF
PID:              7650

Event:            cpu usage
Action taken:     Process killed
CPU:              48 seconds cpu time over 50 seconds (96% cpu average), exceeding limit of 80% cpu over 60 seconds
CPU limit:        48s
Limit duration:   60s
CPU used:         48s
CPU duration:     50s
Duration:         49.97s
Duration Sampled: 47.57s
Steps:            12

Hardware model:   iPhone10,6
Active cpus:      6

Heaviest stack for the target process:
  12  ??? (libsystem_pthread.dylib + 47988) [0x188098b74]
  12  ??? (libdispatch.dylib + 272460) [0x18802e84c]
  12  ??? (libdispatch.dylib + 234828) [0x18802554c]
  12  ??? (libdispatch.dylib + 232252) [0x188024b3c]
  12  ??? (libdispatch.dylib + 374052) [0x188047524]
  12  ??? (libdispatch.dylib + 371112) [0x1880469a8]
  12  ??? (MapKit + 2118132) [0x195f421f4]
  12  ??? (OutRun + 57592) [0x1044d20f8]
  12  ??? (OutRun + 56592) [0x1044d1d10]
  12  ??? (CoreGraphics + 2057740) [0x18f24560c]
  12  ??? (CoreGraphics + 2018192) [0x18f23bb90]
  12  ??? (CoreGraphics + 2010616) [0x18f239df8]
  12  ??? (CoreGraphics + 2667096) [0x18f2da258]
  6   ??? (CoreGraphics + 2405380) [0x18f29a404]

Powerstats for:   OutRun [7650]
Bundle ID:        de.tadris.OutRun
Adam ID:          1477511092
Is first party:   No
App version:      1.2.1
Build version:    1
Is Beta:          Yes
Share with Devs:  No
UUID:             16897B6D-1DC9-3E27-880F-64C7E8BE6F19
Path:             /private/var/containers/Bundle/Application/52CAF9F6-730C-4E54-9973-DA52B0F3BE23/OutRun.app/OutRun
Architecture:     arm64
Footprint:        131.39 MB
Pageins:          1 pages
Start time:       2020-08-31 06:28:42 -0700
End time:         2020-08-31 06:29:29 -0700
Num samples:      12 (100%)
CPU Time:         46.862s
Primary state:    11 samples Non-Frontmost App, Non-Suppressed, User mode, Effective Thread QoS Background, Requested Thread QoS User Initiated, Override Thread QoS Unspecified
User Activity:    12 samples Idle, 0 samples Active
Power Source:     12 samples on Battery, 0 samples on AC
  12  ??? (libsystem_pthread.dylib + 47988) [0x188098b74]
    12  ??? (libdispatch.dylib + 272460) [0x18802e84c]
      12  ??? (libdispatch.dylib + 234828) [0x18802554c]
        12  ??? (libdispatch.dylib + 232252) [0x188024b3c]
          12  ??? (libdispatch.dylib + 374052) [0x188047524]
            12  ??? (libdispatch.dylib + 371112) [0x1880469a8]
              12  ??? (MapKit + 2118132) [0x195f421f4]
                12  ??? (OutRun + 57592) [0x1044d20f8]
                  12  ??? (OutRun + 56592) [0x1044d1d10]
                    12  ??? (CoreGraphics + 2057740) [0x18f24560c]
                      12  ??? (CoreGraphics + 2018192) [0x18f23bb90]
                        12  ??? (CoreGraphics + 2010616) [0x18f239df8]
                          12  ??? (CoreGraphics + 2667096) [0x18f2da258]
                            6   ??? (CoreGraphics + 2405380) [0x18f29a404]
                            4   ??? (CoreGraphics + 2405524) [0x18f29a494]
                            1   ??? (CoreGraphics + 2405404) [0x18f29a41c]
                            1   ??? (CoreGraphics + 2405292) [0x18f29a3ac]
                              1   <Kernel mode>

  Binary Images:
           0x1044c4000 -                ???  de.tadris.OutRun 1.2.1 (1) <16897B6D-1DC9-3E27-880F-64C7E8BE6F19>  /private/var/containers/Bundle/Application/52CAF9F6-730C-4E54-9973-DA52B0F3BE23/OutRun.app/OutRun
           0x187fec000 -        0x188060fff  libdispatch.dylib          <361DA09A-E7CE-30EB-8DFC-9D9AF9DE4A0A>  /usr/lib/system/libdispatch.dylib
           0x18808d000 -        0x18809dfff  libsystem_pthread.dylib    <24DC6E6F-6798-3F65-908A-F9873447C9D1>  /usr/lib/system/libsystem_pthread.dylib
           0x18f04f000 -        0x18f5befff  CoreGraphics               <C586E13E-67F9-392A-B8FC-E15D8E1A0207>  /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics
           0x195d3d000 -        0x195f7ffff  MapKit                     <C7CE0C73-2266-30A9-B8C5-39636017D423>  /System/Library/Frameworks/MapKit.framework/MapKit
{"app_cohort":"2|date=1597802400000&sf=143441&tid=ee6d14f45c0254981965d99bd41a4ba1c3aa0709a77c3ac635bd5db03b1f249d&ttype=e","app_name":"OutRun","app_version":"1.2.1","timestamp":"2020-09-03 13:01:01.00 -0700","slice_uuid":"16897B6D-1DC9-3E27-880F-64C7E8BE6F19","adam_id":1477511092,"build_version":"1","bundleID":"de.tadris.OutRun","share_with_app_devs":0,"is_first_party":0,"bug_type":"206","os_version":"iPhone OS 13.7 (17H35)","incident_id":"C9411331-9993-4761-A584-5A6349CA60EB","name":"OutRun","is_beta":1}
Date/Time:        2020-09-03 13:00:09 -0700
End time:         2020-09-03 13:01:01 -0700
OS Version:       iPhone OS 13.7 (Build 17H35)
Architecture:     arm64
Report Version:   29
Incident Identifier: C9411331-9993-4761-A584-5A6349CA60EB

Data Source:      Microstackshots
Shared Cache:     0x127cc000 34953B50-8FB0-38D9-9C51-8CD60555E187

Command:          OutRun
Path:             /private/var/containers/Bundle/Application/52CAF9F6-730C-4E54-9973-DA52B0F3BE23/OutRun.app/OutRun
Identifier:       de.tadris.OutRun
Version:          1.2.1 (1)
Beta Identifier:  F09BCF22-0C58-4808-93E8-18DFCDC00CCF
PID:              3490

Event:            cpu usage
Action taken:     Process killed
CPU:              48 seconds cpu time over 51 seconds (93% cpu average), exceeding limit of 80% cpu over 60 seconds
CPU limit:        48s
Limit duration:   60s
CPU used:         48s
CPU duration:     51s
Duration:         51.35s
Duration Sampled: 25.02s
Steps:            4

Hardware model:   iPhone10,6
Active cpus:      6

Heaviest stack for the target process:
  4  ??? (libsystem_pthread.dylib + 47988) [0x19297cb74]
  4  ??? (libdispatch.dylib + 272460) [0x19291284c]
  4  ??? (libdispatch.dylib + 234828) [0x19290954c]
  4  ??? (libdispatch.dylib + 232252) [0x192908b3c]
  4  ??? (libdispatch.dylib + 374052) [0x19292b524]
  4  ??? (libdispatch.dylib + 371112) [0x19292a9a8]
  4  ??? (MapKit + 2117972) [0x1a082d154]
  4  ??? (OutRun + 57592) [0x1025760f8]
  4  ??? (OutRun + 56592) [0x102575d10]
  4  ??? (CoreGraphics + 2057740) [0x199b3060c]
  4  ??? (CoreGraphics + 2018192) [0x199b26b90]
  4  ??? (CoreGraphics + 2010616) [0x199b24df8]
  4  ??? (CoreGraphics + 2667096) [0x199bc5258]
  3  ??? (CoreGraphics + 2405524) [0x199b85494]

Powerstats for:   OutRun [3490]
Bundle ID:        de.tadris.OutRun
Adam ID:          1477511092
Is first party:   No
App version:      1.2.1
Build version:    1
Is Beta:          Yes
Share with Devs:  No
UUID:             16897B6D-1DC9-3E27-880F-64C7E8BE6F19
Path:             /private/var/containers/Bundle/Application/52CAF9F6-730C-4E54-9973-DA52B0F3BE23/OutRun.app/OutRun
Architecture:     arm64
Footprint:        125.77 MB
Start time:       2020-09-03 13:00:34 -0700
End time:         2020-09-03 13:00:59 -0700
Num samples:      4 (100%)
CPU Time:         24.607s
Primary state:    4 samples Non-Frontmost App, Non-Suppressed, User mode, Effective Thread QoS Background, Requested Thread QoS User Initiated, Override Thread QoS Unspecified
User Activity:    4 samples Idle, 0 samples Active
Power Source:     4 samples on Battery, 0 samples on AC
  4  ??? (libsystem_pthread.dylib + 47988) [0x19297cb74]
    4  ??? (libdispatch.dylib + 272460) [0x19291284c]
      4  ??? (libdispatch.dylib + 234828) [0x19290954c]
        4  ??? (libdispatch.dylib + 232252) [0x192908b3c]
          4  ??? (libdispatch.dylib + 374052) [0x19292b524]
            4  ??? (libdispatch.dylib + 371112) [0x19292a9a8]
              4  ??? (MapKit + 2117972) [0x1a082d154]
                4  ??? (OutRun + 57592) [0x1025760f8]
                  4  ??? (OutRun + 56592) [0x102575d10]
                    4  ??? (CoreGraphics + 2057740) [0x199b3060c]
                      4  ??? (CoreGraphics + 2018192) [0x199b26b90]
                        4  ??? (CoreGraphics + 2010616) [0x199b24df8]
                          4  ??? (CoreGraphics + 2667096) [0x199bc5258]
                            3  ??? (CoreGraphics + 2405524) [0x199b85494]
                            1  ??? (CoreGraphics + 2405380) [0x199b85404]

  Binary Images:
           0x102568000 -                ???  OutRun                  <16897B6D-1DC9-3E27-880F-64C7E8BE6F19>  /private/var/containers/Bundle/Application/52CAF9F6-730C-4E54-9973-DA52B0F3BE23/OutRun.app/OutRun
           0x1928d0000 -        0x192944fff  libdispatch.dylib       <D4F3CE0B-EB3B-3EC8-94E8-82BCD861983A>  /usr/lib/system/libdispatch.dylib
           0x192971000 -        0x192981fff  libsystem_pthread.dylib <9386976B-68D4-30AA-B7EC-80E088D3FFD1>  /usr/lib/system/libsystem_pthread.dylib
           0x19993a000 -        0x199ea9fff  CoreGraphics            <C7B5ACD8-5227-3122-AC18-312F6CC52057>  /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics
           0x1a0628000 -        0x1a086afff  MapKit                  <69CAF404-31C4-3935-8804-CEEFF7BB7889>  /System/Library/Frameworks/MapKit.framework/MapKit
matthiasballreich commented 4 years ago

same issue / problem under iOS 13.6 with iPhone XS

nano9g commented 4 years ago

This continues to occur on iOS 14.1 with OutRun 1.2.2.

timfraedrich commented 4 years ago

Sadly this has been a bug since day one. Somehow MapKit (as you can see in the power stack trace) uses too much cpu on some devices, I personally never had this problem which makes it hard to replicate.

In the next major version (1.3) I will include something that might fix the issue once and for all, but could lead to increased battery usage for the people experiencing the crashes now, which also isn't ideal.

I am currently making a significant change in the database though so it might take some time until I get to work on 1.3, I'm sorry.

nano9g commented 4 years ago

Thanks for the explanation. If the choice is between losing workouts and increased battery usage, I’ll take the latter. 🙂

bgrnwd commented 3 years ago

Think this happened to me today, though no logs to prove it. Adding my specs as an additional data point.

yhager commented 3 years ago

This happens to me every time on iPhone 6s, iOS 14.4, Outrun ver 1.3. I haven't been able to complete a run without a crash. I am an experienced programmer, but not an iOS one - if I can be of help by generating logs, trying out patches, or simply debugging, let me know how/what to do. I really like this app and would be able to spend some time on it in order to fix this.

Grollicus commented 3 years ago

I think I've just had this happen

{"app_name":"OutRun","timestamp":"2021-08-09 13:44:29.00 +0200","app_version":"1.3","slice_uuid":"3A80AA10-63C5-3411-B9EF-D9505F1C155A","adam_id":1477511092,"build_version":"1","bundleID":"de.tadris.OutRun","share_with_app_devs":0,"is_first_party":0,"bug_type":"206","os_version":"iPhone OS 14.7.1 (18G82)","incident_id":"65035CF2-8AFD-45DD-B5FD-D8DD5B0A8A6B","name":"OutRun"}
Date/Time:        2021-08-09 13:43:39.719 +0200
End time:         2021-08-09 13:44:29.392 +0200
OS Version:       iPhone OS 14.7.1 (Build 18G82)
Architecture:     arm64e
Report Version:   32
Incident Identifier: 65035CF2-8AFD-45DD-B5FD-D8DD5B0A8A6B

Data Source:      Microstackshots
Shared Cache:     43C508D0-6A3C-39CC-A20D-99DB240EBEAB slid base address 0x1a5a6c000, slide 0x25a6c000

Command:          OutRun
Path:             /private/var/containers/Bundle/Application/DAE532D3-3257-4529-B5D7-3BECC1ECEBE6/OutRun.app/OutRun
Identifier:       de.tadris.OutRun
Version:          1.3 (1)
Adam ID:          1477511092
Is First Party:   No
Beta Identifier:  9B7B27E0-8357-423D-8ACE-B6FC52351795
PID:              2854

Event:            cpu usage
Action taken:     Process killed
CPU:              48 seconds cpu time over 50 seconds (97% cpu average), exceeding limit of 80% cpu over 60 seconds
CPU limit:        48s
Limit duration:   60s
CPU used:         48s
CPU duration:     50s
Duration:         49.67s
Duration Sampled: 37.36s
Steps:            16

Hardware model:   iPhone12,8
Active cpus:      6

Heaviest stack for the target process:
  16  ??? (libsystem_pthread.dylib + 14244) [0x1f1bb67a4]
  16  ??? (libdispatch.dylib + 95420) [0x1a5ac94bc]
  16  ??? (libdispatch.dylib + 52224) [0x1a5abec00]
  16  ??? (libdispatch.dylib + 49156) [0x1a5abe004]
  16  ??? (libdispatch.dylib + 18460) [0x1a5ab681c]
  16  ??? (libdispatch.dylib + 10884) [0x1a5ab4a84]
  16  ??? (MapKit + 2582152) [0x1b57b5688]
  16  ??? (OutRun + 57980) [0x100eae27c]
  16  ??? (OutRun + 57020) [0x100eadebc]
  16  ??? (CoreGraphics + 2139348) [0x1a79614d4]
  16  ??? (CoreGraphics + 2139836) [0x1a79616bc]
  16  ??? (CoreGraphics + 2114996) [0x1a795b5b4]
  16  ??? (CoreGraphics + 2090324) [0x1a7955554]
  16  ??? (CoreGraphics + 2758816) [0x1a79f88a0]
  7   ??? (CoreGraphics + 2491576) [0x1a79b74b8]

Powerstats for:   OutRun [2854]
UUID:             3A80AA10-63C5-3411-B9EF-D9505F1C155A
Adam ID:          1477511092
Is First Party:   No
Beta Identifier:  9B7B27E0-8357-423D-8ACE-B6FC52351795
App Version:      1.3
Build Version:    1
Path:             /private/var/containers/Bundle/Application/DAE532D3-3257-4529-B5D7-3BECC1ECEBE6/OutRun.app/OutRun
Architecture:     arm64
Footprint:        128.44 MB
Start time:       2021-08-09 13:43:51.220 +0200
End time:         2021-08-09 13:44:28.576 +0200
Num samples:      16 (100%)
Primary state:    15 samples Non-Frontmost App, Non-Suppressed, User mode, Effective Thread QoS Background, Requested Thread QoS User Initiated, Override Thread QoS Unspecified
User Activity:    16 samples Idle, 0 samples Active
Power Source:     16 samples on Battery, 0 samples on AC
  16  ??? (libsystem_pthread.dylib + 14244) [0x1f1bb67a4]
    16  ??? (libdispatch.dylib + 95420) [0x1a5ac94bc]
      16  ??? (libdispatch.dylib + 52224) [0x1a5abec00]
        16  ??? (libdispatch.dylib + 49156) [0x1a5abe004]
          16  ??? (libdispatch.dylib + 18460) [0x1a5ab681c]
            16  ??? (libdispatch.dylib + 10884) [0x1a5ab4a84]
              16  ??? (MapKit + 2582152) [0x1b57b5688]
                16  ??? (OutRun + 57980) [0x100eae27c]
                  16  ??? (OutRun + 57020) [0x100eadebc]
                    16  ??? (CoreGraphics + 2139348) [0x1a79614d4]
                      16  ??? (CoreGraphics + 2139836) [0x1a79616bc]
                        16  ??? (CoreGraphics + 2114996) [0x1a795b5b4]
                          16  ??? (CoreGraphics + 2090324) [0x1a7955554]
                            16  ??? (CoreGraphics + 2758816) [0x1a79f88a0]
                              7   ??? (CoreGraphics + 2491576) [0x1a79b74b8]
                                1   <Kernel mode>
                              3   ??? (CoreGraphics + 2492684) [0x1a79b790c]
                              3   ??? (CoreGraphics + 2492852) [0x1a79b79b4]
                                2   ??? (CoreGraphics + 2496904) [0x1a79b8988]
                                1   ??? (CoreGraphics + 2496876) [0x1a79b896c]
                              2   ??? (CoreGraphics + 2497304) [0x1a79b8b18]
                              1   ??? (CoreGraphics + 2492084) [0x1a79b76b4]

  Binary Images:
           0x100ea0000 -                ???  de.tadris.OutRun 1.3 (1) <3A80AA10-63C5-3411-B9EF-D9505F1C155A>  /private/var/containers/Bundle/Application/DAE532D3-3257-4529-B5D7-3BECC1ECEBE6/OutRun.app/OutRun
           0x1a5ab2000 -        0x1a5af6fff  libdispatch.dylib        <9555D7D9-9C92-3AF3-9837-AE1F5AA7DA44>  /usr/lib/system/libdispatch.dylib
           0x1a7757000 -        0x1a7ceffff  CoreGraphics             <994F6C83-E2C8-3A4B-BBA7-CDE00BEC90CF>  /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics
           0x1b553f000 -        0x1b5804fff  MapKit                   <E68C42CF-3852-3A18-9DF5-0D3D15502FD4>  /System/Library/Frameworks/MapKit.framework/MapKit
           0x1f1bb3000 -        0x1f1bbefff  libsystem_pthread.dylib  <9F849E98-F742-3B3D-B01A-61F75ACF0540>  /usr/lib/system/libsystem_pthread.dylib

(got 4 more crashes from the same run if you're interested)

I've been using OutRun a bit and never had problems with this up until now, but today it just kept crashing. Would it maybe be possible to offer an option to disable the map or maybe add a contingency that will at least continue recording the last run when restarted after a crash?

timfraedrich commented 3 years ago

I think I've just had this happen

@Grollicus Yes, this message does unfortunately look familiar, what's obvious from it - like you seem to have deduced yourself already - the map seems to be the issue. As to why the app crashes and how to prevent it I sadly still have no idea, because I haven't been able to reproduce the issue and debug it properly.

Something that has worked for some people is a fresh install, you can create a backup before and import it after, so you don't lose any data. Another option you can consider is disabling the map, this has been a feature for a while but has not always worked.

I hope we can resolve this issue for you, I'm still trying to get behind all of this, if you have any other clues please let me know.

Best wishes, Tim