c++nginxcoredumpspawn-fcgi

I run `"crash_demo.run"` by `spawn-fcgi` . How to collect `core` file


1. Question

I run "crash_demo.run" by spawn-fcgi . How to collect core file .

2. Background & Environment

I'm exolore C++ Web Programming .

  1. web-server : nginx
  2. CGI(FastCGI) : fastcgipp 3.0
  3. CGI Wrapper : spawn-fcgi
    • I didn't use FCGI Wrap which ngifix supplied .
    • I understand FCGI Wrap be drive by spawn-fcgi , Of course this is off topic .
  4. My c++ application . (be called crash_demo) .

3. Step to reproduce exception

  1. crash_demo insert code throw "test exception str, check _core_ file" , build got crash_demo.run
  2. run nginx : sudo nginx -c my_nginx_custom.config
  3. ulimit -c unlimited
  4. run crash_demo.run by spawn-fcgi : spawn-fcgi -a 127.0.0.1 -p 9000 -f /path/crash_demo.run
  5. test the normal http request , and http request can be completed normally .
  6. test the crash_demo http request , got 5xx response .
    • The directory where crash_demo.run is located does not see the core file

My guess

  1. core file not generate .
  2. core file is generated , but i don't the file path .

Does anyone know what happened?



Solution update

My question is flawed .

Thanks @sehe , my step :

  1. I read two webpage
    1. https://man7.org/linux/man-pages/man5/core.5.html
    2. https://zhuanlan.zhihu.com/p/240633280
  2. update my /proc/sys/kernel/core_pattern
    • core -> core_%e_%p_%t
  3. ulimit -c unlimited
  4. spawn-fcgi -a 127.0.0.1 -p 9000 -f /path/crash_demo.run
  5. sudo find / core_ | grep core_crash_demo
    • result /path/core_crash_demo._5080_1652169152

So , my guess on my question is failed .

The fact is , I don't generate core file , when my question.

When my generated core file successed , the core file path is crash_demo.run parent directory .



Solution update 2

we whant to know two point :

  1. how generate core dump file
  2. how to fine exception code by core dump file

how generate core dump file?

Reference the file : core manual

core manual write many point , I just list the point i care :

  1. system limit core dump file size , we need unlimit it:
  1. fix /proc/sys/kernel/core_pattern

now run your exception , you can got core file .

how to fine exception code by core dump file ?


Solution

  • This question is probably more for askubuntu.com or serverfault.stackexchange.com.

    You likely need to configure core dump. Since we don't know the platform, I'm assuming likely a Linux. See e.g. core(5):

    There are various circumstances in which a core dump file is not produced

    In my experience what's required is setting a core pattern (/proc/sys/kernel/core_pattern)