Azure / Azure/azure-libraries-for-java

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

Abierto
#433 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Bug Compute Compute - VM customer-reported
Lenguaje dominante
Java
Estrellas
97
Forks
102
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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)
...
```

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Start in VirtualMachineImpl.java at getPrimaryPublicIPAddressId(), specifically the chained calls shown in the issue. Reproduce or inspect the wedged VM state where the VM lacks a network interface or public IP, then verify that this method no longer throws an NPE and returns the appropriate result for that state.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java
Área
api, cloud
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.