Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sleep tracking crashes about a quarter into the night #10

Closed
aaronjwood opened this issue Oct 7, 2018 · 164 comments
Closed

Sleep tracking crashes about a quarter into the night #10

aaronjwood opened this issue Oct 7, 2018 · 164 comments

Comments

@aaronjwood
Copy link

Since the rewrite was released everything was working for me. Just recently things stopped working and now sleep tracking crashes a few hours after I've fallen asleep. I wake up in the morning to see my watch on my default widget. This happens regardless of how I start tracking (from the phone/watch) and is now consistent every time I use the app. I've tried to look for logs in the device but didn't see anything from this addon. I did find something in the ERR_LOG.TXT file under GARMIN/DEBUG:

2697 (fenix 5) SW ver: 1000
Build Type: RELEASE
Commit:bef5fea663aeec52575bd5b5b91e2d15afc92b7d
ESN: 3962006839
10/07/18 02:17:42
RTL
errnum: 0x00a
r0: 0x2005bd40
r1: 0x00000063
r2: 0x0000007e
r3: 0x0000007f
r4: 0x000a4a49
Stack frame PC, SP: 0x000cceb9, 0x2005b948
Call Stack - SP at 0x2005b948:
	0x000704cf
	0x000a4a49
	0x0008cba5
	0x000a4a49
	0x000a4a49
	0x0008d82d
	0x000a551d
	0x0001011d
	0x0000b475
	0x00070675
	0x0008d82d
	0x0008d82d
	0x0008d6bd
	0x00020075
	0x000a4c89
	0x00027983
	0x0002621b
	0x0001fdeb
	0x0008d82d
	0x0008d6bd
	0x0008d6db
	0x0008e9a5
	0x0004f255
	0x0004f0ad
	0x0005d523
	0x00011985
	0x0005d571
	0x0005d57d
	0x0008ea8b
	0x000e5b47
	0x0008b80d
	0x00000000
Uptime: 4880819

It looks like I should be seeing a log file specifically for the app.
If you guys make another release with logging enabled I'd be happy to share the logs and help debug the issue.

@Artaud
Copy link
Collaborator

Artaud commented Oct 8, 2018

Thanks, I've posted this stack trace on the Garmin CIQ forums as this is something the Garmin people need to decipher. Link to the thread: https://forums.garmin.com/forum/developers/connect-iq/1411125-watch-app-stops-randomly-after-running-for-1-hour

As far as I know, it is not possible to do debug logs in a release version of the app, so I cannot gather logs from users who download the app via the Connect IQ store.
If you want to do debug logging, you need to sideload the app. Can you build it for yourself? Or I can build it for you if you want.

@aaronjwood
Copy link
Author

Sure, I'll build + sideload it. Give me a few weeks and I should hopefully have some logs for you.

@hAmpzter
Copy link

hAmpzter commented Oct 15, 2018

Hey. What Watch are you running it on @aaronjwood ?
I'm using a Fenix 5 and are having the same issue. Is it a big task to compile and sideload an application for and Garmin-device? If I could do the same and maybe be able to give some more help..
Edit: I now saw at the top of the log-file that it says that you have a Fenix 5.. Lol! Anyhow question 2 still valid.

@aaronjwood
Copy link
Author

I'm using a Fenix 5 as well. I don't think it should be a big task, I just haven't had the time to get to it yet.

@hAmpzter
Copy link

Is it the garmind.debug.xml that you need or how do I enable debugging?

@MrFly
Copy link

MrFly commented Oct 16, 2018

Same issues here with VA3. Can I help you?

@hAmpzter
Copy link

I tried with a own compiled app on my watch yesterday but I don't now how to get good logging of the Garmin-eco-system. Do you know @MrFly ?

@MrFly
Copy link

MrFly commented Oct 16, 2018

I'm sorry, no. Think it has to he enabled in the app (programatically), then there could be many good log files on the watch.

@aaronjwood
Copy link
Author

Was thinking we could make use of

// Logs into the /GARMIN/APPS/LOGS/appname.TXT

Need to create the log file yourself though. I'm not seeing an API to create this file, it looks like the user has to go in and create the file manually through USB mode?!?!

@MrFly
Copy link

MrFly commented Oct 16, 2018

Seems that it is only possible with a manually deployed debug version of the app (comment on the following line)

@aaronjwood
Copy link
Author

Yeah, hoping it's as easy as building a debug version, loading it to the watch, and creating the text file for logs.

@Artaud where did you guys find that logs only work in debug builds? I've seen some of the Garmin devs on their forums say that Sys.println() should still work in release builds, it's just on the user to create that log file themselves.

@aaronjwood
Copy link
Author

aaronjwood commented Oct 16, 2018

Just tried this out, all you need to do is create the log file on the device. No need for a debug build. I just created 88G34652.txt in the LOGS folder and ran a super quick sleep tracking event:

1539676388: Registering for Phone Messages
1539676388: Incoming mail: SetAlarm;1539013200000
1539676388: Alarm set to 2147483647
1539676388: Incoming mail: StopApp
1539676389: Message not handledStopApp
1539676389: --onStart--
1539676389: free: 104568
1539676389: Adding to q:STARTING outQ: [STARTING]
1539676389: getInitialView
1539676389: SleepMainView initialize
1539676389: SleepMainDelegate initialize
1539676389: 2
1539676389: onUpdate
1539676389: onUpdate
1539676389: onUpdate
1539676389: Send next message STARTING
1539676389: onUpdate
1539676390: msgQ: []
1539676390: STARTINGsent OK
1539676391: onKey: 8
1539676391: scrollUp
1539676391: Refreshing View
1539676391: onUpdate
1539676392: onKey: 8
1539676392: scrollUp
1539676392: Refreshing View
1539676392: onUpdate
1539676393: onKey: 8
1539676393: scrollUp
1539676393: Refreshing View
1539676393: onUpdate
1539676394: Incoming mail: SetAlarm;1539704400000
1539676394: Alarm set to 2147483647
1539676394: onKey: 8
1539676394: scrollUp
1539676394: Refreshing View
1539676394: onUpdate
1539676397: Incoming mail: StartHRTracking
1539676397: Switched trackingBool to true
1539676397: changed view to tracking
1539676397: onUpdate
1539676401: Incoming mail: StartTracking
1539676405: onKey: 4
1539676405: onSelect
1539676405: returnCentre
1539676405: Refreshing View
1539676405: changed view to tracking
1539676405: onUpdate
1539676405: Incoming mail: Pause;1539677289965
1539676407: onKey: 8
1539676407: scrollUp
1539676407: Refreshing View
1539676407: changed view to tracking
1539676407: onUpdate
1539676408: onKey: 8
1539676408: scrollUp
1539676408: Refreshing View
1539676408: changed view to tracking
1539676408: onUpdate
1539676409: onKey: 4
1539676409: onSelect
1539676409: free: 102000
1539676409: Adding to q:PAUSE outQ: [PAUSE]
1539676409: returnCentre
1539676409: Refreshing View
1539676409: changed view to tracking
1539676409: onUpdate
1539676409: Send next message PAUSE
1539676409: Incoming mail: SetAlarm;1539704400000
1539676409: Alarm set to 2147483647
1539676410: msgQ: []
1539676410: PAUSEsent OK
1539676412: Incoming mail: Pause;1539677589965
1539676412: onKey: 8
1539676412: scrollUp
1539676412: Refreshing View
1539676412: changed view to tracking
1539676412: onUpdate
1539676412: onKey: 8
1539676412: scrollUp
1539676412: Refreshing View
1539676412: changed view to tracking
1539676412: onUpdate
1539676413: onKey: 4
1539676413: onSelect
1539676413: free: 101984
1539676413: Adding to q:PAUSE outQ: [PAUSE]
1539676413: returnCentre
1539676413: Refreshing View
1539676413: changed view to tracking
1539676413: onUpdate
1539676413: Send next message PAUSE
1539676414: msgQ: []
1539676414: PAUSEsent OK
1539676416: onKey: 8
1539676416: scrollUp
1539676416: Refreshing View
1539676416: changed view to tracking
1539676416: onUpdate
1539676416: onKey: 8
1539676416: scrollUp
1539676416: Refreshing View
1539676416: changed view to tracking
1539676416: onUpdate
1539676417: Incoming mail: StartHRTracking
1539676417: onKey: 8
1539676417: scrollUp
1539676417: Refreshing View
1539676417: changed view to tracking
1539676417: onUpdate
1539676418: onKey: 8
1539676418: scrollUp
1539676418: Refreshing View
1539676418: changed view to tracking
1539676418: onUpdate
1539676419: onKey: 13
1539676419: scrollDown
1539676419: Refreshing View
1539676419: changed view to tracking
1539676419: onUpdate
1539676420: onKey: 4
1539676420: onSelect
1539676420: free: 101984
1539676420: Adding to q:RESUME outQ: [RESUME]
1539676420: returnCentre
1539676420: Refreshing View
1539676420: changed view to tracking
1539676420: onUpdate
1539676420: Send next message RESUME
1539676421: Incoming mail: StartTracking
1539676421: msgQ: []
1539676421: RESUMEsent OK
1539676423: Incoming mail: Pause;1539677889965
1539676425: onKey: 8
1539676425: scrollUp
1539676425: Refreshing View
1539676425: changed view to tracking
1539676425: onUpdate
1539676426: onKey: 4
1539676426: onSelect
1539676426: Normal Exit
1539676426: returnCentre
1539676426: Refreshing View
1539676426: changed view to tracking
1539676426: onUpdate
1539676427: STOPPING sent OK
1539676427: Incoming mail: Pause;0
1539676430: Incoming mail: StopApp
1539676430: SleepMainView initialize
1539676430: SleepMainDelegate initialize
1539676430: 2
1539676430: changed view to tracking
1539676430: onUpdate
1539676430: changed view to tracking
1539676430: onUpdate
1539676432: onStop

I'll use the tracker tonight and see what I get in the morning but I'm guessing there might need to be more log statements to catch the issue. Garmin also has this limitation: When any log file exceeds 5kb, it will automatically be archived to <LOGNAME>.BAK, and a new log will be started. Any old .BAK files will be overwritten when the archive occurs, so the max space a log can reach is ~10kb.

@hAmpzter
Copy link

Alright. I'll create it and try this on my device this night! :)

@Artaud
Copy link
Collaborator

Artaud commented Oct 16, 2018

@aaronjwood That's great - the issue is that the log file name has to be different for every user who downloads the app, it changes every time you download the app, and (I'm not sure about this) will also change with each update.
The way you did it is working perfectly, but not suitable for mass user logging.
But we're on Github here, so yay!

I also have got a wild idea what might be causing some of the issues. Seeing now how much logging is going on in there in the release version, maybe there is a memory leak on some watches when you don't have the log files created.
That said, I've never encountered this issue on my Vivoactive, neither debug nor release build.

@aaronjwood
Copy link
Author

Funny you mention that, I was thinking the same thing. The logs I posted last night showed my free memory dipping each time log is called to check the memory. I saw some people on the forums talking about removing printlns to save memory but I didn't see anything about them causing a leak.

I had the app crash on me again last night so I'll post the logs from my watch ASAP.

@Artaud
Copy link
Collaborator

Artaud commented Oct 16, 2018

Perfect. To remove the logging, the only thing needed is to toggle the debug flag at

var debug = true; var fakeTransmit = false; var beta = false; var debugAlarm = false;

I've built the .prg for Fenix 5 that would do no logging: https://github.com/urbandroid-team/Sleep-as-Android-Garmin-Addon/blob/master/watch-releases/20180918-debug-Fenix5-nologging.prg

@aaronjwood
Copy link
Author

aaronjwood commented Oct 16, 2018

Hmm unfortunately (at least from the logs) it doesn't look like it's a memory issue for me. Here's the .BAK file with the rotated logs:

1539680820: changed view to tracking
1539680820: onUpdate
1539680820: changed view to tracking
1539680820: onUpdate
1539680820: changed view to tracking
1539680820: onUpdate
1539680820: changed view to tracking
1539680820: onUpdate
1539680820: changed view to tracking
1539680820: onUpdate
1539680820: changed view to tracking
1539680820: onUpdate
1539680820: changed view to tracking
1539680820: onUpdate
1539680820: changed view to tracking
1539680820: onUpdate
1539680820: changed view to tracking
1539680820: onUpdate
1539680820: changed view to tracking
1539680821: onUpdate
1539680880: changed view to tracking
1539680880: onUpdate
1539680880: changed view to tracking
1539680880: onUpdate
1539680880: changed view to tracking
1539680880: onUpdate
1539680880: changed view to tracking
1539680880: onUpdate
1539680880: changed view to tracking
1539680880: onUpdate
1539680880: changed view to tracking
1539680880: onUpdate
1539680880: changed view to tracking
1539680880: onUpdate
1539680904: free: 101880
1539680904: Adding to q:[DATA, [32, 40, 39, 44, 40, 39, 52, 44, 44, 36, 44, 43]] outQ: [[DATA, [32, 40, 39, 44, 40, 39, 52, 44, 44, 36, 44, 43]]]
1539680904: free: 101872
1539680904: Adding to q:[DATA_NEW, [1031, 1032, 1032, 1033, 1033, 1031, 1041, 1032, 1032, 1036, 1034, 1034]] outQ: [[DATA, [32, 40, 39, 44, 40, 39, 52, 44, 44, 36, 44, 43]], [DATA_NEW, [1031, 1032, 1032, 1033, 1033, 1031, 1041, 1032, 1032, 1036, 1034, 1034]]]
1539680904: Send next message [DATA, [32, 40, 39, 44, 40, 39, 52, 44, 44, 36, 44, 43]]
1539680905: msgQ: [[DATA_NEW, [1031, 1032, 1032, 1033, 1033, 1031, 1041, 1032, 1032, 1036, 1034, 1034]]]
1539680905: [DATA, [32, 40, 39, 44, 40, 39, 52, 44, 44, 36, 44, 43]]sent OK
1539680905: Send next message [DATA_NEW, [1031, 1032, 1032, 1033, 1033, 1031, 1041, 1032, 1032, 1036, 1034, 1034]]
1539680906: msgQ: []
1539680906: [DATA_NEW, [1031, 1032, 1032, 1033, 1033, 1031, 1041, 1032, 1032, 1036, 1034, 1034]]sent OK
1539680914: free: 102248
1539680914: Adding to q:[HR, 52] outQ: [[HR, 52]]
1539680914: Send next message [HR, 52]
1539680915: msgQ: []
1539680915: [HR, 52]sent OK
1539680940: changed view to tracking
1539680940: onUpdate
1539680940: changed view to tracking
1539680940: onUpdate
1539680940: changed view to tracking
1539680940: onUpdate
1539680940: changed view to tracking
1539680940: onUpdate
1539680940: changed view to tracking
1539680940: onUpdate
1539681000: changed view to tracking
1539681000: onUpdate
1539681000: changed view to tracking
1539681000: onUpdate
1539681000: changed view to tracking
1539681000: onUpdate
1539681000: changed view to tracking
1539681000: onUpdate
1539681000: changed view to tracking
1539681000: onUpdate
1539681000: changed view to tracking
1539681000: onUpdate
1539681000: changed view to tracking
1539681000: onUpdate
1539681000: changed view to tracking
1539681000: onUpdate
1539681000: changed view to tracking
1539681000: onUpdate
1539681000: changed view to tracking
1539681000: onUpdate
1539681025: free: 101880
1539681025: Adding to q:[DATA, [40, 32, 36, 40, 40, 32, 44, 36, 40, 36, 56, 35]] outQ: [[DATA, [40, 32, 36, 40, 40, 32, 44, 36, 40, 36, 56, 35]]]
1539681025: free: 101872
1539681025: Adding to q:[DATA_NEW, [1034, 1028, 1031, 1030, 1031, 1032, 1036, 1029, 1028, 1032, 1032, 1032]] outQ: [[DATA, [40, 32, 36, 40, 40, 32, 44, 36, 40, 36, 56, 35]], [DATA_NEW, [1034, 1028, 1031, 1030, 1031, 1032, 1036, 1029, 1028, 1032, 1032, 1032]]]
1539681025: Send next message [DATA, [40, 32, 36, 40, 40, 32, 44, 36, 40, 36, 56, 35]]
1539681026: msgQ: [[DATA_NEW, [1034, 1028, 1031, 1030, 1031, 1032, 1036, 1029, 1028, 1032, 1032, 1032]]]
1539681026: [DATA, [40, 32, 36, 40, 40, 32, 44, 36, 40, 36, 56, 35]]sent OK
1539681026: Send next message [DATA_NEW, [1034, 1028, 1031, 1030, 1031, 1032, 1036, 1029, 1028, 1032, 1032, 1032]]
1539681027: msgQ: []
1539681027: [DATA_NEW, [1034, 1028, 1031, 1030, 1031, 1032, 1036, 1029, 1028, 1032, 1032, 1032]]sent OK
1539681060: changed view to tracking
1539681060: onUpdate
1539681060: changed view to tracking
1539681060: onUpdate
1539681060: changed view to tracking
1539681060: onUpdate
1539681060: changed view to tracking
1539681060: onUpdate
1539681060: changed view to tracking
1539681060: onUpdate
1539681060: changed view to tracking
1539681060: onUpdate
1539681060: changed view to tracking
1539681060: onUpdate
1539681060: changed view to tracking
1539681060: onUpdate
1539681060: changed view to tracking
1539681060: onUpdate
1539681120: changed view to tracking
1539681120: onUpdate
1539681120: changed view to tracking
1539681120: onUpdate
1539681120: changed view to tracking
1539681120: onUpdate
1539681120: changed view to tracking
1539681120: onUpdate
1539681120: changed view to tracking
1539681120: onUpdate
1539681146: free: 101880
1539681146: Adding to q:[DATA, [40, 44, 40, 32, 36, 40, 43, 52, 32, 40, 36, 35]] outQ: [[DATA, [40, 44, 40, 32, 36, 40, 43, 52, 32, 40, 36, 35]]]
1539681146: free: 101872
1539681146: Adding to q:[DATA_NEW, [1033, 1030, 1033, 1029, 1033, 1032, 1029, 1035, 1030, 1033, 1032, 1029]] outQ: [[DATA, [40, 44, 40, 32, 36, 40, 43, 52, 32, 40, 36, 35]], [DATA_NEW, [1033, 1030, 1033, 1029, 1033, 1032, 1029, 1035, 1030, 1033, 1032, 1029]]]

I wonder if optimizing the logging would help with device battery life. From the above it looks like the app logs all night on every onUpdate call. Here's the regular .TXT file with the most recent logs right before the crash:

1539681146: Send next message [DATA, [40, 44, 40, 32, 36, 40, 43, 52, 32, 40, 36, 35]]
1539681147: msgQ: [[DATA_NEW, [1033, 1030, 1033, 1029, 1033, 1032, 1029, 1035, 1030, 1033, 1032, 1029]]]
1539681147: [DATA, [40, 44, 40, 32, 36, 40, 43, 52, 32, 40, 36, 35]]sent OK
1539681147: Send next message [DATA_NEW, [1033, 1030, 1033, 1029, 1033, 1032, 1029, 1035, 1030, 1033, 1032, 1029]]
1539681148: msgQ: []
1539681148: [DATA_NEW, [1033, 1030, 1033, 1029, 1033, 1032, 1029, 1035, 1030, 1033, 1032, 1029]]sent OK
1539681180: changed view to tracking
1539681180: onUpdate
1539681180: changed view to tracking
1539681180: onUpdate
1539681180: changed view to tracking
1539681180: onUpdate
1539681180: changed view to tracking
1539681180: onUpdate
1539681180: changed view to tracking
1539681180: onUpdate
1539681180: changed view to tracking
1539681180: onUpdate
1539681180: changed view to tracking
1539681180: onUpdate
1539681180: changed view to tracking
1539681180: onUpdate
1539681180: changed view to tracking
1539681180: onUpdate
1539681180: changed view to tracking
1539681180: onUpdate
1539681240: changed view to tracking
1539681240: onUpdate
1539681240: changed view to tracking
1539681240: onUpdate
1539681240: changed view to tracking
1539681240: onUpdate
1539681240: changed view to tracking
1539681240: onUpdate
1539681240: changed view to tracking
1539681240: onUpdate
1539681267: free: 101880
1539681267: Adding to q:[DATA, [32, 44, 40, 40, 36, 40, 48, 36, 36, 44, 36, 64]] outQ: [[DATA, [32, 44, 40, 40, 36, 40, 48, 36, 36, 44, 36, 64]]]
1539681267: free: 101872
1539681267: Adding to q:[DATA_NEW, [1031, 1036, 1030, 1031, 1036, 1032, 1034, 1032, 1029, 1036, 1032, 1038]] outQ: [[DATA, [32, 44, 40, 40, 36, 40, 48, 36, 36, 44, 36, 64]], [DATA_NEW, [1031, 1036, 1030, 1031, 1036, 1032, 1034, 1032, 1029, 1036, 1032, 1038]]]
1539681267: Send next message [DATA, [32, 44, 40, 40, 36, 40, 48, 36, 36, 44, 36, 64]]
1539681267: msgQ: [[DATA_NEW, [1031, 1036, 1030, 1031, 1036, 1032, 1034, 1032, 1029, 1036, 1032, 1038]]]
1539681267: [DATA, [32, 44, 40, 40, 36, 40, 48, 36, 36, 44, 36, 64]]sent OK
1539681268: Send next message [DATA_NEW, [1031, 1036, 1030, 1031, 1036, 1032, 1034, 1032, 1029, 1036, 1032, 1038]]
1539681269: msgQ: []
1539681269: [DATA_NEW, [1031, 1036, 1030, 1031, 1036, 1032, 1034, 1032, 1029, 1036, 1032, 1038]]sent OK
1539681277: free: 102248
1539681277: Adding to q:[HR, 52] outQ: [[HR, 52]]
1539681277: Send next message [HR, 52]
1539681278: msgQ: []
1539681278: [HR, 52]sent OK
1539681300: changed view to tracking
1539681300: onUpdate
1539681300: changed view to tracking
1539681300: onUpdate
1539681300: changed view to tracking
1539681300: onUpdate
1539681300: changed view to tracking
1539681300: onUpdate
1539681300: changed view to tracking
1539681300: onUpdate
1539681360: changed view to tracking
1539681360: onUpdate
1539681360: changed view to tracking
1539681360: onUpdate
1539681360: changed view to tracking
1539681360: onUpdate
1539681360: changed view to tracking
1539681360: onUpdate
1539681360: changed view to tracking
1539681360: onUpdate
1539681360: changed view to tracking
1539681360: onUpdate
1539681360: changed view to tracking
1539681360: onUpdate
1539681360: changed view to tracking
1539681360: onUpdate
1539681360: changed view to tracking
1539681360: onUpdate
1539681360: changed view to tracking
1539681360: onUpdate
1539681387: free: 101896
1539681387: Adding to q:[DATA, [2783, 1671, 47, 309, 43, 59, 47, 43, 51, 51, 47, 55]] outQ: [[DATA, [2783, 1671, 47, 309, 43, 59, 47, 43, 51, 51, 47, 55]]]
1539681387: free: 101888
1539681387: Adding to q:[DATA_NEW, [1659, 1456, 996, 1021, 992, 992, 994, 989, 989, 991, 994, 991]] outQ: [[DATA, [2783, 1671, 47, 309, 43, 59, 47, 43, 51, 51, 47, 55]], [DATA_NEW, [1659, 1456, 996, 1021, 992, 992, 994, 989, 989, 991, 994, 991]]]
1539681387: Send next message [DATA, [2783, 1671, 47, 309, 43, 59, 47, 43, 51, 51, 47, 55]]

But you know what? I had a crash in the watch again. This is from GARMIN/DEBUG/ERR_LOG.BAK:


2697 (fenix 5) SW ver: 1100
Build Type: RELEASE
Commit:9b90c64df0cf6f9498c472ce547c0986c1d446c0
ESN: 3962006839
10/16/18 02:16:28
RTL
errnum: 0x00a
r0: 0x2005b560
r1: 0x000000c4
r2: 0x0000007e
r3: 0x0000007f
r4: 0x000a5dbd
Stack frame PC, SP: 0x000ce22d, 0x2005b168
Call Stack - SP at 0x2005b168:
	0x0007134f
	0x000a5dbd
	0x0008df0d
	0x000a5dbd
	0x000a5dbd
	0x0008eb95
	0x000a6891
	0x0001011d
	0x0000b4bd
	0x00076d81
	0x0008eb95
	0x0008eb95
	0x0008ea25
	0x0008eb95
	0x000200bd
	0x0008ea25
	0x000a5ffd
	0x00028247
	0x00026993
	0x0001fe33
	0x0008eb95
	0x0008ea25
	0x0008ea43
	0x0008fd31
	0x000500d5
	0x0004ff2d
	0x0005e3a3
	0x00011985
	0x0005e3f1
	0x0005e3fd
	0x0008fe17
	0x000e6d27
Uptime: 533715925

The timestamp on that log directly relates to when the sleep app crashed for me. This morning I saw that the app had only tracked about 5% of my night before it crashed and it was around 2:15 AM that the chart showed tracking had stopped. So now the question is how is the sleep app causing the watch to crash internally? @hAmpzter can you check this log file as well to see if your Fenix 5 is internally crashing?

@Artaud wondering if there's an issue with Garmin's CIQ where excessive logging for hours can cause a crash in the underlying system. Maybe they have a leak somewhere themselves...?

@Artaud
Copy link
Collaborator

Artaud commented Oct 16, 2018

wondering if there's an issue with Garmin's CIQ where excessive logging for hours can cause a crash in the underlying system. Maybe they have a leak somewhere themselves...?

@aaronjwood Exactly, that's what I was thinking, and we could confirm that by testing the non-logging version. I got only a cryptic response from Coleman on the Garmin team when I posted your crash stack trace on the Garmin forum, but it seems that it's not an isolated issue.

I actually thought that when I build a release version of the app (there is a release flag on the compiler), then all logging would be disabled, so these issues wouldn't present themselves. But that does not seem to be the case.

Could you please test the non-logging version tonight on your F5 (up here)?

Big thanks

@aaronjwood
Copy link
Author

Will do! I'll post back tomorrow after a night with the version you posted.

@MrFly
Copy link

MrFly commented Oct 16, 2018

@Artaud does this version work with the VA3 too?

@Artaud
Copy link
Collaborator

Artaud commented Oct 16, 2018 via email

@MrFly
Copy link

MrFly commented Oct 16, 2018

Ok. Anything to do, except install this file?

@MrFly
Copy link

MrFly commented Oct 16, 2018

@Artaud Ok, just installed it and started sleep for a first test. The images are nearly the same than before, so this should work without problems. I'll give it a try this night. Tomorrow in the morning I will give feedback about it...

@MrFly
Copy link

MrFly commented Oct 17, 2018

@Artaud great! I think, you almost got it! The tracking worked till about three o'clock like a charm. That's 4 hours more than before

@aaronjwood
Copy link
Author

@MrFly do you have a crash in your GARMIN/DEBUG/ERR_LOG file around the time that tracking stopped working?

@MrFly
Copy link

MrFly commented Oct 17, 2018

@aaronjwood yes, there is one

2700 (vívoactive 3) SW ver: 540
Build Type: RELEASE
Commit:38eeb66ab91c4dbbb90282ab9eea0f28012192aa
ESN: 3961220313
10/17/18 03:38:50
RTL
errnum: 0x800a
r0: 0x00000090
r1: 0x0000007e
r2: 0x0000007f
r3: 0x0016bf53
r4: 0x00000000
r5: 0x00000000
r6: 0x00000000
r7: 0x00000000
r8: 0x00000000
r9: 0x00000000
r10: 0x00000000
r11: 0x00000000
r12: 0x00000000
r13: 0x00000000
r14: 0x00000000
r15: 0x00000000
r16: 0x00000000
r17: 0x00000000
r18: 0x00000000
r19: 0x00000000
r20: 0x00000000
r21: 0x00000000
r22: 0x00000000
r23: 0x00000000
Stack frame PC, SP: 0x00197fcd, 0x1fff2398
Call Stack - SP at 0x1fff2398:
	0x00198571
	0x0016bf53
	0x001480d7
	0x0002729f
	0x0013076b
	0x0016bf53
	0x00148129
	0x0016bf53
	0x0016bf53
	0x00148d4b
	0x0016c867
	0x00148a0b
	0x0000f07d
	0x044ec9e1
	0x00148d4b
	0x00148d4b
	0x00025e43
	0x0016c155
	0x0003b8a1
	0x0003a1e1
	0x00025b03
	0x00148d4b
	0x00148d4b
	0x00148bad
	0x00148bad
	0x00149d83
	0x000ff243
	0x00148bad
	0x0010c857
	0x00011985
	0x0010c885
	0x0010c891
Uptime: 21545082

@hAmpzter
Copy link

hAmpzter commented Oct 17, 2018

Hey. My logs are exactly the same problem as @aaronjwood is having.

Last pieces of SLEEP.BAK:

1539736260: changed view to tracking
1539736260: onUpdate
1539736287: free: 100128
1539736287: Adding to q:[DATA, [3177, 51, 42, 47, 51, 35, 39, 55, 42, 43, 43, 46]] outQ: [[DATA, [3177, 51, 42, 47, 51, 35, 39, 55, 42, 43, 43, 46]]]

And in the: GARMIN\DEBUG\ERR_LOG.BAK:

2697 (fenix 5) SW ver: 1100
Build Type: RELEASE
Commit:9b90c64df0cf6f9498c472ce547c0986c1d446c0
ESN: 3951293740
10/17/18 02:31:29
RTL
errnum: 0x00a
r0: 0x2005b560
r1: 0x00000084
r2: 0x0000007e
r3: 0x0000007f
r4: 0x000a5dbd
Stack frame PC, SP: 0x000ce22d, 0x2005b168
Call Stack - SP at 0x2005b168:
	0x0007134f
	0x000a5dbd
	0x0008df0d
	0x000a5dbd
	0x000a5dbd
	0x0008eb95
	0x000a6891
	0x0006f66b
	0x0000b25b
	0x00076d81
	0x0008eb95
	0x0008eb95
	0x0008ea25
	0x0008eb95
	0x000200bd
	0x0008ea25
	0x000a5ffd
	0x00028247
	0x00026993
	0x0001fe33
	0x0008eb95
	0x0008ea25
	0x0008ea43
	0x0008fd31
	0x000500d5
	0x0004ff2d
	0x0005e3a3
	0x00011985
	0x0005e3f1
	0x0005e3fd
	0x0008fe17
	0x000e6d27
Uptime: 89095622

@aaronjwood
Copy link
Author

I crashed again last night using the version posted above. I only made it about 2 hours in so I didn't get much further than usual.

@alexmihaila64
Copy link

Same for me on 645m. Actually it was better since watch app did not quit, but it stopped recording or sending HR.
Version before oct 2 worked fine on my watch for more than 2 weeks, than after update crash started to happen. Since i am not good at programming, it's difficult for me to see what was changed in order to revert the changes and have a version whiched worked ok.
Maybe if it's not to much to ask, can someone compile that version to sideload it and test it again?

@hAmpzter
Copy link

@hAmpzter It should be already fixed, but we usually do a staged rollout so it might not have reached you yet. The latest beta is here for download https://sleep.urbandroid.org/wp-content/uploads/release/sleep-20181210-beta-release.apk

But that is the version I'm running. I'll try again now and see if I get any HR-data tonight.

@hAmpzter
Copy link

Yeah.. I still have no HR in my data. Is there anyone else on Samsung + Fenix 5 that it's working for? It worked one day in my recent history ( #10 (comment) ).

@hAmpzter
Copy link

And now I saw that I got an update a couple of seconds ago for the 12/12 update of Sleep as Android. I will try tonight and see if this version has fixed the no-HR-data error.

@aaronjwood
Copy link
Author

I have a S9+ with a Fenix 5 and everything is working for me. This was true for the past couple of SAA beta updates.

@hAmpzter
Copy link

@aaronjwood I still have no HR-data on my Samsung Note8.. Hmm.. I'll try and backup everything and then reinstall all applications then. I have just gotten HR-data in one of the combinations with the betas lately.

What are all the versions you have installed now of the three apps?

@MrFly
Copy link

MrFly commented Dec 14, 2018

@hAmpzter SaA: 12.12.18, Garmin Addon 06.12.18, watch app 28.11.18, garmin Connect 4.13.5, VA3

@aaronjwood
Copy link
Author

aaronjwood commented Dec 15, 2018

SaA: 20181212 (enrolled in beta)
Garmin addon: 20181206
Watch/phaser starter: 1.0
SaA unlock: 20180627
SleepCloud: 7.9
Garmin watch app: 20181128

@aaronjwood
Copy link
Author

Just now I got an update for SaA: 20181214

@aaronjwood
Copy link
Author

Well, with the last update of SaA I was only able to make it through half the night with the tracker. Is it breaking for anyone else now?

@MrFly
Copy link

MrFly commented Dec 15, 2018

@aaeonjwood no, works like a charm (with known bugs like freeze on stopping)

@skros89
Copy link

skros89 commented Dec 15, 2018

It crashes for me as well again. Don't know if it's SaA update or November security patch though. Installed them both on the same day.

@aaronjwood
Copy link
Author

After that one crash when I updated to the lastest beta everything has been stable. @skros89 is it crashing consistently for you?

@skros89
Copy link

skros89 commented Dec 19, 2018

Thanks for the tip @aaronjwood, it is indeed working now. I hadn't tested it again because the crash always wakes me up.

@hAmpzter
Copy link

For me this has started to work with everything. The whole night works and I get HR-data. :)
I think the missing HR-data was some wierd setting on the watch that somehow got changed I it did not record HR-data at all. But anyhow it have started working for me with my Fenix 5. :)

@aaronjwood
Copy link
Author

Everything has been rock solid for me. Is it safe to get off the beta of SaA now @Artaud? If so maybe we can close this out as resolved.

@Artaud
Copy link
Collaborator

Artaud commented Jan 2, 2019

Phewww!
Yes, you don't have to be in the beta anymore as we have released everything Garmin related into the stable branch.

Before closing the issue, I'd like to ask everyone else whether they still experience any issues with sleep tracking not surviving the night?

@asplundd
Copy link

asplundd commented Jan 2, 2019

No crashes at all. Watch app seems to work reliably.

Having occasional phone to watch communication problems. Not able to repeat so can't nail down the conditions for the problem. Experiencing a lot of updates on the watch (daily) so might be Garmin breaking things. SAA beta also updating a lot. So thinking it's not the watch app. Also not related to this bug anyway.

@jasonnm
Copy link

jasonnm commented Jan 14, 2019

Hi @Artaud
Sadly it's still not working for me - I uninstalled everything a few months ago, as I was frustrated with this issue. I reinstalled everything from scratch again yesterday on my VA3 and the tracking stopped at around 1am this morning. The main SaA app continued to run on my Android, and all battery optimisation is switched off.
I'm running on a VA3.

Please let me know what ever I can do to help resolve this issue
Thanks very much!

@ulaland
Copy link

ulaland commented Feb 15, 2019

Guys ! I am thinking to buy Fenix 5s but I was wondering if the Smart Alarm function from the Sleep as Android app works for you? It's super important option for me ! Thanks ! :)

@gcupic
Copy link

gcupic commented Feb 15, 2019 via email

@jasonnm
Copy link

jasonnm commented Feb 16, 2019 via email

@aaronjwood
Copy link
Author

I just got the pie update for my phone yesterday and when I went to track my sleep last night I saw that no heart rate data came through. I'll try again tonight to confirm if it was a fluke or not.

@aaronjwood
Copy link
Author

It seems that heart rate monitoring stopped working after my update. My watch tracks sleep all night but when I go to stop and save it I see that most of the chart shows deep sleep while the shows light. There are no instances of awake or REM which used to be tracked. @Artaud is SaA fully supported on Android 9?

@aaronjwood
Copy link
Author

Disregard what I said. Let me do some more testing on this. I was having issues with my Fenix 5 syncing the wrong time (would continually put itself 3 hours back) which was causing my stats/charts to get all messed up in Garmin's app. I have no idea what happened but I could not prevent it from resetting itself every few hours.

I ended up factory resetting it and had a huge problem with getting it to sync for the first time. Now I finally have everything back in place so let me try tracking my sleep for a few nights before I say that there's an issue with Android 9 :P

@aaronjwood
Copy link
Author

Okay so sleep tracking seems to work okay, I just don't get any heart rate data anymore.

@aaronjwood
Copy link
Author

Ugh, disregard again. When I look at my saved sleep tracking from last night I see heart rate data. What seems to be new (maybe intentional?) is when I stop tracking and go to save it I don't see the red line plotting heart rate data anymore. This led me to believe it wasn't working.

@alitheg
Copy link

alitheg commented Nov 16, 2020

Sorry to necro post, but did anyone find a resolution to this? I'm having what sounds like a very similar issue. If it's the same I'm happy to try and debug, if not I'll raise a new ticket :)

Edit: I have a 645M and a OnePlus 6T, and I've already disabled battery optimisations for all the Sleep apps

@asplundd
Copy link

The problem seemed to come and go. When the watch/phaser and the Garmin Add-on are installed, it seems to work better. Garmin 3HR support was removed recently and I started using the sonar support. Seems to work and requires less charging of the Garmin watch.

@Artaud
Copy link
Collaborator

Artaud commented Feb 10, 2022

Guys, we had a big update which hopefully solved each and every issue :) (I wouldn't be that confident normally but we found a great workaround for the fundamental issue in communication between phone and watch) Give it a shot!

@Artaud Artaud closed this as completed Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests