Skip to content

Unset ld_preload and dyld_insert_libraries for crashtracker child JVM#11041

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits intomasterfrom
gyuheon0h/jvm-ldpreload-reset
Apr 3, 2026
Merged

Unset ld_preload and dyld_insert_libraries for crashtracker child JVM#11041
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits intomasterfrom
gyuheon0h/jvm-ldpreload-reset

Conversation

@gyuheon0h
Copy link
Copy Markdown
Contributor

@gyuheon0h gyuheon0h commented Apr 2, 2026

What Does This Do

Clears LD_PRELOAD and DYLD_INSERT_LIBRARIES in the OOME notifier and crash uploader shell scripts to prevent the Datadog instrumentation injector from re-injecting the agent into the diagnostic child JVM

Motivation

Previous iteration: Unset inherited JVM env vars in crashtracking scripts

Raised here: #10819 (comment)

Additional Notes

The earlier change to clear JDK_JAVA_OPTIONS, JAVA_TOOL_OPTIONS, and _JAVA_OPTIONS can be bypassed when the Datadog instrumentation injector is active via LD_PRELOAD. The injector's native library executes at exec() time which is after the script clears the Java option variables but before the child JVM reads them then and re-sets JAVA_TOOL_OPTIONS with -javaagent:dd-java-agent.jar, undoing the fix.

This causes the child JVM to double-load the agent (once as its main jar, once as a javaagent), reintroducing the same port conflicts, memory contention, and lost diagnostics the original change wanted to prevent.

This change adds unset LD_PRELOAD and unset DYLD_INSERT_LIBRARIES with the existing Java option clearing in notify_oome.sh and both code paths of upload_crash.sh.

The .bat variants are not affected by LD_PRELOAD.

Windows has a separate kernel-driver-based DLL injection mechanism that cannot be addressed from the scripts and will need a coordinated fix in the injector itself (respecting a sentinel environment variable set by the crash uploader maybe?).

Contributor Checklist

Jira ticket: [PROJ-IDENT]

Note: Once your PR is ready to merge, add it to the merge queue by commenting /merge. /merge -c cancels the queue request. /merge -f --reason "reason" skips all merge queue checks; please use this judiciously, as some checks do not run at the PR-level. For more information, see this doc.

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@gyuheon0h gyuheon0h changed the title unset ld_preload and dyld_insert_librares chore(crashtracking): unset ld_preload and dyld_insert_libraries for crashtracker child JVM Apr 2, 2026
@gyuheon0h gyuheon0h marked this pull request as ready for review April 2, 2026 15:43
@gyuheon0h gyuheon0h requested a review from a team as a code owner April 2, 2026 15:43
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

Hi! 👋 Thanks for your pull request! 🎉

To help us review it, please make sure to:

  • Add at least one type, and one component or instrumentation label to the pull request

If you need help, please check our contributing guidelines.

@gyuheon0h gyuheon0h requested a review from annacai21 April 2, 2026 15:44
@gyuheon0h gyuheon0h added the comp: crash tracking Crash Tracking label Apr 2, 2026
@gyuheon0h gyuheon0h added the type: bug Bug report and fix label Apr 2, 2026
@gyuheon0h gyuheon0h requested a review from a team April 2, 2026 15:48
Copy link
Copy Markdown
Contributor

@zhengyu123 zhengyu123 left a comment

Choose a reason for hiding this comment

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

LGTM

@gyuheon0h gyuheon0h added this pull request to the merge queue Apr 2, 2026
@dd-octo-sts
Copy link
Copy Markdown
Contributor

dd-octo-sts bot commented Apr 2, 2026

/merge

@gh-worker-devflow-routing-ef8351
Copy link
Copy Markdown

gh-worker-devflow-routing-ef8351 bot commented Apr 2, 2026

View all feedbacks in Devflow UI.

2026-04-02 19:37:04 UTC ℹ️ Start processing command /merge


2026-04-02 19:37:11 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in master is approximately 2h (p90).


2026-04-02 19:58:35 UTCMergeQueue: This merge request was updated

This PR is rejected because it was updated

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 2, 2026
@gyuheon0h
Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351
Copy link
Copy Markdown

gh-worker-devflow-routing-ef8351 bot commented Apr 2, 2026

View all feedbacks in Devflow UI.

2026-04-02 19:58:54 UTC ℹ️ Start processing command /merge


2026-04-02 19:59:00 UTC ℹ️ MergeQueue: waiting for PR to be ready

This pull request is not mergeable according to GitHub. Common reasons include pending required checks, missing approvals, or merge conflicts — but it could also be blocked by other repository rules or settings.
It will be added to the queue as soon as checks pass and/or get approvals. View in MergeQueue UI.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.


2026-04-02 20:57:45 UTC ⚠️ MergeQueue: This merge request was unqueued

gyuheon.oh@datadoghq.com unqueued this merge request

@gyuheon0h
Copy link
Copy Markdown
Contributor Author

/merge -c

@gh-worker-devflow-routing-ef8351
Copy link
Copy Markdown

gh-worker-devflow-routing-ef8351 bot commented Apr 2, 2026

View all feedbacks in Devflow UI.

2026-04-02 20:57:39 UTC ℹ️ Start processing command /merge -c

@gyuheon0h
Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351
Copy link
Copy Markdown

gh-worker-devflow-routing-ef8351 bot commented Apr 3, 2026

View all feedbacks in Devflow UI.

2026-04-03 04:27:56 UTC ℹ️ Start processing command /merge


2026-04-03 04:28:00 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in master is approximately 2h (p90).


2026-04-03 05:30:36 UTC ℹ️ MergeQueue: This merge request was merged

@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d bot merged commit cd5b227 into master Apr 3, 2026
566 checks passed
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d bot deleted the gyuheon0h/jvm-ldpreload-reset branch April 3, 2026 05:30
@github-actions github-actions bot added this to the 1.61.0 milestone Apr 3, 2026
@PerfectSlayer PerfectSlayer changed the title chore(crashtracking): unset ld_preload and dyld_insert_libraries for crashtracker child JVM Unset ld_preload and dyld_insert_libraries for crashtracker child JVM Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: crash tracking Crash Tracking type: bug Bug report and fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants