Python Server "Interrupted (Core dumped)"

I use web.py to create a Python web server. This server is called to solve linear programming problems, and the CBC library is used for this.

From time to time, the server crashes with a log that looks like this:

78.243.184.3:56271 - - [03/Jun/2016 04:35:54] "HTTP/1.1 GET /optimization" - 200 OK Aborted (core dumped) 

I believe that "Aborted (core dumped)" is a C error, so it comes from either web.py or CBC.

Is there a way to track the source of the error?

+6
source share
2 answers

A core dump is caused by an error in the native code of your web server. Python is pretty solid these days, so such errors are almost always caused by errors in C extensions in my experience.

You have 3 problems.

  • You need to find the kernel dump file. Usually this is in the current working directory of the process that is being reset. However, there are options that can change this .

  • You need to debug the call stack because it failed. This is described in StackOverflow - see How to parse a program dump file using gdb?

  • You may need to associate the Python interpreter stack with the Python code you were running. To do this, you will need to install Python debugging symbols and Python extensions for gdb. The Python wiki has some good tips on how to do this here .

+4
source

The most common reason for a Core dump is to access a memory address outside of your reach (memory that does not belong to your program). The operating system interrupts the program with an interrupt called SegFault or BusError, depending on how the program tried to access an invalid memory address. Then the program will be forcedly closed by the kernel. If the kernel is configured to create a core dump (memory dump and program stack), then it will be saved to disk. As indicated in another answer, you can load the core dump into GDB or another debugger and show what the program was doing when it crashed. This may or may not give you a problem. It is usually difficult, even for an experienced programmer, to use these tools, so keep in mind. If you want to try using GDB, try the following:

$ gdb / path / to / crashing / program / binary / path / to / core

(gdb) bt

'bt' will display โ€œbacktracksโ€, otherwise known as StackTraces, and may be useful for the programmer to track the error.

If you can reproduce the error, you are probably lucky by sending a detailed error report to the creator of this program. Even I, as a senior software developer, take this route from time to time. :-)

0
source

All Articles