-
Notifications
You must be signed in to change notification settings - Fork 11
chaos: vthread-context-cascade antagonist + glibc heap-corruption defaults #642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jbachorik
wants to merge
34
commits into
main
Choose a base branch
from
jb/vt_churn
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,196
−209
Open
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
99699e0
Add vthread-context-cascade chaos antagonist; default MALLOC_CHECK_/M…
jbachorik 0b03bba
Exclude J9 from MALLOC_CHECK_ default test env
jbachorik 4dce8c6
Reference PROF-15360 in J9 MALLOC_CHECK_ exclusion comment
jbachorik 8565ed8
Merge branch 'main' into jb/vt_churn
jbachorik 4e3c9ca
Fix isRawPointer() false-positive on unencoded ASGCT BCIs (PROF-15364)
jbachorik d17272e
chaos: wire vthread-context-cascade into ANTAGONISTS lists
jbachorik e1dd0fb
ci(chaos): enable NativeMemoryTracking=summary for OOM diagnosis
jbachorik 3673735
chaos: fix stale-racer wake timing and stopGracefully timeout budget
jbachorik 17c3771
chaos: fix vthread-context-cascade NoClassDefFoundError by driving co…
jbachorik 0bfeed0
chaos: fail fast on missing RUNTIME argument
jbachorik 3e379a7
Merge branch 'main' into jb/vt_churn
jbachorik bf5c239
chaos: standalone harness script + debug-only stale-carrier UAF watchdog
jbachorik 723aa71
Merge branch 'main' into jb/vt_churn
jbachorik b71ca62
Remove debug-only UAF watcher causing ASan/TSan failures
jbachorik 1d054cc
Drop stale J9 MALLOC_CHECK_ skip (PROF-15360 fixed as PROF-15364)
jbachorik 66478fb
Merge branch 'main' into jb/vt_churn
jbachorik fb6a1e8
chaos: restore Maven jar fallback, drop vthread-context-cascade from …
jbachorik c7bf65c
chaos: grant jdk.internal.misc export so OtelContextStorage uses CARR…
jbachorik 2e34507
Merge origin/main into jb/vt_churn
Copilot cfe1245
chaos: tune gmalloc/jemalloc decommit to fix aarch64 chaos OOMs
jbachorik 33a8f3d
chaos: log cgroup memory limit and trim aarch64 heap to stop OOMKills
jbachorik 37276d3
Merge origin/main into jb/vt_churn
Copilot 944fa81
Clarify merged FrameType raw-pointer guards
Copilot 8254e49
Harden FrameType VM test cleanup
Copilot 17d0792
chaos: clean stale JFR chunk dir and log /tmp disk usage
jbachorik be3c3bf
chaos: raise Xmx to 2.5GiB, drop aarch64 heap trim
jbachorik ae3daa1
chaos: add memory-pressure governor, restore Xmx to 2.5GiB
jbachorik 2a3e926
Extend MemoryGovernor to heap usage and 5 more antagonists; bump chao…
jbachorik d1f2a0f
Gate DirectMemoryAntagonist.burstLoop() on governor; log throttle tra…
jbachorik 2ef0fd2
Add critical watermark + GC nudge to chaos MemoryGovernor
jbachorik 08390ce
Speed up governor reaction time, exit cleanly on first heap OOME
jbachorik 68ceb93
Tolerate a late clean heap OOME, still fail an early one
jbachorik 8c1402d
Bound in-flight virtual threads in VirtualThreadChurnAntagonist
jbachorik 9ef1d89
Guard chaos harness malloc checking and gate hotspot in raw-pointer test
jbachorik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,178 +1,17 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set +e # Disable exit on error | ||
| # | ||
| # CI entry point for the chaos harness. Thin wrapper around | ||
| # utils/run-chaos-harness.sh — this file only supplies the CI-specific | ||
| # caching paths (so repeated scheduled runs on the same runner reuse the | ||
| # downloaded JDK/agent jar) and the fixed hs_err.log location the pipeline's | ||
| # `artifacts:` block expects at the repo root. All the actual build/run logic | ||
| # lives in the standalone script, which is also runnable by hand. | ||
|
|
||
| HERE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
| ROOT="$( cd "${HERE}/../.." >/dev/null 2>&1 && pwd )" | ||
|
|
||
| RUNTIME=${1} | ||
| CONFIG=${2:-profiler+tracer} | ||
| ALLOCATOR=${3:-gmalloc} | ||
|
|
||
| echo "Chaos run: runtime=${RUNTIME}s config=${CONFIG} allocator=${ALLOCATOR}" | ||
|
|
||
| CHAOS_JDK="${CHAOS_JDK:-21.0.3-tem}" | ||
| # CHAOS_JDK uses sdkman notation (<version>-<dist>); extract major for Adoptium API. | ||
| JDK_MAJOR="${CHAOS_JDK%%.*}" | ||
| JDK_ARCH=$(uname -m | sed 's/x86_64/x64/') | ||
| JDK_INSTALL_DIR="/opt/jdk-${CHAOS_JDK}" | ||
|
|
||
| if [ ! -x "${JDK_INSTALL_DIR}/bin/java" ]; then | ||
| TMP=$(mktemp -d) | ||
| DL_URL="https://api.adoptium.net/v3/binary/latest/${JDK_MAJOR}/ga/linux/${JDK_ARCH}/jdk/hotspot/normal/eclipse" | ||
| echo "Downloading JDK ${CHAOS_JDK} (major ${JDK_MAJOR}) from Adoptium..." | ||
| if ! curl -fsSL --max-time 300 "${DL_URL}" -o "${TMP}/jdk.tar.gz"; then | ||
| echo "FAIL:JDK ${CHAOS_JDK} download failed" >&2 | ||
| rm -rf "${TMP}" | ||
| exit 1 | ||
| fi | ||
| mkdir -p "${JDK_INSTALL_DIR}" | ||
| tar -xzf "${TMP}/jdk.tar.gz" -C "${JDK_INSTALL_DIR}" --strip-components=1 | ||
| rm -rf "${TMP}" | ||
| fi | ||
|
|
||
| if [ ! -x "${JDK_INSTALL_DIR}/bin/java" ]; then | ||
| echo "FAIL:JDK ${CHAOS_JDK} not available after install" >&2 | ||
| exit 1 | ||
| fi | ||
| export JAVA_HOME="${JDK_INSTALL_DIR}" | ||
| export PATH="${JAVA_HOME}/bin:${PATH}" | ||
| ACTIVE_JDK=$(java -version 2>&1 | head -1) | ||
| # Check major version only — patch may differ from the Adoptium latest GA. | ||
| if ! echo "${ACTIVE_JDK}" | grep -qE "\"${JDK_MAJOR}\."; then | ||
| echo "FAIL:wrong JDK active (expected major ${JDK_MAJOR}, got: ${ACTIVE_JDK})" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Resolve ddprof.jar: prefer local build artifact, fall back to Maven snapshot. | ||
| # Running mvn from /tmp avoids the empty pom.xml at the repo root. | ||
| DDPROF_JAR_LOCAL=$(ls "${ROOT}/ddprof-lib/build/libs/ddprof-"*.jar 2>/dev/null | head -1) | ||
| if [ -n "${DDPROF_JAR_LOCAL}" ] && [ -f "${DDPROF_JAR_LOCAL}" ]; then | ||
| DDPROF_JAR="${DDPROF_JAR_LOCAL}" | ||
| echo "Using local ddprof jar: ${DDPROF_JAR}" | ||
| else | ||
| if [ -z "${CURRENT_VERSION:-}" ]; then | ||
| echo "FAIL:CURRENT_VERSION is empty and no local jar found (get-versions dotenv missing)" >&2 | ||
| exit 1 | ||
| fi | ||
| echo "Local ddprof jar not found — downloading ${CURRENT_VERSION} from Maven snapshots" | ||
| (cd /tmp && mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get \ | ||
| -DrepoUrl=https://central.sonatype.com/repository/maven-snapshots/ \ | ||
| -Dartifact=com.datadoghq:ddprof:${CURRENT_VERSION}) | ||
| DDPROF_JAR="/root/.m2/repository/com/datadoghq/ddprof/${CURRENT_VERSION}/ddprof-${CURRENT_VERSION}.jar" | ||
| fi | ||
|
|
||
| if [ ! -f "${DDPROF_JAR}" ]; then | ||
| echo "FAIL:ddprof jar unavailable" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| mkdir -p /var/lib/datadog | ||
| wget -q --timeout=120 --tries=3 -O /var/lib/datadog/dd-java-agent.jar 'https://dtdg.co/latest-java-tracer' | ||
|
|
||
| # chaos.jar is produced once per pipeline by the chaos:build job (stresstest | ||
| # stage) and pulled here as an artifact. Fall back to an inline build if the | ||
| # artifact is absent (e.g. local repro outside CI). | ||
| CHAOS_JAR="${ROOT}/ddprof-stresstest/build/libs/chaos.jar" | ||
| if [ ! -f "${CHAOS_JAR}" ]; then | ||
| echo "chaos.jar artifact not present — building inline" | ||
| ( cd "${ROOT}" && ./gradlew :ddprof-stresstest:chaosJar -q ) | ||
| fi | ||
|
|
||
| if [ ! -f "${CHAOS_JAR}" ]; then | ||
| echo "FAIL:chaos.jar unavailable" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Patch dd-java-agent.jar with the locally built ddprof contents so the agent's | ||
| # (relocated) profiler classes match the version under test. | ||
| DD_AGENT_JAR=/var/lib/datadog/dd-java-agent.jar \ | ||
| DDPROF_JAR=${DDPROF_JAR} \ | ||
| OUTPUT_JAR=/var/lib/datadog/dd-java-agent-patched.jar \ | ||
| "${ROOT}/utils/patch-dd-java-agent.sh" | ||
|
|
||
| if [ ! -f /var/lib/datadog/dd-java-agent-patched.jar ]; then | ||
| echo "FAIL:dd-java-agent patching failed" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| PATCHED_AGENT=/var/lib/datadog/dd-java-agent-patched.jar | ||
|
|
||
| case $CONFIG in | ||
| profiler) | ||
| echo "Running with profiler only" | ||
| ENABLEMENT="-Ddd.profiling.enabled=true -Ddd.trace.enabled=false" | ||
| # @Trace is a no-op without the tracer, so trace-context is excluded here. | ||
| ANTAGONISTS="thread-churn,alloc-storm,vthread-churn,classloader-churn,bounded-pool,context-hop,consumer-group,hidden-class-churn,direct-memory,weakref-wave,dump-storm" | ||
| ;; | ||
| profiler+tracer) | ||
| echo "Running with profiler and tracer" | ||
| ENABLEMENT="-Ddd.profiling.enabled=true -Ddd.trace.enabled=true" | ||
| ANTAGONISTS="thread-churn,alloc-storm,vthread-churn,classloader-churn,trace-context,bounded-pool,context-hop,consumer-group,hidden-class-churn,direct-memory,weakref-wave,dump-storm" | ||
| ;; | ||
| *) | ||
| echo "Unknown configuration: $CONFIG" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| case $ALLOCATOR in | ||
| gmalloc) | ||
| echo "Running with gmalloc" | ||
| ;; | ||
| tcmalloc) | ||
| echo "Running with tcmalloc" | ||
| export LD_PRELOAD=$(find /usr/lib/ -name 'libtcmalloc_minimal.so.4') | ||
| # thread-churn/dump-storm antagonists cycle many short-lived threads; | ||
| # tcmalloc's defaults are slow to return their per-thread caches to the | ||
| # OS, which was inflating container RSS past the OOM limit on aarch64. | ||
| export TCMALLOC_RELEASE_RATE=10 | ||
| export TCMALLOC_AGGRESSIVE_DECOMMIT=1 | ||
| ;; | ||
| jemalloc) | ||
| echo "Running with jemalloc" | ||
| export LD_PRELOAD=$(find /usr/lib/ -name 'libjemalloc.so') | ||
| ;; | ||
| *) | ||
| echo "Unknown allocator: $ALLOCATOR" | ||
| echo "Valid values are: gmalloc, tcmalloc, jemalloc" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| echo "LD_PRELOAD=$LD_PRELOAD" | ||
|
|
||
| timeout "$((RUNTIME + 300))" \ | ||
| java -javaagent:${PATCHED_AGENT} \ | ||
| ${ENABLEMENT} \ | ||
| -Ddd.profiling.upload.period=10 \ | ||
| -Ddd.profiling.start-force-first=true \ | ||
| -Ddd.profiling.ddprof.liveheap.enabled=true \ | ||
| -Ddd.profiling.ddprof.alloc.enabled=true \ | ||
| -Ddd.profiling.ddprof.wall.enabled=true \ | ||
| -Ddd.profiling.ddprof.nativemem.enabled=true \ | ||
| -Ddd.env=java-profiler-stability \ | ||
| -Ddd.service=java-profiler-chaos \ | ||
| -Xmx2g -Xms2g \ | ||
| -XX:MaxMetaspaceSize=384m \ | ||
| -XX:ErrorFile=${HERE}/../../hs_err.log \ | ||
| -XX:OnError="${HERE}/../../dd_crash_uploader.sh %p" \ | ||
| -jar ${CHAOS_JAR} \ | ||
| --duration ${RUNTIME}s \ | ||
| --antagonists ${ANTAGONISTS} | ||
|
|
||
| RC=$? | ||
| echo "RC=$RC" | ||
| export CHAOS_JDK_DIR="${CHAOS_JDK_DIR:-/opt/jdk-${CHAOS_JDK}}" | ||
| export CHAOS_WORK_DIR="${CHAOS_WORK_DIR:-/var/lib/datadog}" | ||
| export CHAOS_ERROR_FILE="${ROOT}/hs_err.log" | ||
|
|
||
| if [ $RC -ne 0 ]; then | ||
| CRASH_MSG="Chaos harness crashed (RC=${RC})" | ||
| HS_ERR="${HERE}/../../hs_err.log" | ||
| if [ -f "${HS_ERR}" ]; then | ||
| SIG=$(grep -m1 '^siginfo:' "${HS_ERR}" 2>/dev/null | tr -d '\n' | cut -c1-120) | ||
| FRAME=$(grep -m1 'libjavaProfiler\|AsyncProfiler' "${HS_ERR}" 2>/dev/null | sed 's/^[[:space:]]*//' | tr -d '\n' | cut -c1-120) | ||
| [ -n "${SIG}" ] && CRASH_MSG="${CRASH_MSG};${SIG}" | ||
| [ -n "${FRAME}" ] && CRASH_MSG="${CRASH_MSG};${FRAME}" | ||
| fi | ||
| echo "FAIL:${CRASH_MSG}" >&2 | ||
| exit 1 | ||
| fi | ||
| exec "${ROOT}/utils/run-chaos-harness.sh" "$@" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.