Assertion and panic, print crash log without generating SIGSEGV#7585
Assertion and panic, print crash log without generating SIGSEGV#7585oranagra merged 2 commits intoredis:unstablefrom oranagra:assert_no_segfault
Conversation
|
@oranagra can you please attach examples of:
|
|
here are examples using the DEBUG command. |
|
anyone got any clue why Salvatore bothered to save the assertion info in variables and print them for a second time from within the signal handler? i fear i may be overlooking something. |
|
One disadvantage of this approach is that it's not possible to generate a core dump on assertions. |
src/debug.c
Outdated
There was a problem hiding this comment.
@oranagra consider making this static (maybe a good opportunity to make other func defs in this file static as well).
src/debug.c
Outdated
There was a problem hiding this comment.
@oranagra Did you intentionally move the backtrace down? In extreme cases with stack all messed up it may make a difference (capturing it as early as we can). Not sure....
There was a problem hiding this comment.
i moved it since i wanted to make use of the trace array for the first call to backtrace_symbols_fd and still not do trace+1 for the call second call (cleanup). but ended up using the eip argument as input for the first call, so i can undo this now.
src/debug.c
Outdated
There was a problem hiding this comment.
i moved it since i wanted to make use of the trace array for the first call to backtrace_symbols_fd and still not do trace+1 for the call second call (cleanup). but ended up using the eip argument as input for the first call, so i can undo this now.
|
@oranagra I think the sole purpose of pushing stuff through BTW maybe using |
|
@yossigo If the first thing _serverAssert does is collect stack trace, why would it be better to raise a signal and catch it there? i feel it might be the other way around (the signal messes up the trace a bit). in order to silence these assertions in valgraind i must use |
|
ohh, i misunderstood you.. you where talking about corrupting the "caller's" stack for the code dump, not about the stack trace. |
|
squash-pushed a new commit with some code review fixes are these new config options:
|
This makes it possible to add tests that generate assertions, and run them with valgrind, making sure that there are no memory violations prior to the assertion. New config options: - crash-log-enabled - can be disabled for cleaner core dumps - crash-memcheck-enabled - useful for faster termination after a crash - use-exit-on-panic - to be used by the test suite so that valgrind can detect leaks and memory corruptions Other changes: - Crash log is printed even on system that dont HAVE_BACKTRACE, i.e. in both SIGSEGV and assert / panic - Assertion and panic won't print registers and code around EIP (which was useless), but will do fast memory test (which may still indicate that the assertion was due to memory corrpution) I had to reshuffle code in order to re-use it, so i extracted come code into function without actually doing any changes to the code: - logServerInfo - logModulesInfo - doFastMemoryTest (with the exception of it being conditional) - dumpCodeAroundEIP changes to the crash report on segfault: - logRegisters is called right after the stack trace (before info) done just in order to have more re-usable code - stack trace skips the first two items on the stack (the crash log and signal handler functions)
this race would only happen when two threads paniced at the same time, and even then the only consequence is some extra log lines. race reported in #7391
This makes it possible to add tests that generate assertions, and run
them with valgrind, making sure that there are no memory violations
prior to the assertion.
New config options:
detect leaks and memory corruptions
Other changes:
both SIGSEGV and assert / panic
was useless), but will do fast memory test (which may still indicate
that the assertion was due to memory corrpution)
I had to reshuffle code in order to re-use it, so i extracted come code
into function without actually doing any changes to the code:
changes to the crash report on segfault:
just in order to have more re-usable code
signal handler functions)