Turbopack: ensure tests are dropping turbo tasks correctly (#99601)
### What? Let the unit tests check if we cleanup correctly: after `stop_and_wait()`, the test harness checks that it holds the only reference to the `TurboTasks` instance, then drops it. Recreates #85612, rebased on latest `canary`. ### Details - `stop_and_wait()` returns once all jobs have signaled completion, but the spawned futures that ran them (e.g. priority-runner workers, background jobs) may still be dropping their `Arc<TurboTasks>` clones at that point. An immediate `Arc::strong_count == 1` assertion therefore fails nondeterministically (33 of 1166 tests locally), even though the references are released shortly after. - Instead of adding tracking overhead to the manager, the harness polls (1 ms sleeps) until `Arc::strong_count` reaches 1, and panics with the remaining reference count after 10 s. Real leaks are still caught. - Adapted to `TestInstance`: the `snapshot_and_evict` closure (which holds its own reference) is dropped before the check. ### Verification - `cargo nextest run` for turbo-tasks-backend, turbo-tasks-fetch, turbo-tasks-fs, turbo-tasks-macros-tests, turbopack-analyze, turbopack-core, turbopack-ecmascript, turbopack-node, turbo-tasks-testing: 1166 passed. - turbo-tasks-backend + turbo-tasks-fetch repeated 3×: all passing. <!-- NEXT_JS_LLM --> <!-- fleet 9f22b386-e1c1-48c7-b471-5ec406e064fe --> --------- Co-authored-by:vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Tobias Koppers <1365881+sokra@users.noreply.github.com>
Showing
Please
register
or
sign in
to comment