Title: pkgs/id: log_sync batch-collection tests are load-racy (5ms grace vs 2ms pacing), intermittently fail the nix check phase · Issue #3199 · developing-today/code · GitHub
Open Graph Title: pkgs/id: log_sync batch-collection tests are load-racy (5ms grace vs 2ms pacing), intermittently fail the nix check phase · Issue #3199 · developing-today/code
X Title: pkgs/id: log_sync batch-collection tests are load-racy (5ms grace vs 2ms pacing), intermittently fail the nix check phase · Issue #3199 · developing-today/code
Description: Summary The log_sync batch-collection tests race the production idle grace against wall-clock pacing from a second thread, and intermittently fail the pkgs/id check phase — which gates every NixOS system build (id-web → unit-id-primary.s...
Open Graph Description: Summary The log_sync batch-collection tests race the production idle grace against wall-clock pacing from a second thread, and intermittently fail the pkgs/id check phase — which gates every NixOS ...
X Description: Summary The log_sync batch-collection tests race the production idle grace against wall-clock pacing from a second thread, and intermittently fail the pkgs/id check phase — which gates every NixOS ...
Opengraph URL: https://github.com/developing-today/code/issues/3199
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"pkgs/id: log_sync batch-collection tests are load-racy (5ms grace vs 2ms pacing), intermittently fail the nix check phase","articleBody":"## Summary\n\nThe `log_sync` batch-collection tests race the production idle grace against wall-clock pacing from a second thread, and intermittently fail the `pkgs/id` check phase — which gates every NixOS system build (`id-web` → `unit-id-primary.service` → system toplevel). The assertions are correct; the timing margin is not.\n\nFound while verifying the fix for #3160: with the five failures from that issue fixed, a `nix build .#id-web` check phase failed on exactly these two tests (1974 passed; 2 failed), and a local full-suite run failed one of them.\n\n## The failing tests\n\n- `log_sync::tests::test_batch_collection_coalesces_paced_arrivals` — batch length 2, expected 3 (\"paced arrivals share one batch\", src/log_sync.rs:1030)\n- `log_sync::tests::test_batch_collection_refused_stream_ends_at_the_total_cap` — batch length 1, expected 256 (\"a refused stream ends the batch at the total-arrival cap\", src/log_sync.rs:1119)\n\nA third sibling, `test_batch_collection_grace_restarts_on_each_arrival`, shares the design and the exposure.\n\n## Mechanism\n\n`collect_batch` (src/log_sync.rs:554) waits out an idle `BATCH_GRACE` of **5 ms** (src/log_sync.rs:86) for the next arrival, polling every 250 µs. The tests pace arrivals every **2 ms** from a spawned thread. Any scheduler delay over 5 ms on either thread — routine on a loaded 16-core build machine (observed at load 12–24 with parallel builds running) — splits the batch or ends it early. Measured behaviour tracks load exactly:\n\n- Solo re-runs at load ~12: 26/26 passes across the three pacing tests.\n- Solo re-runs at load 20+: `refused_stream` failed 4 of 6.\n- Full-suite runs under load: at least one of the two fails most of the time.\n\n## Prior attempt\n\nce8305622 (\"fix(id): deterministic log_sync pacing & world_doctor mock\", for #187) replaced the test-side first-arrival spin with `blocking_recv`. That removed one race but not this one: the pacer/grace wall-clock race is still live.\n\n## Impact\n\nThe id check phase sits on the critical path of every system build, so this is a load-dependent coin flip on every deploy, unrelated to whatever change is being shipped.\n\n## Suggested direction\n\nNot prescribed, but one clean shape: give `collect_batch` an internal grace parameter (production call passes `BATCH_GRACE`; tests pass a generous grace), so the coalescing / grace-restart / cap behaviour is asserted without a 2 ms vs 5 ms wall-clock margin. The production 5 ms tuning stays exactly as is. These tests should not be excluded or ignored — what they assert is the ingest batching contract.\n\n## Acceptance criteria\n\n- The three pacing-sensitive `log_sync` batch-collection tests pass deterministically under load (repeated full-suite runs at load 20+), not only in solo re-runs.\n- The fix removes the wall-clock race (deterministic synchronisation or an injected/controllable grace) rather than widening the 5 ms grace or the 2 ms pacing as a band-aid, unless the issue discussion records why a margin change is the right fix.\n- The `pkgs/id` check phase passes with these tests included — no check-phase exclusions.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-31T19:54:14Z","url":"https://github.com/developing-today/code/issues/3199"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a598bcae-9c6f-15d1-a434-897018ff19da |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C9CC:3422CF:CDF0D1:109FE11:6B064180 |
| html-safe-nonce | 755a2480decfae155a11114207d56cf5ab43ba2f0d1a8e1f4737200d6e635b88 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOUNDOjM0MjJDRjpDREYwRDE6MTA5RkUxMTo2QjA2NDE4MCIsInZpc2l0b3JfaWQiOiI3MTEwMDA5MTgyODA3ODAyMjQwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 545fe2e4dd481c4b00028b09ffe0932c0ed8470150b6ef2bf3cac92c6c72c302 |
| hovercard-subject-tag | issue:6139127410 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/3199/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5a06ec9445945247a964263eca380b1758f6030697dc2a16ad7d7ab2570a87e8/developing-today/code/issues/3199 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5a06ec9445945247a964263eca380b1758f6030697dc2a16ad7d7ab2570a87e8/developing-today/code/issues/3199 |
| og:image:alt | Summary The log_sync batch-collection tests race the production idle grace against wall-clock pacing from a second thread, and intermittently fail the pkgs/id check phase — which gates every NixOS ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1bff4f6bfaa96dc9c42cacf315424c24ebb548b06142ced5e3aaccb2a42dd652 |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ac613d3698d3d8565651455086e1f74da07bf277 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width