Azure / Azure/azure-libraries-for-java

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

オープン
#433 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
Bug Compute Compute - VM customer-reported
主要言語
Java
スター
97
フォーク
102
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

VirtualMachineImpl.java の getPrimaryPublicIPAddressId() から開始し、具体的には issue に示されているチェーン呼び出しを確認します。VM にネットワークインターフェースまたはパブリック IP がない、詰まった VM の状態を再現または調査し、その後、このメソッドがその状態で NPE をスローせず、適切な結果を返すことを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
api, cloud
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。