Conversation
CI Test ResultsRun: #36006502904 | Commit:
Status Overview
Legend: ✅ passed | ❌ failed | ⚪ skipped | 🚫 cancelled Summary: Total: 32 | Passed: 32 | Failed: 0 Updated: 2026-09-24 13:54:29 UTC |
This comment has been minimized.
This comment has been minimized.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
java-profiler/ddprof-lib/src/main/cpp/arguments.cpp
Lines 418 to 419 in 5b8117a
For malformed values beginning with j or a, such as wallsampler=junk or wallsampler=asgct_typo, switching only on value[0] still accepts the option and selects a sampler. This leaves the silent-coercion bug in place for most typos despite rejecting values beginning with other characters; compare the complete value against the supported sampler names before assigning it.
ℹ️ 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".
There was a problem hiding this comment.
The most critical issue is that a rejected command in execute0 can silently close or truncate the active log file because Log::open runs before parse-error validation. Additionally, the bare referencechains option no longer enables reference-chain profiling because the no-value branch was dropped from the argument parser.
🤖 Bits Code Review · Commit 5b8117a · @DataDog review to ask questions
What does this PR do?:
Hardens
Arguments::parseso malformed or unrecognized profiler options are no longer silently dropped. Known options with an invalid value now raise a hardIllegalArgumentException(matching the existingfjmethodidconvention); unrecognized top-level tokens andreferencechainssub-option keys are now captured and reported as non-fatal warnings viaLog::warn, instead of vanishing with no trace.Motivation:
Several option parsers grouped their default case with the "enable" branch, so a typo silently enabled a feature instead of failing. For example,
mcleanup=xyz(a typo) previously fell through to the same branch asmcleanup=trueand silently enabled method cleanup. The user would get a profiler running in a state they never asked for, with zero indication anything was wrong. Other options (cstack,wallsampler,jvmtistacks,lightweight,referencechains) had the same class of bug in the opposite direction, silently coercing typos to a default/disabled state. Unknown top-level tokens andreferencechainssub-keys were also dropped entirely, even from the (currently non-functional) warning log path.Additional Notes:
parseBoolOptionhelper for they/yes/t/true/1vsn/no/f/false/0convention used across these options, replacing several duplicatedswitch(value[0])blocks that matched on the first character only (another latent bug:mcleanup=tweqused to pass astrue)._unknown_arg(single slot) replaced with_unknown_args(vector), so every unmatched token is reported, not just the first.execute0(javaApi.cpp) whereLog::open(args)ran after the error check/early-return, so warnings were swallowed whenever a hard error also fired in the same command string.How to test the change?:
new/updated
TEST_F(ArgumentsTest, ...)cases inarguments_ut.cpp, covering every hardened option (both the new hard-error and the still-valid-value cases) plus unknown-token capture. Also updatedremoteargs_ut.cpp'sRemoteSymbolicationInvalidValuetest, which previously asserted the silent-enable bug as correct behavior. It now assertsremotesym=invalidis a parse error.For Datadog employees:
credentials of any kind, I've requested a security review (run the
dd:platform-security-reviewskill, or file a request via the PSEC review form).
bewairealso runs automatically on every PR.Unsure? Have a question? Request a review!