From 0316abc7d69017340dbeedc0be5f349225b8691b Mon Sep 17 00:00:00 2001 From: Oli Evans Date: Tue, 24 Sep 2019 11:06:23 +0100 Subject: [PATCH 1/2] fix: make collect-profiles.sh work on mac The version of `date` that ships with darwin does not support the `-Iseconds` flag. Use a pattern with `date` to achieve the same thing but should have better cross platform support. License: MIT Signed-off-by: Oli Evans --- bin/collect-profiles.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) mode change 100644 => 100755 bin/collect-profiles.sh diff --git a/bin/collect-profiles.sh b/bin/collect-profiles.sh old mode 100644 new mode 100755 index ca336e51b..ad7b50211 --- a/bin/collect-profiles.sh +++ b/bin/collect-profiles.sh @@ -36,9 +36,5 @@ echo "Disabling mutex profiling" curl -X POST -v "http://$HTTP_API"'/debug/pprof-mutex/?fraction=0' popd -tar cvzf "./ipfs-profile-$(uname -n)-$(date -Iseconds).tar.gz" -C "$tmpdir" . +tar cvzf "./ipfs-profile-$(uname -n)-$(date +'%Y-%m-%dT%H:%M:%S%z').tar.gz" -C "$tmpdir" . rm -rf "$tmpdir" - - - - From 75240599c9c1cbca7f9cebe2fd9ac3705e8a9ad8 Mon Sep 17 00:00:00 2001 From: Oli Evans Date: Tue, 24 Sep 2019 11:20:32 +0100 Subject: [PATCH 2/2] fix: prefer 127.0.0.1 With an empty API headers config like ```js "API": { "HTTPHeaders": {} }, ``` running collect-profiles.sh shows connection errors when trying to POST to `/debug/pprof-mutex/` end point when using `localhost`. The same errors do not occur when using `127.0.0.1` License: MIT Signed-off-by: Oli Evans --- bin/collect-profiles.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/collect-profiles.sh b/bin/collect-profiles.sh index ad7b50211..24540e3f2 100755 --- a/bin/collect-profiles.sh +++ b/bin/collect-profiles.sh @@ -3,7 +3,7 @@ set -x set -euo pipefail IFS=$'\n\t' -HTTP_API="${1:-localhost:5001}" +HTTP_API="${1:-127.0.0.1:5001}" tmpdir=$(mktemp -d) export PPROF_TMPDIR="$tmpdir" pushd "$tmpdir"