ianlancetaylor / libbacktrace

A C library that may be linked into a C/C++ program to produce symbolic backtraces
Other
944 stars 220 forks source link

Getting null values in backtrace #94

Closed adarshprakash closed 1 month ago

adarshprakash commented 2 years ago

In some of the machines in production, I am not able to generate proper backtrace information for segmentation faults. Getting the following backtrace with null values.

1 # fault_logger[0x7f024478f4d6] at src/fault_logger.c:273 2 # (null)[0x7f024ba055cf] at (null):0 3 # (null)[0x7f024b019463] at (null):0 4 # (null)[0x6fce74] at (null):0 5 # (null)[0x6fcb9c] at (null):0 6 # (null)[0x791875] at (null):0 7 # (null)[0x5dff2e] at (null):0 8 # (null)[0x60a694] at (null):0 9 # (null)[0x5e63ec] at (null):0 10# (null)[0x721099] at (null):0 11# (null)[0x720cd7] at (null):0 12# (null)[0x71fdf2] at (null):0 13# (null)[0x71dea2] at (null):0 14# (null)[0x6ae633] at (null):0 15# (null)[0x6add6f] at (null):0 16# (null)[0x6ab2cb] at (null):0 17# (null)[0x629e40] at (null):0 18# (null)[0x7f024af3d3d4] at (null):0 19# (null)[0x477198] at (null):0 20# (null)[0xffffffffffffffff] at (null):0

OS : CentOS Linux 7 (Core) Machine Architecture: x86_64

We are getting this problem in only some of the machines. Other machines with the same OS and architecture are not getting this error.

We have been bundling libbacktrace along with our application shared library. The core lines of the backtrace dump function are as follows:

int fd = open(backtrace_file_path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);

BacktraceContext context = {0}; context.frameIndex = 0; context.backtraceFileFd = fd;

write_pid(fd); backtrace_full(backtraceState, 0, backtrace_callback, backtraceErrorReporter, &context);

close(fd);

Am I doing anything wrong here? Or it could be because any package is not installed correctly?

ianlancetaylor commented 2 years ago

If this problem happens consistently on some machines but not on others, then it seems that there must be some difference between the machines.

The most likely cause of this problem is a failure to find the debug information. Is the debug information present in your executable, or is it stored somewhere else? If stored somewhere else, then where?

ianlancetaylor commented 1 month ago

This is normal when there is no debug info, so closing. Please comment if you disagree.