From 2198bf377dd91400513d303c9a11f07eefaecfbd Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 8 Jul 2019 05:34:46 -0700 Subject: [PATCH 1/2] debug: copy ipfs binary as well --- bin/collect-profiles.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/collect-profiles.sh b/bin/collect-profiles.sh index e1f80cd32c9..ca336e51b91 100644 --- a/bin/collect-profiles.sh +++ b/bin/collect-profiles.sh @@ -8,6 +8,11 @@ tmpdir=$(mktemp -d) export PPROF_TMPDIR="$tmpdir" pushd "$tmpdir" +IPFS_BIN=$(which ipfs) +if [[ -e "$IPFS_BIN" ]]; then + cp "$IPFS_BIN" ipfs +fi + echo Collecting goroutine stacks curl -o goroutines.stacks "http://$HTTP_API"'/debug/pprof/goroutine?debug=2' From 20f7ce8508274c73f81ead5e15f475675a3137e8 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 8 Jul 2019 05:34:48 -0700 Subject: [PATCH 2/2] debug: document the debug script fixes #6457 --- docs/debug-guide.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/debug-guide.md b/docs/debug-guide.md index 9ef046a47e1..170e58254b5 100644 --- a/docs/debug-guide.md +++ b/docs/debug-guide.md @@ -15,6 +15,11 @@ When you see ipfs doing something (using lots of CPU, memory, or otherwise being weird), the first thing you want to do is gather all the relevant profiling information. +There's a script (`bin/collect-profiles.sh`) that will do this for you and +bundle the results up into a tarball, ready to be attached to a bug report. + +If you feel intrepid, you can dump this information and investigate it yourself: + - goroutine dump - `curl localhost:5001/debug/pprof/goroutine\?debug=2 > ipfs.stacks` - 30 second cpu profile @@ -26,10 +31,6 @@ profiling information. - system information - `ipfs diag sys > ipfs.sysinfo` -Bundle all that up and include a copy of the ipfs binary that you are running -(having the exact same binary is important, it contains debug info). - -You can investigate yourself if you feel intrepid: ### Analyzing the stack dump