Skip to content

Conversation

@jbachorik
Copy link
Collaborator

@jbachorik jbachorik commented Dec 12, 2025

What does this PR do?:
Removes the inotify-based thread directory watcher from the TLS priming system. This includes removing the startThreadDirectoryWatcher() and stopThreadDirectoryWatcher() functions along with all associated implementation code across Linux and macOS platforms.

Motivation:
The filesystem-based thread monitoring using inotify was causing performance overhead in production environments. This functionality will be replaced with library patching in the near future, providing a more efficient approach to native thread TLS initialization.

Additional Notes:

  • The TLS priming infrastructure for Java threads via JVMTI remains intact and fully functional
  • Native threads will now use lazy initialization until lib patching is implemented
  • All signal handler infrastructure remains available for future lib patching use
  • Documentation has been updated to reflect these changes and document the removal rationale

Changes made:

  • Removed watcher thread loop and inotify monitoring from os_linux_dd.cpp
  • Removed watcher stubs from os_macos_dd.cpp
  • Removed watcher function declarations from os_dd.h
  • Updated thread.cpp to remove watcher initialization and cleanup calls
  • Removed ThreadDirectoryWatcher test from test_tlsPriming.cpp
  • Updated TlsPriming.md documentation to reflect the removal and document future direction

How to test the change?:
All C++ unit tests pass successfully, including the TLS priming tests:

  • Built and ran gtestDebug - all 93 C++ unit tests passed
  • TLS priming tests verify signal handler installation, thread enumeration, and signal delivery
  • JVMTI-based thread initialization remains tested and functional

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 review from @DataDog/security-design-and-guidance.
  • This PR doesn't touch any of that.

Unsure? Have a question? Request a review!

@jbachorik jbachorik added the AI label Dec 12, 2025
@jbachorik jbachorik force-pushed the jb/tls_priming_inotify_remove branch from c37c0da to 81e4b03 Compare December 12, 2025 16:28
@jbachorik jbachorik requested a review from rkennke December 12, 2025 16:29
The reason is the extra overhead it is causing and the fact that we will have something better with library patching.
@jbachorik jbachorik force-pushed the jb/tls_priming_inotify_remove branch from 81e4b03 to 83554bd Compare December 12, 2025 16:39
@jbachorik jbachorik requested a review from zhengyu123 December 12, 2025 16:55
Copy link
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

@jbachorik jbachorik merged commit 86b3608 into main Dec 12, 2025
184 of 186 checks passed
@jbachorik jbachorik deleted the jb/tls_priming_inotify_remove branch December 12, 2025 17:10
@github-actions github-actions bot added this to the 1.35.0 milestone Dec 12, 2025
@jbachorik jbachorik mentioned this pull request Dec 12, 2025
3 tasks
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