lf-edge / ekuiper

Lightweight data stream processing engine for IoT edge

Home Page:https://ekuiper.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash due to excessive memory usage when using lpad/rpad functions with large numeric values

younes199511 opened this issue · comments

Environment:

  • eKuiper version: 1.12.7
  • Hardware configuration: Intel-I7, 8 GB RAM
  • OS: Alpine docker running on Ubuntu 22.04 host

What happened and what you expected to happen:
When using the lpad and rpad functions with a large numeric value as the argument in eKuiper, the application crashes due to excessive memory usage. This issue arises when the specified argument is exceptionally large, causing eKuiper to consume an excessive amount of memory, ultimately leading to a crash. To address this, a potential fix could be to implement a validation check within the lpad and rpad functions to throw an error when the second argument exceeds a certain size, thus preventing excessive memory consumption and subsequent crashes.

In my use case i was collecting data with EdgeX and i eKuiper i have a simple rule that uses function rpad(A,B) with twa variables. Some times the B variable value is very large and ekuiper crashes due to excessive memory usage

How to reproduce it (as minimally and precisely as possible):
SELECT lpad(A,B) as comp_result from source where B is a very large number
Or SELECT rpad(A,125012521102) as comp_result from source

How to decide the threshold? Maybe you can do it by a filter like: SELECT lpad(A,B) as comp_result from source WHERE B < 999999

I agree with you, there is no logical way to define the threshold but i thought you may want to document this behavior