Is there any way to connect to MySQL/ Postgres databases through Envoy Lua filters? Using Lua client libraries would not work and it gives
Caught Segmentation fault, suspect faulting address 0x4c0d0. I have tried multiple MySQL and Postgres client libraries which seem to work perfectly fine in other Lua environments with the same versions, outside Envoy. Here is the
envoy.yaml of
pgmoon and
luasql libraries I tried within Envoy.
Here are the error log for your reference:
2024-07-16 20:53:36 [2024-07-16 15:23:36.570][1][critical][backtrace] [./source/server/backtrace.h:127] Caught Segmentation fault, suspect faulting address 0x4c0d0
2024-07-16 20:53:36 [2024-07-16 15:23:36.570][1][critical][backtrace] [./source/server/backtrace.h:111] Backtrace (use tools/stack_decode.py to get line numbers):
2024-07-16 20:53:36 [2024-07-16 15:23:36.570][1][critical][backtrace] [./source/server/backtrace.h:112] Envoy version: 816188b86a0a52095b116b107f576324082c7c02/1.30.1/Clean/RELEASE/BoringSSL
2024-07-16 20:53:36 [2024-07-16 15:23:36.570][1][critical][backtrace] [./source/server/backtrace.h:114] Address mapping: 5607f017c000-5607f3b5b000 /envoy
2024-07-16 20:53:36 [2024-07-16 15:23:36.570][1][critical][backtrace] [./source/server/backtrace.h:121] #0: [0x7f8ab1f7d320]
The segmentation fault error comes while either trying to import these libraries or while trying to make connections to the database in some instances (note that the library paths are being correctly recognized). Surprisingly Redis client libraries seem to work fine and are able to make connections.
What could be the issue and please suggest any ways to connect to MySQL database instances within the Envoy Lua scripting section with sample code or projects if possible (I am trying out custom rate limiting algorithms through Lua and this is a huge blocker).
Thank you.