Search code examples
clinuxtime-seriesarmtdengine

getting value from a pointer which point to double data and assign to a variable led system hang on ARM32 platform


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?


Solution

  • 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.