Skip to content

VR command aggregation drops commands and fails with NPE when two jobs aggregate on the same router #14639

Open

Description

@bhouse-nexthop

problem

Command aggregation on a virtual router isn't safe when two jobs aggregate commands for the same router at the same time. Parallel tier deploys in one VPC do this. Commands get dropped, and jobs fail with a NullPointerException.

VirtualRoutingResource (core/.../agent/resource/virtualnetwork/VirtualRoutingResource.java) keeps one aggregation queue per router name in a HashMap:

  • AggregationControlCommand Start puts a new queue for the router. A second Start while one exists replaces it, so the commands the first job has queued so far are never applied. Their answers were already successful, because a queued command is answered with success at once.
  • Every other NetworkElementCommand for that router goes into whichever queue is current.
  • Finish applies the current queue and removes it. The first job's Finish applies the second job's queue, and the second job's Finish then finds no queue. The loop and then queue.clear() in the finally block throw java.lang.NullPointerException: Cannot invoke "java.util.Queue.clear()" because "queue" is null.

The result is that one job fails, and another reports success although some of its configuration never reached the router.

The per-router lock map (_vrLockMap) and the aggregation map are also plain HashMaps changed from parallel agent request threads. The lock is created with a check-then-put, so two threads can get different locks for the same router.

This may be one cause of #11710: with redundant routers, the two routers of a VPC can end up with different configurations.

versions

4.22 (the code is the same on main and 4.20).

The steps to reproduce the bug

  1. Create a VPC with redundant routers on KVM.
  2. Create several tiers and deploy VMs into them in parallel, for example 24 deploys across the tiers at once.
  3. Some deploys fail. The management server logs Failed to re-program the network as a part of network ... implement due to aggregated commands execution failure!, and the router's host agent answers an AggregationControlCommand Finish with java.lang.NullPointerException: Cannot invoke "java.util.Queue.clear()" because "queue" is null.
  4. In our lab run, 12 of 24 parallel tier deploys failed. In two of three rounds, the two routers ended up with different keepalived VIP sets, and both were PRIMARY.

What to do about it?

  • On the agent:
    • do not replace an existing queue on Start;
    • do not fail with an NPE on a Finish whose queue was already applied;
    • make the maps thread-safe.
  • A complete fix would serialise aggregated applies per router on the management server, or tag each aggregation with an id. That is a larger change.

Activity

  1. github-actions commented on Nov 10, 2026

    @github-actions

    Warning

    threat detection engine error
    The threat detection engine encountered an error and could not complete analysis. This is a tooling failure, not a security finding.

    What happened

    The threat detection engine failed to produce results.

    Review the workflow run logs for details.

    🎯 Triage report

    Parallel aggregated commands on one VR can drop configuration and fail. Starting a second aggregation replaces the first queue, so commands the first job queued are lost. The second Finish then finds no queue and throws an NPE. The per-router maps are plain HashMaps used from parallel request threads. The reporter suggests this may be one cause of #11710 (redundant VPC routers ending with different configurations).

    📊 Assessment

    Dimension Value Reasoning
    Type type:bug Concurrency issue that loses configuration
    Component component:virtual-router VirtualRoutingResource aggregation on the agent
    Severity Severity:Major Failed deploys and possible divergence between redundant routers
    Labels type:bug, component:virtual-router, Severity:Major
    Coding agent Needs more info The agent-side change is small, but a complete fix needs per-router serialisation or tagged aggregations on the management server

    🔗 Similar issues

    💡 Notes and suggestions
    • Reproduction: VPC with redundant routers on KVM, then deploy VMs into several tiers in parallel.
    • Maintainers should decide whether the fix stays on the agent or also adds serialisation on the management server.

    Generated by Daily Issue Triage · copilot · haiku55 · ~5 AIC · ⊞ 3.8K · ◷

    Add this agentic workflow to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/daily-issue-triage.md@139fa09ef17cde4135e696ff8e7af09bc5ddfa6e
    
  2. added this to the 4.20.4 milestone on Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions