[Tutorial] - how to get meaningful crash reports - linux server
#1

First install GDB - gnu debugger on your server.
Then create a runserver.sh file with these 3 lines:

Код:
echo 0 | gdb -batch-silent -ex "run" -ex "set logging overwrite on" -ex "set logging file last_crash.log" -ex "set logging on" -ex "set pagination off" -ex "handle SIG33 pass nostop noprint" -ex "echo backtrace:\n" -ex "backtrace full" -ex "echo \n\nregisters:\n" -ex "info registers" -ex "echo \n\ncurrent instructions:\n" -ex "x/16i \$pc" -ex "echo \n\nthreads backtrace:\n" -ex "thread apply all backtrace" -ex "echo \n\nMemory map:\n" -ex "info files" -ex "set logging off" -ex "quit" samp03svr
date >> crash.log
cat last_crash.log >> crash.log
Mark the file as executable and run the .sh file instead of samp03svr directly:

Код:
user@host:~/samp03$ ./runserver
The server will run in GDB with a script that will generate EXCELLENT crash reports, you are encouraged to always use this method to run your server.

These crash reports will be greatly superior to anything else and will be of much more help when analyzing what happened when your server crashes and what caused it.

The script will generate last_crash.log and crash.log - crash.log contains a history of all crashes and last_crash contains the last crash report that happenes.

You can also add core dumps support by adding "-ex "generate-core-file"" before "-ex "set logging off"".
Core dumps can be a few-100 mb big but they allow you to do additional analysis of a crash by a skilled programmer after the crash had happened.
Reply
#2

wtf, I paid for help now you go and post your help. just my luck

Also, I'd like to add to the tutorial that you should use the following command to get the log: "kill -s SIGTERM PID"

You can get the PID for the server from typing "ps x".
Reply
#3

KyleSmith: a kill is only needed to FORCE a crash log entry if server is stuck in a infinite loop - you had that happen and that's a very special condition.

This is tutorial for when the server crashes normally (like a bad plugin, etc..)
Reply
#4

you must You can get the PID for the server from typing "ps x".
Reply
#5

or just install and use htop for finding the process id, much easier.

is last_crash.log same as crash.log? from looking at your code, it probs is like that altho i'll conduct further tests and let you know the results.
Reply
#6

Quote:
Originally Posted by Sublime
Посмотреть сообщение
or just install and use htop for finding the process id, much easier.

is last_crash.log same as crash.log? from looking at your code, it probs is like that altho i'll conduct further tests and let you know the results.
No, last_crash is the LAST recorded crash log file, the file is concated to crash.log (which stores all crash logs and adds new ones to the end).
Reply
#7

Quote:
Originally Posted by JernejL
Посмотреть сообщение
No, last_crash is the LAST recorded crash log file, the file is concated to crash.log (which stores all crash logs and adds new ones to the end).
Figured that out, can a sample log be provided for normal interpretation attempt?
Reply
#8

Thanks for this
Reply
#9

Thanks
Reply
#10

Thankss.
Reply
#11

thanks
Reply
#12

Perfect job ... thanks
Reply
#13

Sorry for late bump, this will detect mysql/streamer crash(plugins) ?
Reply
#14

Good post, I guess I've seen it somewhere else too :/
Reply
#15

Okay, i'll bump an extremely old thread.

I ran it this way, got my last_crash.log got my hex editor and my .amx open. So what now? None of the addresses in last_crash.log have any meaning in my .amx.. Most of them are actually to high. Am I doing it wrong?
Reply
#16

Perfect job ...
Reply
#17

nice man
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)