From 5cde12ca405f988a8a35b4281c90fbaf53f5464f Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 21 Jan 2011 14:20:45 +1030 Subject: [PATCH 1/1] lca2011: dump talloc tree in child. Avoids stopping the entire server just for debug dumps. --- ccan/oserver/oserver.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ccan/oserver/oserver.c b/ccan/oserver/oserver.c index c7a523c..ad8f315 100644 --- a/ccan/oserver/oserver.c +++ b/ccan/oserver/oserver.c @@ -314,10 +314,16 @@ static void talloc_dump(struct tevent_context *ev, void *_oserver) { struct oserver *oserver = _oserver; - FILE *f = fopen("/var/run/oserver/talloc.dump", "w"); - if (f) { - talloc_report_full(oserver, f); - fclose(f); + FILE *f; + + /* Fork off a child for the report, so we aren't stopped. */ + if (fork() == 0) { + f = fopen("/var/run/oserver/talloc.dump", "w"); + if (f) { + talloc_report_full(oserver, f); + fclose(f); + } + _exit(0); } } -- 2.39.2