Repository navigation
VR: don't drop aggregated commands when two jobs aggregate on one router - #14640
bhouse-nexthop wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.20 #14640 +/- ##
============================================
+ Coverage 16.45% 16.49% +0.03%
- Complexity 13710 13741 +31
============================================
Files 5669 5669
Lines 501734 501748 +14
Branches 60961 60964 +3
============================================
+ Hits 82584 82765 +181
+ Misses 409895 409701 -194
- Partials 9255 9282 +27
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Test report: parallel tier deploys on a redundant VPCSummary: I repeated the parallel tier bring-up that found #14639, for 40 deploys in 5 rounds. Every deploy succeeded. The concurrent aggregation the bug is about happened 27 times on one router. Each time, the second Start joined the queue and the late Finish reported the earlier apply's result. There was no NPE. After every round both routers had all 8 tiers, identical keepalived VIP sets, and exactly one PRIMARY. The stock run failed half its deploys. Environment
Method
Results
Before this PR, with the same shape (the earlier stock run, 3 rounds of 8):
The race was hit, and handled
Note on round 2: the routers swapped roles: router 2 was PRIMARY and router 1 BACKUP. There was still exactly one PRIMARY, and both routers had the same configuration. From round 3 on, router 1 was PRIMARY again. Result: pass. Concurrent aggregations on one router no longer drop commands or fail jobs. 40 of 40 parallel deploys succeeded. Before the PR, 12 of 24 failed with the same shape. Both routers end each round with every tier configured, the same VIPs and one PRIMARY. Not covered
|
|
I would understand if you can't be bothered, but you reported this to be on 4.20 as well. Are you willing to rebase this @bhouse-nexthop ? |
VirtualRoutingResource keeps one aggregation queue per router name. When two jobs aggregate commands for the same router at the same time, for example parallel tier deploys in one VPC: - the second Start replaces the first job's queue, so the commands the first job queued so far are never applied, while their answers already reported success; - the first Finish applies the second job's queue and removes it, so the second Finish finds no queue and fails with a NullPointerException on Queue.clear(). The per-router lock map and the aggregation map were also plain HashMaps changed from parallel agent request threads, and the lock was created with a check-then-put, so two threads could get different locks for the same router. - A Start while a queue exists now joins it instead of replacing it. The first Finish applies the commands of both jobs. - A Finish with no queue no longer fails with an NPE. Its commands were applied by the Finish that ran before it, or directly after that, so it returns the result of the last aggregated apply on the router: success, or that apply's failure details. - The maps are synchronized and the lock is created with computeIfAbsent. The aggregation of a single job behaves as before. Signed-off-by: Brad House <[email protected]>
cf7272f to
f7282a1
Compare
|
@DaanHoogland happy to. It's rebased onto 4.20 and the PR now targets 4.20 (f7282a1). The commit applied cleanly, and |
|
@blueorangutan package |
|
@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 20016 |
|
The Simulator CI failure on the 4.20 retarget is the runner failing to resolve the Ubuntu apt mirror in "Install Build Dependencies" (every job failed at that step, before any test ran). The other workflows, including Build and the unit tests, passed. Could someone re-run Simulator CI when convenient? |
Description
This PR stops the virtual router agent from dropping aggregated commands, and from failing with an NPE, when two jobs aggregate commands for the same router at the same time. Parallel tier deploys in one VPC do this.
VirtualRoutingResourcekeeps one aggregation queue per router. Before this change:AggregationControlCommandStart replaced the first job's queue, so the commands queued so far were never applied, although they had already been answered with success.NullPointerExceptiononQueue.clear().Changes, all in
VirtualRoutingResource:Collections.synchronizedMap, so null router names behave as before. The per-router lock is created withcomputeIfAbsent. Before, two threads could create two different locks for one router. The aggregation maps are still only changed for a router while holding that router's lock.asserton Start that no queue exists is removed, since that case is now handled.A single aggregation, with no overlap, behaves exactly as before.
Limits of this change:
This may help #11710, but I haven't verified that it fixes it.
Fixes: #14639
Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
How Has This Been Tested?
VirtualRoutingResourceAggregationTestincore(mvn -pl core -am test -Dtest=VirtualRoutingResourceAggregationTest), 5 tests, all pass. It uses a mockedVirtualRouterDeployer:VirtualRoutingResourceTestis@Ignored upstream, so it didn't run.aggregated commands execution failure;Queue.clear()NPE in the agent logs;