Conversation
BATS_CORE_VERSIONS has held exactly one entry, v1.10.0 (released 2023-07-15), since it was added. register_bats_toolchains reads the sha256 out of that map, so core_version is effectively not a choice -- passing anything else fails on the dict lookup, and there is no way off 1.10.0 without vendoring a toolchain. That matters because bats_test exports BATS_TEST_TIMEOUT="$TEST_TIMEOUT", tying bats' per-test timeout to the build system's per-target timeout. 1.10.0's timeout watchdog leaks its inherited file descriptors, so a test that finishes in milliseconds can block until the watchdog's sleep expires -- which is then exactly as long as the harness is willing to wait, making it a harness timeout. Upstream closed the watchdog's fds in the bats-core bazel-contrib#1067 series (1.13.0). Measured on a 4-core Linux box with a 4-assertion file where every case passes in <10ms, BATS_TEST_TIMEOUT=5, 250 runs per version at 10-way concurrency: 1.10.0 hung for the full timeout 2/250 times (max 5341ms); 1.14.0 0/250 (max 1043ms). Neither reproduces serially. Every sha256 was computed from the URL the rule already uses. As a control, recomputing v1.10.0 that way reproduces the existing pinned hash exactly. All five archives were checked for the layout BATS_CORE_TEMPLATE globs, and 1.14.0 was run end-to-end through bats_test in a large Bazel monorepo.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
BATS_CORE_VERSIONShas held exactly one entry,v1.10.0, since it was added — released 2023-07-15, four minor versions behind upstream's current 1.14.0 (2026-07-21). Becauseregister_bats_toolchainsreads the sha256 out of that map:core_versionis effectively not a choice — passing anything else tobazel_lib_toolchains.bats(core_version = ...)fails on the dict lookup. There is no way to move off 1.10.0 without vendoring your own toolchain.That matters because 1.10.0 carries a timeout bug that
bats_testis unusually exposed to. The launcher sets:so bats' per-test timeout equals the build system's per-target timeout. In 1.10.0 the per-test timeout watchdog leaks its inherited file descriptors, so a test that finishes in milliseconds can block until the watchdog's
sleepexpires — which, given the line above, is exactly as long as the harness is willing to wait. The run can then only ever end as a harness timeout, and raising the target's timeout raises both in lockstep.Upstream fixed the leak for the inner subshell in the bats-core #1067 series (shipped in 1.13.0) by closing the watchdog's fds:
Measured on a 4-core Linux box, running a 4-assertion file where every case passes in <10ms,
BATS_TEST_TIMEOUT=5, 250 runs per version at 10-way concurrency:Neither version reproduces when run serially — it needs concurrency, which is exactly what CI does.
Change
v1.11.0,v1.11.1,v1.12.0,v1.13.0,v1.14.0toBATS_CORE_VERSIONS.DEFAULT_BATS_CORE_VERSIONtov1.14.0.Verification
https://github.com/bats-core/bats-core/archive/{version}.tar.gz. As a control, recomputingv1.10.0that way reproduces the existing pinned hash byte for byte.BATS_CORE_TEMPLATEglobs (bin/bats,lib/**,libexec/**).v1.14.0was run end-to-end throughbats_testin a large Bazel monorepo — three targets, including one asserting a bats failure still fails — all passing.Note on the default bump
The second commit (the
DEFAULT_BATS_CORE_VERSIONbump) is separable. Adding the map entries alone unblocks anyone who wants to opt in, and I am happy to drop the default change if you would rather move it independently. My reasoning for including it: without it, the default stays on a 2023 release carrying a bug that this repo's ownbats_testrule maximally exposes, and most users will never think to setcore_version.bats-support/bats-assert/bats-fileare left alone; their pins are current.