#!/usr/bin/env bash # Reproduces the dump/stop duplication trap documented in # docs/output/09-dump-duplication-bug.txt. Do not copy this pattern. # # Usage: scripts/reproduce-dump-bug.sh set -euo pipefail cd "$(dirname "$0")/.." PID="${1:?usage: reproduce-dump-bug.sh }" mkdir -p recordings DEST="$(pwd)/recordings/dump-duplication-bug.jfr" jcmd "$PID" JFR.start name=live settings=profile filename="$DEST" maxsize=256m scripts/load.sh all # BUG: dumping to the SAME path the recording is already configured to write to... jcmd "$PID" JFR.dump name=live filename="$DEST" # ...then stopping with no filename, which falls back to that same path. jcmd "$PID" JFR.stop name=live echo "wrote $DEST -- every event in it is duplicated. See docs/output/09-dump-duplication-bug.txt"