[4.1] e3e340d Trigger the panic dump handler also on sigabrt

Martin Blix Grydeland martin at varnish-software.com
Fri Sep 4 15:54:52 CEST 2015


commit e3e340d58faaa8bfb2eeed02861cb4b8be328715
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Tue Aug 4 10:54:54 2015 +0200

    Trigger the panic dump handler also on sigabrt
    
    This allows for a panic dump and backtrace to be produced on
    sigabrt. This is useful e.g. when using jemalloc's debug flags, which
    can through a special environment variable enable memory allocation
    consistency checks and trigger sigabrt on errors.

diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index 5a8a59a..e20f668 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -465,6 +465,9 @@ pan_ic(const char *func, const char *file, int line, const char *cond,
 	memset(&sa, 0, sizeof sa);
 	sa.sa_handler = SIG_DFL;
 	(void)sigaction(SIGSEGV, &sa, NULL);
+	/* Set SIGABRT back to default so the final abort() has the
+	   desired effect */
+	(void)sigaction(SIGABRT, &sa, NULL);
 
 	switch(kind) {
 	case VAS_WRONG:
diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c
index 3a6890a..69c90d8 100644
--- a/bin/varnishd/mgt/mgt_child.c
+++ b/bin/varnishd/mgt/mgt_child.c
@@ -384,6 +384,7 @@ mgt_launch_child(struct cli *cli)
 			sa.sa_flags = SA_SIGINFO;
 			(void)sigaction(SIGSEGV, &sa, NULL);
 			(void)sigaction(SIGBUS, &sa, NULL);
+			(void)sigaction(SIGABRT, &sa, NULL);
 		}
 		(void)signal(SIGINT, SIG_DFL);
 		(void)signal(SIGTERM, SIG_DFL);



More information about the varnish-commit mailing list