From 195a86845509a11760d6c85e9d9ba63d5e3ca40e Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Mon, 15 Apr 2019 16:28:01 +0200 Subject: [PATCH] lntest: add flag -goroutinedump --- lntest/harness.go | 5 +++++ lntest/node.go | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lntest/harness.go b/lntest/harness.go index 210af104b..317271c23 100644 --- a/lntest/harness.go +++ b/lntest/harness.go @@ -652,6 +652,11 @@ func (n *NetworkHarness) StopNode(node *HarnessNode) error { // SaveProfilesPages hits profiles pages of all active nodes and writes it to // disk using a similar naming scheme as to the regular set of logs. func (n *NetworkHarness) SaveProfilesPages() { + // Only write gorutine dumps if flag is active. + if !(*goroutineDump) { + return + } + for _, node := range n.activeNodes { if err := saveProfilesPage(node); err != nil { fmt.Println(err) diff --git a/lntest/node.go b/lntest/node.go index b01a175fe..53caec466 100644 --- a/lntest/node.go +++ b/lntest/node.go @@ -80,7 +80,12 @@ var ( // logOutput is a flag that can be set to append the output from the // seed nodes to log files. logOutput = flag.Bool("logoutput", false, - "log output from node n to file outputn.log") + "log output from node n to file output-n.log") + + // goroutineDump is a flag that can be set to dump the active + // goroutines of test nodes on failure. + goroutineDump = flag.Bool("goroutinedump", false, + "write goroutine dump from node n to file pprof-n.log") ) // generateListeningPorts returns three ints representing ports to listen on