postgres-operator icon indicating copy to clipboard operation
postgres-operator copied to clipboard

How to set ulimit (stack size) with a larger value

Open Eric-zch opened this issue 1 year ago • 1 comments

Hi There, The current setting of ulimit stack size is 8MB in crunchy postgres pod. Is there any easy way to set this value to a larger one (16MB)

bash-4.4$ ulimit -a
core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 257447
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1048576
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 514894
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

Thank you.

Eric-zch avatar Feb 16 '24 09:02 Eric-zch

Hi @Eric-zch. Thanks for reaching out. To help me understand your issue a bit better, are you hitting a specific problem in your environment due to the default size setting? For example, #2532 specifically deals with ulimit updates in light of core file behavior.

tjmoore4 avatar Feb 20 '24 19:02 tjmoore4

Hi @tjmoore4 I had this error when I called a stored procedure in postgresql database

Exception caught : org.postgresql.util.PSQLException: ERROR: stack depth limit exceeded
  Hint: Increase the configuration parameter "max_stack_depth" (currently 4096kB), after ensuring the platform's stack depth limit is adequate.

I think this is due to recursive calls coded in the stored procedure. After modifying the max_stack_depth to 7MB, we get the same error but now with "max_stack_depth" (currently 7168kB). So I am checking if ulimit -s can be modified easily in Crunchy postgres.

I will refer to issue 2532 to build my docker image.

Thank you.

Eric-zch avatar Feb 26 '24 03:02 Eric-zch