0

The strange issue happens on the ARM32 platform. I need to run a time-series database to store and process my sensor data on an edge device. I don't have many options as some popular databases can't run on a device with very small storage capabilities. After few cycles of evaluation, I found an open-sourced time-series database TDengie seems perfectly matched my requirements since it's powerful and small enough. But when I compile and run it on my ARM32 board, it hangs the whole system. I have tried it on my X86 Linux machine and even Raspberry Pi 4 and it doesn't have such an issue. I doubt it's a special bug that exists on ARM32 only. I spent some time debugging. and I found it hands on a piece of code in the src\query\src\qExecutor.c.

*(double *)pCtx->pOutput = *(double *)pCtx->pOutput + pInput->dsum;

It works great on the X86 and Raspberry Pi but always failed on ARM32. I don't have sufficient knowledge about ARM platform-specific instruction C program generated.

Appreciated if someone can help out on this?

hook capt
  • 135
  • 5
  • 1
    My guess is it may be due to invalid alignment. What is `pCtx->pOutput` and how is that set? Please post a [Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example). – MikeCAT Jul 27 '21 at 15:04
  • Are you sure it hangs on this instruction? That's very unlikely. It could crash if `pCtx` points to an invalid address. But not hanging. Why do you think it's this instruction? – Codo Jul 27 '21 at 15:08
  • It is likely that `pCtx->pOutput` is an invalid pointer. First try `*(char *)pCtx->pOutput = *(char *)pCtx->pOutput + 1`. If that works, next try `double d; memmove(&d, pCtx->pOutput, sizeof(double)); d += pInput->dsum; memmove(pCtx->pOutput, &d, sizeof(double));`. (Or use a `union`.) – Steve Summit Jul 27 '21 at 17:39

2 Answers2

1

I guess it must be a memory align issue. You can check if the memory address of pCtx->pOutput. If it is not a 4-byte value, it would lead a bus error as the ARM assembly instruction vstr requires.

A quick solution could be using a temporary variable to make the value to be stored the assign the temporary variable's value to the target address.

Shuduo
  • 727
  • 5
  • 14
0

You may want to try TickTock (https://github.com/ytyou/ticktock), a lightweight TSDB. We have tested it in RPi zero wireless (32bit).

Disclaimer: I am co-author of TickTock. It is still being stress-test and not in production yet.

Lin
  • 41
  • 2