Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unhandled Error: failed to pre-parse snapshot

ANSWERED

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

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

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.

 

View best answer in original post

Best Answer
13 REPLIES 13

I'm not seeing that error with the branch on master using the simulator. Is it only happening on device?

Best Answer
0 Votes
Oh, it is happening on the clairvoyance branch. Master should be stable.
--
John Holland
Best Answer
0 Votes

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.
Best Answer
0 Votes

I updated the github repo, if you want to try pulling again. The project builds for me in studio, and cli.

Best Answer
0 Votes

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.

Best Answer
0 Votes

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.

 

Best Answer

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!

Best Answer
0 Votes

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.

Peter McLennan
Gondwana Software
Best Answer

@Gondwana Thank you, I'll give that a try 🙂

Best Answer
0 Votes

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.

Best Answer
0 Votes

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.

Best Answer
0 Votes

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.

Best Answer
0 Votes

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.

Best Answer
0 Votes