Skip to content

[bug] bats-core load.bats/tagging.bats hang inside bats' own harness machinery (gather-phase DEBUG-trace evaluation / nested run-capture) #283

Closed

Description

@caomengxuan666

wt6/shell2 finding: after the array-subscript + [[ BANG fixes (landed in 2c126128), filter.bats is full parity but load/tagging hang in bats' own machinery — timeout-bounded evidence in target/issue-suites/results/wt6-shell2/. Also platform-invalid .bats/run-logs/.log on Windows (env-bound, documented workaround).

Activity

  1. caomengxuan666 commented on Sep 28, 2026

    @caomengxuan666
    MemberAuthor

    wt7/resid2 lane findings (bats-core @52439eb, rubash-as-bash via a bash.exe copy first on PATH):

    The load.bats/tagging.bats "hang" is not a deadlock — it is a throughput wall in bats' own gather machinery:

    • Single-test repro: timeout -k 5 170 ./bin/bats -f 'no load path' test/load.bats completes in ~63 s and PASSES (ok 1 find_in_bats_lib_path returns 1 if no load path is found, rc=0). The 25-90 s harness budgets kill it mid-gather, which presented as a hang.
    • Instrumented bats-gather-tests (xtrace to a side log) shows the gather progressing linearly (~21k trace lines / 8 s, no repetition loop). Cost driver: bats_debug_trap fires for EVERY simple command while evaluating the preprocessed .bats and calls bats_normalize_windows_dir_path, whose NORMALIZED_INPUT=$(cd "$path" || exit 1; pwd) forks a command substitution per fire. On rubash a trap+comsub fire costs ~1.8-6 ms vs GNU's ~50 us — bats-core multiplies that by thousands of fires per file, and load.bats additionally spawns a NESTED bats per test (26 full gathers). Net: full load.bats is ~26x60 s, far over any sane harness budget.
    • LLDB during the stall shows the parent waiting on the child (WaitForSingleObject), matching "slow, not stuck"; no engine spin.
    • The engine-side lever is comsub/trap throughput (perf round territory), not a semantics fix. filter.bats re-verified on this lane's build: 6/6 ok, rc=0 (full parity retained).

    Env-bound (confirmed, platform-invalid): bats-exec-test: line 190 reports Invalid argument when appending to BATS_RUNLOG_FILE under .bats/run-logs/<date-with-colons>.log — the coloned filename cannot exist on NTFS. Tests still pass; only the runlog write fails.

    No rubash semantic bug found in bats' nested run-capture for these files; closing criteria for the engine side should be a comsub-throughput budget (e.g. N ms per trap fire) rather than a diff count.

  2. caomengxuan666 commented on Sep 28, 2026

    @caomengxuan666
    MemberAuthor

    根因裁定并文档化(commit ade9e7ce):非语义死锁——bats_debug_trap 每命令跑一次路径规范化 comsub,rubash 单次 2-6ms,170s 预算内单测完成并通过(ok 1 rc0);filter.bats 复验 6/6。性能属 #242 热路径家族;date-with-colons 日志名为平台非法文件名(env-bound,bats-exec-test:190)。予以关闭,性能侧另行跟踪。

  3. added
    bug
    P1-high
    on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1-highbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions