Skip to content

test(procfs): fix TID reuse cache test semantics - #2179

Open
fslongjin wants to merge 1 commit into
DragonOS-Community:masterfrom
fslongjin:codex/fix-issue-2174-proc-pid-reuse-test
Open

test(procfs): fix TID reuse cache test semantics#2179
fslongjin wants to merge 1 commit into
DragonOS-Community:masterfrom
fslongjin:codex/fix-issue-2174-proc-pid-reuse-test

Conversation

@fslongjin

Copy link
Copy Markdown
Member

Summary

  • remove the assertion that requires /proc/<tgid>/task/<tid> to disappear immediately after pthread_join
  • treat missing TID reuse within the fixed attempt budget as an unmet test precondition on every platform
  • preserve the live replacement-thread namespace lookup that detects stale procfs cache entries after actual TID reuse

Root cause

pthread_join waits for the kernel's CLONE_CHILD_CLEARTID clear-and-wake operation. Linux and DragonOS both perform that operation before the exiting thread is necessarily unhashed from the PID tables, so join completion does not establish that the procfs task directory must already return ENOENT.

The test also assumed that DragonOS must reuse a specific TID within 128 attempts. That finite reuse bound is not a userspace ABI guarantee. Runs that do not construct the reuse precondition now skip, while runs that observe reuse still execute all namespace open and readlink assertions.

Validation

  • make -C user/apps/tests/dunitest bin/normal/proc_pid_reuse_cache_test
  • make kernel
  • DragonOS guest full binary: 3 tests passed
  • DragonOS guest target repeated 100 times: 97 passed after observing reuse, 3 skipped without reuse, 0 failed
  • Linux host target repeated 300 times: no failure or hang

Fixes #2174

pthread_join only waits for CLONE_CHILD_CLEARTID completion and does not guarantee that the exiting TID has already been unhashed from procfs. Remove the immediate ENOENT assertion that depended on that unsupported ordering.

Treat failure to observe TID reuse within the fixed construction budget as an unmet test precondition on every platform. The namespace open and readlink checks still execute while each replacement thread is alive, so a stale cached TID directory continues to fail whenever reuse is actually observed.

Fixes DragonOS-Community#2174

Signed-off-by: longjin <longjin@dragonos.org>
@github-actions github-actions Bot added the test Unitest/User space test label Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test Unitest/User space test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(procfs): ReusedTidRefreshesTaskNamespaceDirectory is flaky

1 participant