Repository navigation
Skip benign LSan ptrace warning in clickhouse-test - #110323
alexey-milovidov merged 4 commits into
Conversation
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-1:20260713-215100 |
|
cc @alexey-milovidov — this is the skip-benign-warning approach you asked for on #105474: adds the LSan |
|
Workflow [PR], commit [fedad2f] Summary: ✅ AI ReviewSummaryThis PR narrows the LSan Final Verdict✅ No new findings. |
CI finish ledger — 0f9b26cCI fully finished. Finish Workflow + Mergeable Check + Style check all pass; zero failing tests in CIDB for this head. The only red is the informational "Report messages" (7 warnings, non-blocking).
Test-runner-only change (add benign LSan ptrace warning to |
|
You are right, that substring is too broad for a global filter. Pushed cd42073: dropped "Child exited with signal" from IGNORED_SANITIZER_ERRORS and instead ignore it only within a sanitizer log file that also contains the "ptrace appears to be blocked" warning (the LSan stop-the-world probe context). The two lines are always emitted as a pair for the killed probe fork, so a genuine "Child exited with signal" in an unrelated test, whose log has no ptrace warning, is no longer swallowed. Verified: the 02435 log is still fully filtered, and a synthetic real child crash with no ptrace warning is preserved. |
leshikus
left a comment
There was a problem hiding this comment.
Looks good, just fix CI
CI finish ledger — cd42073Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task
Nothing in this branch's diff can affect that call, and no test ever ran on this head, so there is no Session id: cron:our-pr-ci-monitor:20260727-170000 |
Owner for the
|
02435_rollback_cancelled_queries signals every process whose /proc/*/cmdline matches its test mark. LSan's at-exit stop-the-world first calls TestPTrace, which forks a short-lived child that issues one throwaway ptrace call to find out whether ptrace is blocked before the tracer attaches to the real threads. That child inherits the client's argv, so it matches the kill loop and dies from the signal, and LSan prints two lines to the sanitizer log and keeps going: WARNING: ptrace appears to be blocked (is seccomp enabled?). LeakSanitizer may hang. Child exited with signal N. The runner treats that as a fatal stderr finding. Leak detection is unaffected. Neither line can be whitelisted on its own, because TestPTrace prints the same pair when seccomp really does block ptrace. Two conditions separate the cases. The signal number is the first. Seccomp kills the child with SIGSYS, verified against a real SECCOMP_SET_MODE_FILTER policy for SYS_ptrace where SECCOMP_RET_KILL_THREAD, SECCOMP_RET_KILL_PROCESS and SECCOMP_RET_TRAP all report WTERMSIG == SIGSYS, while SECCOMP_RET_ERRNO lets the child exit normally so nothing is printed. It cannot be narrowed to a specific observed signal: WTERMSIG reports whatever signal reaped the child, not what the test sent, and over 180 days this pair carried signal 42 (13 hits) and signal 36 (5 hits), never SIGSYS. The signal alone is still not enough. TestPTrace ignores the result of its internal_waitpid and reads a possibly untouched wstatus, so a wait interrupted by EINTR reports a stale signal number, and the client installs its SIGINT handler with sa_flags = 0. Racing a SIGINT against a genuinely seccomp-blocked probe, 812 of 2000 real blocks were reported with a stale non-SIGSYS signal; without the race, 0 of 2000. TestPTrace's sibling wait on the tracer thread does retry EINTR; this one does not, which is an upstream bug either way. So the pair is dropped only when it is adjacent, the signal is not SIGSYS, and the test carries the new kills-processes-by-cmdline tag. Only a test that signals processes it found in /proc/*/cmdline can kill the probe child, so the tag confines the upstream misreport to the one test that tolerates it and leaves every other test's sanitizer log untouched. A tag rather than a hardcoded test name keeps the runner free of test identifiers and survives a rename or split. ci/tests/test_lsan_ptrace_probe_filter.py drives the runner's own filtering path rather than reimplementing it, so disconnecting the filter fails the tests too. It covers benign suppression, preservation of a real seccomp block (including after a benign pair in the same log), a bare warning, a warning as the last line, a child-exit line without the warning, a non-adjacent combination, an unrelated ASan report, multiple log files, the tag gate in both directions, and that the runner's suite loader reads the tag from the test file.
Per .claude/CLAUDE.md: in documentation, comments and commit messages a function is written as `f`, not `f()`, when the text refers to the function itself rather than to a call. Applies to `TestPTrace`, `internal_waitpid` and `Report` in the new docstrings and comments.
Per .claude/CLAUDE.md, literal names from the SQL language, classes and functions, and literal log excerpts go in inline code blocks. Covers the remaining plain spellings in the docstrings, and restores the two blank lines before MAX_RETRIES.
…honestly Two review points. The fixtures built their warning line by interpolating LSAN_PTRACE_WARNING, so a matcher drifting away from what compiler-rt actually prints would have moved the helper and the fixtures together and left the suite green. They now spell the upstream line out verbatim, and a new test asserts the runner's matcher still matches it, plus a near miss where an unrelated warning followed by a child-exit line must be kept. The docstring claimed a real seccomp block is always still reported while also documenting that the upstream EINTR bug can misreport one as a non-SIGSYS signal, which the tagged path then drops. The guarantee is now stated as it actually is: outside the tagged test nothing is ever dropped, so a real block is always reported; inside it a misreported block can be dropped, and bounding that to the one test which already tolerates it is what the tag buys. The corresponding test is renamed to say it covers a correctly reported block.
cd42073 to
fedad2f
Compare
CI finish ledger - fedad2f174 check-runs, all completed, zero failures. There is no owner column to fill on this head.
71 success, 103 skipped, 0 incomplete. The matrix that matters for this change did run: This clears the "just fix CI" condition on the earlier approval: the previous head Session id: cron:our-pr-ci-monitor:20260803-140000 |
alexey-milovidov
left a comment
There was a problem hiding this comment.
Ok. Other than a trash-test everything is good.
|
You are right about What is redundant, concretely: four separate test functions assert one property over nine signal values ( Two properties have to survive the trim, since they are the reason the file exists at all: it calls the runner's own Happy to send a follow-up that collapses the signal cases and moves the prose into the commit message, keeping those two properties. Tell me if you want it, or if you would rather I leave merged code alone. |
|
I'm removing the test in #113286. LLMs love to add useless tests |
|
You are right, and the breakage is mine. The Removing it in #113286 is fine by me, and the removal is self-contained: nothing else in the tree references the file, and your diff leaves the filter in |
Related: #105474
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Replaces the closed #105474. Per review feedback there: do not disable LSan, skip the benign warning instead.
02435_rollback_cancelled_queriessignals every process whose/proc/*/cmdlinematches its test mark. LSan's at-exit stop-the-world first callsTestPTrace, which forks a short-lived child that issues one throwawayptracecall to find out whetherptraceis blocked before the tracer attaches to the real threads. That child inherits the client's argv, so it matches the kill loop and dies from the signal, and LSan prints two lines to the sanitizer log and keeps going:The runner treats that as a fatal stderr finding. Leak detection itself is unaffected.
Neither line can be whitelisted on its own, because
TestPTraceprints the same pair when seccomp really does blockptrace. The signal number is the first discriminator: seccomp kills the child withSIGSYS, verified against a realSECCOMP_SET_MODE_FILTERpolicy forSYS_ptracewhereSECCOMP_RET_KILL_THREAD,SECCOMP_RET_KILL_PROCESSandSECCOMP_RET_TRAPall reportWTERMSIG == SIGSYS, whileSECCOMP_RET_ERRNOlets the child exit normally so nothing is printed at all.Over 180 days this pair has appeared in CI with signal 42 (13 hits) and signal 36 (5 hits), never with
SIGSYS. Both are real-time signals rather than theSIGINT/SIGKILLthe test sends, which is consistent withWTERMSIGreporting whatever signal actually reaped the child: an externally killed probe child reports its killing signal verbatim, and only a seccomp denial yieldsSIGSYS. So the check cannot be narrowed to a specific observed signal either. (#105474guessed that LSan itself falls back toSIGRTMIN+2;compiler-rtcontains noSIGRTMINcode at all, so that was wrong.)The signal alone is still not enough.
TestPTraceignores the result of itsinternal_waitpidand reads a possibly untouchedwstatus, so a wait interrupted byEINTRreports a stale signal number, and02435sendsSIGINTto every marked process while the client installs its handler withsa_flags = 0. Racing aSIGINTagainst a genuinely seccomp-blocked probe, 812 of 2000 real blocks were reported with a stale non-SIGSYSsignal; without the race, 0 of 2000. A signal-only global filter could therefore suppress a real diagnostic.TestPTrace's sibling wait on the tracer thread does retryEINTR; this one does not, which is an upstream bug either way.So the fix requires two conditions together. The two lines are dropped only as an adjacent pair, only when the reported signal is not
SIGSYS, and only for a test taggedkills-processes-by-cmdline- a new tag on02435_rollback_cancelled_queries, since only a test that signals processes it found in/proc/*/cmdlinecan kill the probe child at all. That confines the upstream misreport to the one test that already tolerates it. Consequences:ptraceblock elsewhere is always reported;EINTRbug above misreports as a non-SIGSYSsignal can be dropped there; bounding that to the one test which already tolerates it is exactly what the tag buys;Child exited with signal Nline without the warning directly above it is always kept;A tag rather than a hardcoded test name keeps the runner free of test identifiers, so it does not rot when the test is renamed or split, and a future test that signals processes this way only needs the tag.
02435is the only candidate today anyway: the three other tests that kill by/proc/*/cmdline(02434_cancel_insert_when_client_diesand the04365/04366variants) are taggedno-asan, no-msan, no-tsan, so no sanitizer runs there.02435_rollback_cancelled_queriesonly reaches the benign case through a timing race, so it cannot pin this behaviour.ci/tests/test_lsan_ptrace_probe_filter.pydrives the runner's own filtering path and covers all three directions: benign pairs are dropped (SIGKILL,SIGINT, the signals 42 and 36 seen in CI, repeated pairs); aSIGSYSpair, a bare warning, a warning as the last line, a child-exit line without the warning, a non-adjacent combination and an unrelated ASan report are preserved; and an untagged test keeps everything. It also asserts that the runner's own suite loader reads the new tag from the test file.