openambitproject / openambit

openambit
280 stars 82 forks source link

Error while trying to read the log #265

Closed DzSom02 closed 3 years ago

DzSom02 commented 3 years ago

Hello I'm currently using ubuntu 18.04 and I have installed the latest version of master following the instructions in the README.

EDIT: I'm using suunto ambit3 peak clock

Everything worked fine until the moment I wanted to sync the logs see the error below:

If you require any additional information please request it!

Thank you

$: ~/apps/openambit$ ./run.sh 
------running openambit------
$: ~/apps/openambit$ Vendor: 1493, Product: 1b
libambit_komposti: 2 4 59 0
Komposit version: 2 4 59 0
asyncGet:  "https://uiservices.movescount.com/devices/Emu/70.2.17414?appkey=HpF9f1qV5qrDJ1hY1QK1diThyPsX10Mh4JvCw9xVQSglJNLdcwr3540zFyLzIC3e"
libambit WARNING: libambit_navigation_read(): Driver does not support navigation_waypoint_read
Start reading log...
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 16
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 16
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 19
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 19
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 19
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 19
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 19
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
libambit WARNING: parse_sample(): Found unknown periodic sample spec type (0x28): len: 23
corrupted size vs. prev_size
rnorris commented 3 years ago

I too am getting various memory corruption issues - (with an Ambit 3 MultiSport)

@centic9 - As far as I can tell this is introduced the latest commit - sha:a6fdcec0814e59b038702493000dbcde0b296974

If I simply disable the recent memory management changes in pmem20.c

//log_entry->samples[*sample_count].u.unknown.data = malloc(sample_len); //memcpy(log_entry->samples[*sample_count].u.unknown.data, buf + offset + 2, sample_len);

Then the problem goes away.

NB1 Sometimes it crashed in malloc() above, other times in processing a periodic sample.

NB2 For me it's always outputting "Found unknown periodic sample spec type (0x28): len: 17" - it's always len 17 for me; and this sample spec is only in running logs (not Cycling ones).

NB3 I haven't worked out what's wrong the memory changes.

Edit: mistyped the C++ comment symbol

acocauab commented 3 years ago

Thanks for your answer! Commenting the lines was not enoght for me but moving to commit: 6c3c781cfdfdd8587f6ed2876f3db631e67bb132 work smoth!

centic9 commented 3 years ago

Thanks for narrowing down the root-cause, I don't have an Ambit 3, so cannot fully test effect of changes on that part of the code. However it looks like to be a simple bug anyway, so I should be able to fix it.

centic9 commented 3 years ago

Should hopefully be fixed again by https://github.com/openambitproject/openambit/commit/9e6663a4611e70bef15e3cfaf1196a03ddcdd2af

The reporting/handling of the unknown sample was actually completely incorrect, likely would happen on Suunto Ambit 2 or other devices as well.

Please try the latest and report here if you still see crashes for some reason.

marguslt commented 3 years ago

I don't have an Ambit 3, so cannot fully test effect of changes on that part of the code

@centic9 , just thinking out loud here - separating watch log transfer from parsing would enable easier testing and debugging ( saving binary logs by devs & users, later loading those directly into parser without physical access to certain watch / firmware versions ).

Actually this is what both Movescount Android app and Moveslink2 are doing - they first dump the binary log of the activity into a file and then parse it. MC Android app also keeps copy of those binlogs, Moveslink2 tends to delete those after parsing, but it's easy to block this behavior. Meaning that it would allow testing libambit parser against binlogs created by Suunto tools and compare the results against Moveslink2 SML files or Movescount app JSON files.

Though both Movescount mobile app and Moveslink2 will reach their EOL soon, I have a reason to believe that at least Moveslink2 watch sync (local log transfer and generating SML-files) stays functional.

centic9 commented 3 years ago

Good idea and would be very useful to make testing easier, however I likely lack the time to work on something like this, but I am naturally open to receive pull requests in that regard.

acocauab commented 3 years ago

Work smoth for me!

Thank you! :)