Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG][JAVA SDK]subnet's method "listNetworkInterfaceIPConfigurations" throws an exception in case of Bastion's subnet but it works for normal subnet. #43070

Closed
3 tasks
abhishekpankaj54 opened this issue Nov 22, 2024 · 12 comments · Fixed by #43082
Assignees
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team Network question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@abhishekpankaj54
Copy link

Describe the bug
We use the method listNetworkInterfaceIPConfigurations to list the network interface IP configuration of the subnet but it throws an exception for bastion's subnet. I observed below:

Bastion's Subnet: It does not have an interface and it throws an exception like the below:
Got exception
com.azure.core.management.exception.ManagementException: Status code 404, "{"error":{"code":"ResourceNotFound","message":"The Resource 'Microsoft.Network/networkInterfaces/TESTBASTION' under resource group 'TESTBASTION' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix"}}"
at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732)
at com.azure.core.implementation.MethodHandleReflectiveInvoker.invokeWithArguments(MethodHandleReflectiveInvoker.java:35)
at com.azure.core.implementation.http.rest.ResponseExceptionConstructorCache.invoke(ResponseExceptionConstructorCache.java:51)
at com.azure.core.implementation.http.rest.RestProxyBase.instantiateUnexpectedException(RestProxyBase.java:356)
at com.azure.core.implementation.http.rest.AsyncRestProxy.lambda$ensureExpectedStatus$1(AsyncRestProxy.java:128)
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:113)
at reactor.core.publisher.Operators$ScalarSubscription.request(Operators.java:2400)
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.request(FluxMapFuseable.java:171)
at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.set(Operators.java:2196)
at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onSubscribe(Operators.java:2070)
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onSubscribe(FluxMapFuseable.java:96)
at reactor.core.publisher.MonoJust.subscribe(MonoJust.java:55)
at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:157)
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:129)
at reactor.core.publisher.FluxHide$SuppressFuseableSubscriber.onNext(FluxHide.java:137)
at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:122)
at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:79)
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1839)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:151)
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1839)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:151)

Other subnet: Even if we do not have an interface too it does not throw any exception. it simple return an response as null/blank like below:

DEBUG_LOG after listNetworkInterfaceIPConfigurations[]

Exception or Stack Trace
Got exception
com.azure.core.management.exception.ManagementException: Status code 404, "{"error":{"code":"ResourceNotFound","message":"The Resource 'Microsoft.Network/networkInterfaces/TESTBASTION' under resource group 'TESTBASTION' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix"}}"
at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732)
at com.azure.core.implementation.MethodHandleReflectiveInvoker.invokeWithArguments(MethodHandleReflectiveInvoker.java:35)
at com.azure.core.implementation.http.rest.ResponseExceptionConstructorCache.invoke(ResponseExceptionConstructorCache.java:51)
at com.azure.core.implementation.http.rest.RestProxyBase.instantiateUnexpectedException(RestProxyBase.java:356)
at com.azure.core.implementation.http.rest.AsyncRestProxy.lambda$ensureExpectedStatus$1(AsyncRestProxy.java:128)
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:113)
at reactor.core.publisher.Operators$ScalarSubscription.request(Operators.java:2400)
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.request(FluxMapFuseable.java:171)
at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.set(Operators.java:2196)
at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onSubscribe(Operators.java:2070)
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onSubscribe(FluxMapFuseable.java:96)
at reactor.core.publisher.MonoJust.subscribe(MonoJust.java:55)
at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:157)
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:129)
at reactor.core.publisher.FluxHide$SuppressFuseableSubscriber.onNext(FluxHide.java:137)
at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:122)
at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:79)
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1839)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:151)
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1839)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:151)

To Reproduce
Just create the bastion and its Vnet and subnet newly write a sample program and use below method

Collection nicIPConfigurations = subnet.listNetworkInterfaceIPConfigurations();

Code Snippet
Collection nicIPConfigurations = subnet.listNetworkInterfaceIPConfigurations();

Expected behavior
it should return null or value but not exception.
Screenshots
If applicable, add screenshots to help explain your problem.

Setup (please complete the following information):

  • OS: [e.g. iOS]

  • IDE: [e.g. IntelliJ]

  • Library/Libraries: [e.g. com.azure:azure-core:1.16.0 (groupId:artifactId:version)] package com.azure.resourcemanager.network.models;

  • class name:
    public interface Subnet extends HasInnerModel, ChildResource {

    /**

    • @return network interface IP configurations that are associated with this subnet
    • <p>Note that this call may result in multiple calls to Azure to fetch all the referenced interfaces each time
      
    • it is invoked.
      

    */
    Collection listNetworkInterfaceIPConfigurations();

  • Java version: [e.g. 8] java 17

  • App Server/Environment: [e.g. Tomcat, WildFly, Azure Function, Apache Spark, Databricks, IDE plugin or anything special]

  • Frameworks: [e.g. Spring Boot, Micronaut, Quarkus, etc]

If you suspect a dependency version mismatch (e.g. you see NoClassDefFoundError, NoSuchMethodError or similar), please check out Troubleshoot dependency version conflict article first. If it doesn't provide solution for the problem, please provide:

  • verbose dependency tree (mvn dependency:tree -Dverbose)
  • exception message, full stack trace, and any available logs

Additional context
Add any other context about the problem here.

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Bug Description Added
  • Repro Steps Added
  • Setup information Added
@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Nov 22, 2024
@abhishekpankaj54 abhishekpankaj54 changed the title [BUG]subnet's method "listNetworkInterfaceIPConfigurations" throws an exception in case of Bastion's subnet but it works for normal subnet. [BUG][JAVA SDK]subnet's method "listNetworkInterfaceIPConfigurations" throws an exception in case of Bastion's subnet but it works for normal subnet. Nov 25, 2024
@abhishekpankaj54
Copy link
Author

@weidongxu-microsoft , Could you Please look into this Urgently?

@weidongxu-microsoft weidongxu-microsoft self-assigned this Nov 25, 2024
@weidongxu-microsoft
Copy link
Member

weidongxu-microsoft commented Nov 25, 2024

@abhishekpankaj54

Would you let me know about the detail of the bastion? (I'd need to be sure I am doing the correct thing to reproduce)
Is it created via e.g. below?

        azure.networks().manager().serviceClient().getBastionHosts()
                .createOrUpdate(rgName, "bastion1weidxu",
                        new BastionHostInner()
                                .withLocation(region.toString())
                                .withIpConfigurations(Collections.singletonList(
                                        new BastionHostIpConfiguration()
                                                .withName("ipconfig1")
                                                .withSubnet(network.subnets().get("AzureBastionSubnet").innerModel())
                                                .withPrivateIpAllocationMethod(IpAllocationMethod.DYNAMIC)
                                                .withPublicIpAddress(new SubResource().withId(publicIpBastion.id())))));

(if you create it via Portal or CLI, also let me know the page or command)

Then we call listNetworkInterfaceIPConfigurations on the subnet (AzureBastionSubnet as above)?

@abhishekpankaj54
Copy link
Author

@weidongxu-microsoft ,

Here are the details:

Bastion: Created via Portal, which has the default bastion subnet.

I have attached the screenshot of Bastion. Image

Program snippet:

We first get all Virtual networks of the specific region and fetch the subnet's details(like name,id , and all) of each Virtual network by looping.

Collection nicIPConfigurations = subnet.listNetworkInterfaceIPConfigurations();

Our program does not have any extra calls for Bastion. It simply gets the Vnet loops, each of the Vnet gets the details of the subnet, and stores them in the map.

@weidongxu-microsoft
Copy link
Member

PR #43082

@abhishekpankaj54
Copy link
Author

@weidongxu-microsoft ,

This is not only happening for Bastion I just saw it failed for one of my normal Vnet, but when I checked the connected device of this Vnet it showed that NIC but when I clicked on that it showed resource not found

Exception in thread "main" com.azure.core.management.exception.ManagementException: Status code 404, "{"error":{"code":"ResourceNotFound","message":"The Resource 'Microsoft.Network/networkInterfaces/ENV1913AZ-NIC' under resource group 'ENV1913AZ-RESOURCEGROUP' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix"}}": The Resource 'Microsoft.Network/networkInterfaces/ENV1913AZ-NIC' under resource group 'ENV1913AZ-RESOURCEGROUP' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732)
at com.azure.core.implementation.MethodHandleReflectiveInvoker.invokeWithArguments(MethodHandleReflectiveInvoker.java:39)
at com.azure.core.implementation.http.rest.ResponseExceptionConstru

Image

Image

@abhishekpankaj54
Copy link
Author

abhishekpankaj54 commented Nov 25, 2024

@weidongxu-microsoft , When are you going to release this fix? ETA and Version, please. This is very critical for us as many customers are impacted due to this.

@alzimmermsft alzimmermsft added the Mgmt This issue is related to a management-plane library. label Nov 25, 2024
@github-actions github-actions bot removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Nov 25, 2024
@github-actions github-actions bot added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Nov 25, 2024
@weidongxu-microsoft
Copy link
Member

@abhishekpankaj54

The next release would be 2.45.0 this week.

I am still thinking what happens to the case that the NIC could not be find. And what SDK should do in such case (throw, or log error).

@XiaofeiCao
Copy link
Contributor

XiaofeiCao commented Nov 26, 2024

This is not only happening for Bastion I just saw it failed for one of my normal Vnet, but when I checked the connected device of this Vnet it showed that NIC but when I clicked on that it showed resource not found

@abhishekpankaj54 Is this 404 NIC deleted? Maybe this is a bug for Connected devices that even if the NIC is deleted, it still shows this deleted NIC.

Or maybe you don't have permission to view this NIC? Though I assume it should show 403 instead of 404..

@abhishekpankaj54
Copy link
Author

@XiaofeiCao , @weidongxu-microsoft ,

It looks like there are two bugs for me:

1)The UI shows the deleted NIC.
2)The method listNetworkInterfaceIPConfigurations also tries to list the deleted NIC.
I got the same error with "listNetworkInterfaceIPConfigurations"

"Exception in thread "main" com.azure.core.management.exception.ManagementException: Status code 404, "{"error":{"code":"ResourceNotFound","message":"The Resource 'Microsoft.Network/networkInterfaces/ENV1913AZ-NIC' under resource group 'ENV1913AZ-RESOURCEGROUP' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix"}}": The Resource 'Microsoft.Network/networkInterfaces/ENV1913AZ-NIC' under resource group 'ENV1913AZ-RESOURCEGROUP' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix"

@XiaofeiCao , I have the necessary permissions, and if it is a permission issue, then why listNetworkInterfaceIPConfigurations is also throwing the same error 404.

@abhishekpankaj54
Copy link
Author

abhishekpankaj54 commented Nov 26, 2024

@weidongxu-microsoft , Are we going to handle both(bastion and normal subnet(deleted NIC)) the cases in the fix?

@weidongxu-microsoft
Copy link
Member

weidongxu-microsoft commented Nov 26, 2024

Yes, I am also ignoring the 404 on NIC in the fix (log a warning instead).

@abhishekpankaj54
Copy link
Author

@weidongxu-microsoft , Thanks for the Update, please update me once it is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team Network question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants