Skip to content

fix: don't disable profiler on Alpine/musl over missing libgcc_s.so.1 - #720

Open
jbachorik wants to merge 4 commits into
mainfrom
jb/libgcc_s
Open

fix: don't disable profiler on Alpine/musl over missing libgcc_s.so.1#720
jbachorik wants to merge 4 commits into
mainfrom
jb/libgcc_s

Conversation

@jbachorik

@jbachorik jbachorik commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?:
checkState() was failing profiler startup on any host missing libgcc_s.so.1, including musl/Alpine — but that failure mode (glibc's pthread_exit/pthread_cancel aborting via __libc_fatal when its private lazy dlopen of libgcc_s fails) is glibc-specific. musl never takes that code path, so a missing libgcc_s.so.1 there was never actually dangerous. The check now only treats prewarmUnwinder() failure as fatal off musl (!prewarmUnwinder() && !OS::isMusl()), so Alpine/musl hosts without libgcc_s.so.1 start normally.

Also rewrote the prewarmUnwinder() comment, which had drifted to attribute the eager load to only one of the two lazy-load issues it actually closes (J9's DWARF-unwinder signal-context dlopen, and the glibc pthread_exit path above) — it now documents both, and why only one of them gates fatality.

Motivation:
Distroless/hardened/Alpine images commonly ship without libgcc_s.so.1. The overly broad check meant the profiler refused to start on those musl hosts even though nothing there was actually at risk.

Additional Notes:
Also fixes faultInjection_ut.cpp's CheckStateSurfacesInjectedPrewarmUnwinderFailure test, which assumed an injected prewarmUnwinder() failure always surfaces as "Missing libgcc_s.so.1" — no longer true on musl. Latent until now since -PenableFaultInjection isn't wired into CI yet, but fixed ahead of that.

How to test the change?:

  • Updated faultInjection_ut.cpp to assert the correct behavior on both glibc and musl.
  • No behavior change on glibc hosts (still fails fast on missing libgcc_s.so.1); musl now starts normally instead of refusing to start.

For Datadog employees:

  • If this PR touches code that signs or publishes builds or packages, or handles
    credentials of any kind, I've requested a security review (run the dd:platform-security-review
    skill, or file a request via the PSEC review form).
    bewaire also runs automatically on every PR.
  • This PR doesn't touch any of that.
  • JIRA: PROF-15664

Unsure? Have a question? Request a review!

prewarmUnwinder() closes two separate lazy-load issues (J9 signal-context
dlopen and glibc's pthread_exit __libc_dlopen abort) that share a fix but
not a failure mode; only the glibc one should fail profiler startup.
Fault-injection test updated to match.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@jbachorik jbachorik added the AI label Aug 6, 2026
Copilot AI review requested due to automatic review settings August 6, 2026 09:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@dd-octo-sts

dd-octo-sts Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Scan-Build Report

User:runner@runnervmvrwv9
Working Directory:/home/runner/work/java-profiler/java-profiler/ddprof-lib/src/test/make
Command Line:make -j4 all
Clang Version:Ubuntu clang version 18.1.3 (1ubuntu1)
Date:Thu Aug 6 12:37:11 2026

Bug Summary

Bug TypeQuantityDisplay?
All Bugs1
Logic error
Dereference of null pointer1

Reports

Bug Group Bug Type ▾ File Function/Method Line Path Length
Logic errorDereference of null pointerprofiler.hfindLibraryByAddress51713

@jbachorik jbachorik changed the title fix: document libgcc_s prewarm landmines, gate fatality to glibc fix: don't disable profiler on Alpine/musl over missing libgcc_s.so.1 Aug 6, 2026
@dd-octo-sts

dd-octo-sts Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

CI Test Results

Run: #31102054098 | Commit: 1dd43a5 | Duration: 14m 0s (longest job)

All 32 test jobs passed

Status Overview

JDK glibc-aarch64/debug glibc-amd64/debug musl-aarch64/debug musl-amd64/debug
8 - - -
8-ibm - - -
8-j9 - -
8-librca - -
8-orcl - - -
11 - - -
11-j9 - -
11-librca - -
17 - -
17-graal - -
17-j9 - -
17-librca - -
21 - -
21-graal - -
21-librca - -
25 - -
25-graal - -
25-librca - -

Legend: ✅ passed | ❌ failed | ⚪ skipped | 🚫 cancelled

Summary: Total: 32 | Passed: 32 | Failed: 0


Updated: 2026-08-06 12:52:56 UTC

@jbachorik
jbachorik requested a review from zhengyu123 August 6, 2026 10:48
@dd-octo-sts

dd-octo-sts Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

All 40 integration tests passed

📊 Dashboard · 👷 Pipeline · 📦 3054c057

@jbachorik

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a69976b22f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ddprof-lib/src/test/cpp/faultInjection_ut.cpp Outdated
@dd-octo-sts

dd-octo-sts Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Benchmark Results (commit a69976b)

Pipeline: https://gitlab.ddbuild.io/DataDog/apm-reliability/benchmarking-platform/-/pipelines/129368968 Commit: a69976b22f74135954e5c473bd31ef3c3363ed69

✅ Within expected boundaries

No significant runtime deltas (all within run-to-run noise) and no internal-counter outliers.

Runtime details (per benchmark × JDK)
Benchmark JDK Latest Dev Δ (dev vs latest) Issues L/D
akka-uct 21 ✅ 10154 ms (21 iters) ✅ 10241 ms (21 iters) ≈ +0.9% (±10.6%) — / —
akka-uct 25 ✅ 8932 ms (24 iters) ✅ 8893 ms (24 iters) ≈ -0.4% (±9.4%) — / —
finagle-chirper 21 ✅ 5968 ms (33 iters) ✅ 5938 ms (33 iters) ≈ -0.5% (±25.2%) ⚠️ W:3 / ⚠️ W:3
finagle-chirper 25 ✅ 5460 ms (36 iters) ✅ 5378 ms (36 iters) ≈ -1.5% (±23.2%) ⚠️ W:3 / ⚠️ W:3
fj-kmeans 21 ✅ 2815 ms (66 iters) ✅ 2818 ms (66 iters) ≈ +0.1% (±2.5%) — / —
fj-kmeans 25 ✅ 2773 ms (67 iters) ✅ 2825 ms (66 iters) ≈ +1.9% (±2.6%) — / —
future-genetic 21 ✅ 2111 ms (88 iters) ✅ 2104 ms (88 iters) ≈ -0.3% (±2.6%) — / —
future-genetic 25 ✅ 1938 ms (96 iters) ✅ 1961 ms (94 iters) ≈ +1.2% (±2.6%) — / —
naive-bayes 21 ✅ 1266 ms (135 iters) ✅ 1246 ms (137 iters) ≈ -1.6% (±32.5%) — / —
naive-bayes 25 ✅ 1012 ms (169 iters) ✅ 1006 ms (170 iters) ≈ -0.6% (±31.2%) — / —
reactors 21 ✅ 16292 ms (15 iters) ✅ 15680 ms (15 iters) ≈ -3.8% (±8.4%) — / —
reactors 25 ✅ 18456 ms (15 iters) ✅ 18517 ms (15 iters) ≈ +0.3% (±5.1%) — / —
Internal counter details (ddprof)

ddprof internal counters, latest / dev (✅ = 0, · = unavailable):

Benchmark JDK Dropped rec Dropped jvmti Dropped trace Skipped WC AGCT fail Unwind fail
akka-uct 21 ✅ / ✅ ✅ / ✅ 6 / 4 1925 / 1899 ✅ / ✅ ✅ / ✅
akka-uct 25 ✅ / ✅ ✅ / ✅ ✅ / 2 2396 / 2160 ✅ / ✅ ✅ / ✅
finagle-chirper 21 ✅ / ✅ ✅ / ✅ 4 / ✅ 8463 / 8475 ✅ / ✅ ✅ / ✅
finagle-chirper 25 ✅ / ✅ ✅ / ✅ 3 / 1 8470 / 8040 ✅ / ✅ ✅ / ✅
fj-kmeans 21 ✅ / ✅ ✅ / ✅ 5 / 2 1251 / 1251 ✅ / ✅ ✅ / ✅
fj-kmeans 25 ✅ / ✅ ✅ / ✅ 2 / 1 1262 / 1294 ✅ / ✅ ✅ / ✅
future-genetic 21 ✅ / ✅ ✅ / ✅ 4 / ✅ 3043 / 2950 ✅ / ✅ ✅ / ✅
future-genetic 25 ✅ / ✅ ✅ / ✅ ✅ / ✅ 2962 / 2987 ✅ / ✅ ✅ / ✅
naive-bayes 21 ✅ / ✅ ✅ / ✅ 4 / 3 3495 / 3502 ✅ / ✅ ✅ / ✅
naive-bayes 25 ✅ / ✅ ✅ / ✅ 4 / 1 3511 / 3497 ✅ / ✅ ✅ / ✅
reactors 21 ✅ / ✅ ✅ / ✅ 2 / 1 1586 / 1586 ✅ / ✅ ✅ / ✅
reactors 25 ✅ / ✅ ✅ / ✅ 1 / ✅ 1780 / 1882 ✅ / ✅ ✅ / ✅

@jbachorik
jbachorik marked this pull request as ready for review August 6, 2026 11:41
@jbachorik
jbachorik requested a review from a team as a code owner August 6, 2026 11:41
Copilot AI review requested due to automatic review settings August 6, 2026 11:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

…njected prewarm failures

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings August 6, 2026 11:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 6, 2026 12:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Comment thread ddprof-lib/src/main/cpp/profiler.cpp
Comment thread ddprof-lib/src/main/cpp/profiler.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants