09-11-2018 13:07 - edited 09-11-2018 13:08
09-11-2018 13:07 - edited 09-11-2018 13:08
I'm getting an error trying to run a watch face, that seems to be preventing the app from starting at all.
The related topic came up with Error: Unhandled RangeError: Out of memory: Snapshot create failed which cited a case of overblown recursion -- I could see that, but without further error reporting, it is hard to know where that problem is coming from. I'll do some linting / diagnostics, and report if I find anything.
I would appreciate any insight on this. The github is https://github.com/john-holland/day-maker
Answered! Go to the Best Answer.
09-14-2018 09:54
09-14-2018 09:54
It looks like you're just running out of memory. So much that we can't even display the error message.
You'll need to simplify the device side of the application, perhaps offload some of the calculations to the companion if possible.
09-12-2018 16:15
09-12-2018 16:15
I'm not seeing that error with the branch on master using the simulator. Is it only happening on device?
09-13-2018 06:32
09-13-2018 06:32
09-13-2018 08:54
09-13-2018 08:54
hmm, I wasn't even able to get that branch to build using Studio or the CLI.
~/Downloads/day-maker-clairvoyance ⍉ ▶ npx fitbit Logged in as Jon Barlow <zzz> fitbit$ build > @ build /Users/jon.barlow/Downloads/day-maker-clairvoyance > fitbit-build [00:14:24][info] Building app for Fitbit Versa [00:14:25][info] Building app for Fitbit Ionic [00:14:27][error] common/fitness-functions/_knn.js:19,8 TS1005: ',' expected. [00:14:27][error] common/fitness-functions/_knn.js:19,25 TS1005: '=>' expected. [00:14:27][error] common/fitness-functions/_knn.js:43,0 TS1128: Declaration or statement expected. [00:14:27][error] common/fitness-functions/chi-squared-test.js:54,16 TS1005: ',' expected. [00:14:27][error] common/fitness-functions/chi-squared-test.js:55,19 TS1005: ',' expected. [00:14:27][error] common/fitness-functions/chi-squared-test.js:55,36 TS1005: '=>' expected. [00:14:27][error] common/fitness-functions/chi-squared-test.js:58,0 TS1128: Declaration or statement expected. [00:14:27][error] Error: Failed to compile /Users/jon.barlow/Downloads/day-maker-clairvoyance/common/fitness-functions/_knn.js npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @ build: `fitbit-build` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @ build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
09-13-2018 12:56
09-13-2018 12:56
I updated the github repo, if you want to try pulling again. The project builds for me in studio, and cli.
09-14-2018 09:07
09-14-2018 09:07
So it seems there's an unhandled exception somewhere and it's causing the snapshot to fail. A member of the firmware team is taking a look to see where it's failing. Will let you know when I hear anything.
09-14-2018 09:54
09-14-2018 09:54
It looks like you're just running out of memory. So much that we can't even display the error message.
You'll need to simplify the device side of the application, perhaps offload some of the calculations to the companion if possible.
09-14-2018 13:45
09-14-2018 13:45
Ok, I was hoping it wasn't something like that 😞
Do you know if it was stack allocation memory (just the size of classes or something) or runtime allocation? I'm using some pretty bloated data structures, I'm pretty sure I can get that down.
I'll try storing data, not keeping it in memory, and pulling what I need. I was just hoping I could be lazy heh. I did some tests, and it looks like the versa will crap out above ~37000 flops, so if I'm smart, and I limit data set size / stream process, I should be able to get it working without falling over.
Perhaps I'll create a test harness / data collection project and use that to profile the heavier stuff in something like node / firefox / chrome. Idk maybe I just need to do this on something with more processing power, because it really isn't doing anything interesting during initialization. Anyways, no idea, I'll figure it out and or post more here 🙂 Thanks for looking into it!
09-14-2018 14:03
09-14-2018 14:03
I didn't spend long looking at your code, but consider using something like Int16Array instead of number arrays (if you're not already). They're a lot more compact. Few, if any, values are accurate to more than 16 bits, so you can probably get away with it.
09-18-2018 17:15
09-18-2018 17:15
@Gondwana Thank you, I'll give that a try 🙂
04-16-2019 15:13
04-16-2019 15:13
Hi there,
I decided I'd pop my question here since its related. Thanks for the great response on why this error occurs. My scenario, I have written data to a file - accelerometer every 5 seconds for 4 days. Now I get this error. This being very delicate data, is there a way to get it out of the device before the "ship sinks". Thanks in advance.
04-16-2019 15:56
04-16-2019 15:56
I'm not sure it's possible, but maybe reduce the codebase of your app to only include the bare minimum to transfer the data off the device.
04-16-2019 16:01
04-16-2019 16:01
Hi,
Thanks for the prompt response.
Interestingly, I played with some settings inpackage.json and the error was suddenly gone.
Specifically, I unchecked Exercise Tracking, compilation for Fitbit Versa and Fitbit Versa Lite in package.json (I use a Fitbit Ionic).
When I ran the app again, the error was no longer showing up.
Thanks again.
04-16-2019 16:03
04-16-2019 16:03
Hi,
I should mention, in addition to the above steps, I did update some part of the code as you suggested.
I stopped the accelerometer update and I deleted an extra file i had wanted to use to move a fraction of the data. I believe that must have had some effect. Thanks again.