Skip to content

Async batch unit tests: no thread count across tests, a clock step between two batches, and the state of a hand-over that does not come - #455

Merged
tae898 merged 1 commit into
mainfrom
fix/451-async-unit-flakes
Nov 22, 2026
Merged

tae898 merged 1 commit into
mainfrom
fix/451-async-unit-flakes

Conversation

@tae898

@tae898 tae898 commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

It removes two timing assumptions from tests/test_native_async_create_batch_unit.py that failed on main in the red-main issue #451, and makes the third failure of that run say what it holds. It is a tests-only change, no source file changes.

The run was 45056236348 on 076d6d5, native parity, Python 3.12. The test file failed on both runners, and it is not related to the pull request that was merged there (#398).

Runner Test What it said
macos-arm64 test_an_executor_starts_no_thread_of_its_own assert 27 == 28 on threading.active_count()
windows-x64 test_the_entry_of_an_earlier_batch_does_not_cut_a_later_batch_short assert 577.8340000000001 > 577.8340000000001
windows-x64 test_the_order_of_the_calls_holds_across_linger_hand_overs_and_flush_points assert False after _wait_for, and the file took 10.96 s
  • Thread count: the test compared threading.active_count() before and after it made 20 executors. A thread of an earlier test that ends in between (a short-lived hand-over thread) lowers the count, so the test failed although no executor had started a thread. It now compares the set of threads and fails only on a thread that did not exist before.
  • Equal due times: the clock of Windows (time.monotonic() on Python 3.12) moves in steps of about 16 ms, so two batches that start within one step get the same due time and second_due > first_due is false. The test now waits for the clock to move between the two batches. The code under test is unchanged. From reading _Linger I expect it to cope with an equal due time (the entry that fires hands over whatever is waiting, the other entry finds nothing and is dropped), but I did not run that case.
  • The 10 s wait: _wait_for ran into its limit of 10 s in the call-order test on Windows. I did not find a cause by reading _Linger and NativeAsyncExecutor: the same file passed on the other runs of main, and I cannot run Windows here. The test now puts the state in its failure message (the calls seen, the due time, the buffer, the stored error, the heap of the linger thread, whether the thread is alive, and the clock), so the next occurrence names the cause. I left this one open on purpose: Full CI is red on main: Test native (arcadedb) #451 stays open until a Windows run shows what it was or it has not come back for a while.

Related issues

Refs #451. It stays open for the third item.

Docs

None needed.

Checklist

  • A regression test fails on the old code and passes on the new (does not apply: the change is to flaky tests, and the old failures need the runners of the red run)
  • The test suite that the change can affect passes (not run on my machine; the file runs in this pull request's CI, in the native parity job)
  • uvx pre-commit run --files tests/test_native_async_create_batch_unit.py passes.

…tween two batches, and the state in the message of a hand-over that does not come (refs #451)
@tae898 tae898 added this to the 26.12.1 milestone Nov 22, 2026
@tae898 tae898 added python Pull requests that update python code native The arcadedb package (native library build) labels Nov 22, 2026
@tae898 tae898 self-assigned this Nov 22, 2026
@tae898
tae898 merged commit 1d1f88e into main Nov 22, 2026
24 checks passed
@tae898
tae898 deleted the fix/451-async-unit-flakes branch November 22, 2026 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

native The arcadedb package (native library build) python Pull requests that update python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant