VR command aggregation drops commands and fails with NPE when two jobs aggregate on the same router
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 55/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- java
- Domaine
- cloud, infrastructure
Piste de recherche
Start with core/.../agent/resource/virtualnetwork/VirtualRoutingResource.java and trace how AggregationControlCommand Start and Finish access the per-router queue, _vrLockMap, and aggregation map. Check the agent request threading and related tests before changing these shared maps. Done means concurrent aggregation for one router does not replace or misapply queued commands, create inconsistent locks, or fail when Finish finds no queue; add coverage for those cases.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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:
AggregationControlCommandStart 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
NetworkElementCommandfor 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 thefinallyblock throwjava.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
- Create a VPC with redundant routers on KVM.
- Create several tiers and deploy VMs into them in parallel, for example 24 deploys across the tiers at once.
- 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 anAggregationControlCommandFinish withjava.lang.NullPointerException: Cannot invoke "java.util.Queue.clear()" because "queue" is null. - 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.
- Langage dominant
- Java
- Étoiles
- 3.1k
- Forks
- 1.4k
- Merge moyen
- 7 j 16 h
- PR mergées (30 j)
- 15
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de apache/cloudstack
-
resizeVolume of a running system VM's volume is accepted but the VM never sees the new sizePeut-être pris @bhouse-nexthop l’a pris il y a 3 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
apache/cloudstack#14645 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
VR reports a load balancer change as applied when haproxy.cfg cannot be replacedPeut-être pris @bhouse-nexthop l’a pris il y a 3 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
apache/cloudstack#14633 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
restartNetwork reports a ResourceUnavailableException as an unexpected error (530), unlike restartVPC (534)Peut-être pris @bhouse-nexthop l’a pris il y a 3 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
apache/cloudstack#14631 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
apache/cloudstack#14625 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Remote access VPN users are disconnected on every LB, ACL, port forward or firewall change (xl2tpd restarted on every iptables pass)Peut-être pris @willbennett-devops l’a pris il y a 12 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
apache/cloudstack#14545 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de apache/cloudstack
Issues similaires
-
untriaged
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
opensearch-project/opensearch-prometheus-exporter#680 ·
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
Les mainteneurs répondent en général sous 2 jours
-
bug
Difficulté 1/5 Moins d'une heure Accessibilité débutants 78/100
-
Good First Issue
Difficulté 1/5 1-3 heures Accessibilité débutants 88/100
hiero-ledger/hiero-sdk-java#3059 ·
Les mainteneurs répondent en général sous 1 jour
-
bug live-tv platform:desktop platform:mobile platform:tv
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
fk0u/cleanyourtv-tahoe#102 ·
Les mainteneurs répondent en général sous 1 jour