Azure / Azure/azure-libraries-for-java

vm.getPrimaryPublicIPAddressId() can throw NPE on wedged VM delete cases

Ouverte
#433 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Bug Compute Compute - VM customer-reported
Langage dominant
Java
Étoiles
97
Forks
102
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

I had a wedged VM delete that caused `vm.getPrimaryPublicIPAddressId()` to throw an NPE. Since this is a possible, albeit unlikely scenario, I think `VirtualMachineImpl.getPrimaryPublicIPAddressId()` should check for nulls during this method chain:
```
public String getPrimaryPublicIPAddressId() {
return this.getPrimaryNetworkInterface().primaryIPConfiguration().publicIPAddressId();
}
```

I got the VM into this state by doing a VM delete via the SDK (I believe) while the VM create (also via the SDK) was still in progress. This put the VM in a state where it shows up in the Azure portal Resource Group blade, however when you click on the VM to get more information it shows a "Not found" page. Neither the NIC nor the public IP show up in the RG blade -- essentially the VM "exists" (the SDK thinks the VM is not null), but is in a wedged state and does not have a NIC or a public IP.

**Additional Info**
SDK version 1.5.1

The message from the activity log:
```
"statusMessage": "{\"status\":\"Failed\",\"error\":{\"code\":\"ResourceOperationFailure\",\"message\":\"The resource operation completed with terminal provisioning state 'Failed'.\",\"details\":[{\"code\":\"Conflict\",\"message\":\"The request failed due to conflict with a concurrent request. \"}]}}",
```

And the stack trace:
```
java.lang.NullPointerException: null
at com.microsoft.azure.management.compute.implementation.VirtualMachineImpl.getPrimaryPublicIPAddressId(VirtualMachineImpl.java:1460)
...
```

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez dans VirtualMachineImpl.java, au niveau de getPrimaryPublicIPAddressId(), plus précisément avec les appels chaînés présentés dans l’issue. Reproduisez ou inspectez l’état bloqué de la VM dans lequel la VM n’a pas d’interface réseau ou d’IP publique, puis vérifiez que cette méthode ne lève plus de NPE et renvoie le résultat approprié pour cet état.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java
Domaine
api, cloud
Type d'issue
Bug
Difficulté
2/5
Temps estimé
1-3 heures
Activité
À l'abandon
Clarté
Clairement spécifiée
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.