Repository navigation
test-lib, tree-walk: fix large-file test failures on Git 2.98-rc0 - #173
Closed
ttaylorr-oai wants to merge 3 commits into
Closed
ttaylorr-oai wants to merge 3 commits into
ttaylorr-oai wants to merge 3 commits into
Conversation
Recently, we've acquired quite a few expensive tests in our test suite. For instance, these commits add several tests that require multiple gigabytes of memory: - 89048b4 (t1600-index: add expensive tests for over-long tree paths, 2026-10-16) added tests to t1600 - 288266c (xdiff: use size_t for merge buffer size computations, 2026-10-16) added tests to t4300 - 55c54fd (apply: reject binary patches greater than MAX_APPLY_SIZE, 2026-03-25) added tests to t4141 We also have the memory hungry 5GB filtered hash-object test in t1007. When GIT_TEST_LONG is set, "prove --jobs" happily runs several of these at once. On the 16GB GitLab CI runners this exhausts memory: the sanitizer jobs have been hanging in t1007 until they hit the job timeout ever since the new EXPENSIVE tests in t1600 started running alongside it. Running the two under a 16GB memory cap reproduces it, with the t1007 git process getting OOM-killed. GitHub CI runners are no exception and experience the same behaviour. Take a lock shared by all test scripts around each EXPENSIVE test, so only one of them runs at a time. Cheap tests in the same scripts keep running in parallel. Only the expensive ones wait for each other. The lock is a file in TEST_RESULTS_DIR holding its owner's PID. A script writes its PID to a file of its own and hard links it into place with ln(1). Like mkdir(1), that is atomic and fails if the lock exists, but the lock never exists without its owner recorded in it. The lock is released after the test and its cleanup finish, and from the EXIT trap. A lock whose owner is gone was left by a killed script, and a waiter removes it after re-reading it, so that a lock another waiter has just taken is left alone. Two waiters clearing the same stale lock at once may let two expensive tests run together, which is rare and better than hanging. If the lock cannot be taken although nobody holds it, e.g. without hard link support or on a read-only or full disk, the test runs anyway. Signed-off-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> (cherry picked from commit 2db3f30)
The previous commit serializes EXPENSIVE tests with a lock that a
waiter takes over when its holder was killed, and that the EXIT trap
releases when a script dies while holding it.
Add subtests checking that:
- a lock left by a dead process is taken over, held while the test
runs, and released afterwards;
- a lock carrying the script's own PID, which can only be left by a
dead holder whose PID was reused, is taken over;
- a script exiting in the middle of an EXPENSIVE test does not leave
the lock behind.
None of them has to wait, as a stale lock is cleared without polling.
Signed-off-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
(cherry picked from commit 156a722)
The EXPENSIVE tests 13-15 in t1600 have been failing in CI on all 64-bit platforms since 53d5cfc (tree-walk: use size_t for the size of tree buffers, 2026-10-30) was merged: -fatal: index entry path is too long (4294967298 bytes) +fatal: malformed mode in tree entry The tests were added in 89048b4 (t1600-index: add expensive tests for over-long tree paths, 2026-10-16). They use a tree with a single entry whose name is 2^32 - 2 bytes long. decode_tree_entry() stores that length in the "int" pathlen of struct name_entry, where it wraps to -2. update_tree_entry() then uses it to find the next entry, ends up in the middle of the name, and fails to parse it. Before 53d5cfc the tree size was truncated to 32 bits as well, so the walk saw the 2^32 + 26 byte tree as 26 bytes. That is exactly what the wrapped entry length consumed, so the walk stopped without an error and read-cache rejected the path as the tests expect. Fixing the tree size exposed the pathlen bug. Fix this by keeping the name length in a size_t and rejecting names longer than INT32_MAX. This is what fits in pathlen on every platform we support, and using a fixed-width limit means that the same trees are accepted everywhere. read-cache already has the same limit for index entries, and index.maxPathLen cannot be set higher, so such names could never be used anyway. Update the tests to expect the new error. The tests no longer reach read-cache, but its limit is still covered by the "test-tool cache-entry" tests. Signed-off-by: Kristofer Karlsson <krka@spotify.com> (cherry picked from commit 7bfcb21)
tnm-oai
approved these changes
Dec 2, 2026
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.
This topic fixes two failures in the large-file tests ahead of the
codexrebuild on upstream Git 2.98-rc0 (566b6997dd). Please approve this review-only PR to admit it to the production plan. The release controller handles integration.seenbranch. Cases markedEXPENSIVEtake turns across scripts sharing a results directory. Other cases still run in parallel. The 5 GiB filtered hash test int1007used 13.8 GiB under LeakSanitizer locally and repeatedly stalled in CI when it overlapped witht1600.INT32_MAXbefore storing their length in anint. This fixes the misleading malformed-tree error int1600.13–15introduced by53d5cfc3b8. No tests are disabled.The review branch starts at the current production base,
eacee88cf8, to keep the diff to these three commits. I verified that applying the topic to566b6997ddand to the rebuilt production candidate gives the same trees as cherry-picking all three changes directly on the new base. Brett’s Windows patch stays separate.All 157 cases in
t0000,t1007, andt1600passed locally on Git 2.98-rc0 with all three changes, LeakSanitizer,GIT_TEST_LONG=true, and three parallel jobs. Without the tree-walk change,t1600.13–15failed.