next.js
45a8a82d - Turbopack: Aggregation update improvements (#90139)

Commit
24 days ago
Turbopack: Aggregation update improvements (#90139) ## Summary - Remove negative count handling in aggregation updates since unsigned ints can't be negative - Add `aggregation_update_no_batch` feature flag for debugging (falls back to non-batched single-item processing) - Fix concurrency bug in inner/follower classification: add retry loop to `inner_of_upper_has_new_follower` and its batched variants to correctly handle concurrent aggregation number changes - Add proper `ctx.should_track_activeness()` guards to avoid unnecessary activeness checks - Move per-iteration state inside the loop in `inner_of_upper_has_new_followers` to prevent stale values across iterations - Remove unnecessary `BalanceEdge` for inner nodes (now handled by the retry loop) - Fix optimize check to use `added_uppers` instead of `persistent_uppers` ## Details The main fix addresses a concurrency issue where the follower's aggregation number was read without holding a lock, and the inner-vs-follower decision could be incorrect if it changed concurrently. The new loop re-verifies the classification under the correct lock, ensuring only one task is locked at a time while still making the correct decision. All three variants (`inner_of_upper_has_new_follower`, `inner_of_uppers_has_new_follower`, `inner_of_upper_has_new_followers`) now follow the same STEP-numbered algorithm for consistency. ## Test plan - [x] Existing aggregation tests pass - [x] Verify with `aggregation_update_no_batch` feature flag that batched and non-batched paths produce equivalent results
Author
Parents
Loading