Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
younes199511 opened this issue Mar 11, 2024 · 2 comments · Fixed by #2708

Comments

@younes199511
Copy link

younes199511 commented Mar 11, 2024

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

@ngjaying
Copy link
Collaborator

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

@younes199511
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants