You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR addresses several correctness bugs, security improvements, and hot-path performance bottlenecks in the I/O profiler (profiling/src/io):
Correctness in observed_poll: Correctly distinguishes returned and requested events, evaluates both read and write readiness across all descriptors, handles output-only events such as POLLHUP, and avoids reading the descriptor array when nfds == 0 or poll() fails.
Byte counting in fread and fwrite: Records total bytes (items * size) rather than item count (nobj).
GNU_RELRO security: Restores PROT_READ memory protection on Linux after patching GOT entries in RELRO segments.
Loader safety: Adds bounds checks to Mach-O indirect symbol and string tables, masks INDIRECT_SYMBOL_LOCAL/ABS flags, bounds ELF dynamic section loops, and skips the ld-musl linker.
Fast-path bypass: Non-PHP threads, such as cURL async DNS resolver threads, exit immediately from profiling hooks, avoiding clock reads and sampler TLS initialization. The close hook still invalidates the process-wide file descriptor cache.
Removed static mut ORIG_*: All hooks now call libc::* directly because ddtrace.so explicitly excludes itself from GOT hooking, eliminating data races and redundant dlsym(RTLD_NEXT) lookups.
Comparing candidate commit 8d724d8 in PR branch florian/io-profiling-fixes with baseline commit 3b1267d in branch master.
Found 0 performance improvements and 2 performance regressions! Performance is the same for 24 metrics, 10 unstable metrics.
Explanation
This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:
🟩 = significantly better candidate vs. baseline
🟥 = significantly worse candidate vs. baseline
We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.
If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.
Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.
More details about the CI and significant changes
You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.
CIs of the difference of means are often centered around 0%, because often changes are not that big:
---------------------------------(------|---^--------)-------------------------------->
-0.6% 0% 0.3% +1.2%
| | |
lower bound of the CI --' | |
sample mean (center of the CI) -------------' |
upper bound of the CI ----------------------'
As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).
For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:
----------------------------------------|---------|---(---------^---------)---------->
0% 1% 1.3% 2.2% 3.1%
| | | |
significant impact threshold --------------' | | |
lower bound of CI --------------' | |
sample mean (center of the CI) --------------------------' |
upper bound of CI ----------------------------------'
scenario:php-profiler-timeline-memory-control
🟥 cpu_user_time [+32.333ms; +44.230ms] or [+4.976%; +6.807%]
🟥 execution_time [+34.292ms; +36.744ms] or [+4.897%; +5.247%]
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
AI GeneratedLargely based on code generated by an AI or LLM. This label is the same across all dd-trace-* reposprofilingRelates to the Continuous Profilertracing
1 participant
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.
Description
This PR addresses several correctness bugs, security improvements, and hot-path performance bottlenecks in the I/O profiler (
profiling/src/io):observed_poll: Correctly distinguishes returned and requested events, evaluates both read and write readiness across all descriptors, handles output-only events such asPOLLHUP, and avoids reading the descriptor array whennfds == 0orpoll()fails.freadandfwrite: Records total bytes (items * size) rather than item count (nobj).PROT_READmemory protection on Linux after patching GOT entries in RELRO segments.INDIRECT_SYMBOL_LOCAL/ABSflags, bounds ELF dynamic section loops, and skips theld-musllinker.closehook still invalidates the process-wide file descriptor cache.static mut ORIG_*: All hooks now calllibc::*directly becauseddtrace.soexplicitly excludes itself from GOT hooking, eliminating data races and redundantdlsym(RTLD_NEXT)lookups.Reviewer checklist
https://datadoghq.atlassian.net/browse/PROF-15825