Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug seg fault in docker container?

I'm running ESLint - a linter for javascript files - in a container: https://github.com/codeclimate/codeclimate-eslint

The program runs the ESLint cli analyze command and provides a directory of code to analyze mounted as a volume in the container.

The program captures the ESLint results and reformats them, then re-outputs to STDOUT.

Normally this works fine, but in the face of very large number of issues in single files - e.g. minified files - the process segfaults. The only error provided: Segmentation fault

Since running ESLint natively by itself on the same code base does not, I attribute the cause to something related to the containerization.

I've experimented with significantly upping the memory and --ulimit on container to no avail. I've also done some googling but not found a specific case that sounds similar.

Any ideas for a good next steps on debugging this issue?

Thanks!

like image 513
abaldwinhunter Avatar asked Oct 21 '25 11:10

abaldwinhunter


1 Answers

You can permit core files by running ulimit -c unlimited in a script that launches your app. Then you can process the core file with a debugger (e.g. gdb) to find the cause of the segfault. To get the core file out of a stopped container, there's docker cp $container_id:/path/to/core /host/destination/core.

like image 187
BMitch Avatar answered Oct 23 '25 01:10

BMitch



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!