I am trying to debug issues related to a patch I am writing for neovim, and I would like to generate a coredump on failure, I have the following nix-config.
systemd.coredump.enable = true;
systemd.coredump.extraConfig = ''
'';
When my neovim binary crashes, I get a Resource limits disable core dumping for process 3385
in the logs.
Now that’s the tricky part, if I run ulimit
in my nix-shell -A neovim-unwrapped
, all looks good
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) 95922
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
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) 95922
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
Now, if I start my just built binary build/bin/nvim -u NONE
and do :echo getpid()
and check this instance limits I get
$ cat /proc/26312/limits ~
Limit Soft Limit Hard Limit Units
Max cpu time unlimited unlimited seconds
Max file size unlimited unlimited bytes
Max data size unlimited unlimited bytes
Max stack size 8388608 unlimited bytes
Max core file size 0 unlimited bytes
Max resident set unlimited unlimited bytes
Max processes 95922 95922 processes
Max open files 1024 524288 files
Max locked memory 65536 65536 bytes
Max address space unlimited unlimited bytes
Max file locks unlimited unlimited locks
Max pending signals 95922 95922 signals
Max msgqueue size 819200 819200 bytes
Max nice priority 0 0
Max realtime priority 0 0
Max realtime timeout unlimited unlimited us
as you can see Max core file size
is 0 while it was unlimited before I started the binary.
I don’t know why/how the core file size was set to 0 when I launched nvim. Any idea what systemd trick is involved ? I would like to keep the core file size to unlimited.