Azure / azure-sdk-for-java

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.
MIT License
2.31k stars 1.96k forks source link

[BUG]Java resource management SDK Failed with AZURE_CHINA #18664

Closed ylgtang closed 3 years ago

ylgtang commented 3 years ago

Describe the bug Call sdk under package com.azure.* with AzureEnvironment.AZURE_CHINA caused ManagementException, Error detail is "code":"SubscriptionNotFound","message":"The subscription 'xxxxxxx' could not be found." Tested VM creation and disks().getById() and virtualMachines().getById(). But interface on network interface can execute success, include create network interface and networkInterfaces().getById(). My technical support engineer told me he can execute it with global account, as I hava not global account, and have not test it.

Exception or Stack Trace java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293) at java.lang.Thread.run(Thread.java:745) Caused by: com.azure.core.management.exception.ManagementException: Status code 404, "{"error":{"code":"SubscriptionNotFound","message":"The subscription 'xxxxxx' could not be found."}}": The subscription 'xxxxxx' could not be found. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at com.azure.core.http.rest.RestProxy.instantiateUnexpectedException(RestProxy.java:334) at com.azure.core.http.rest.RestProxy.lambda$ensureExpectedStatus$5(RestProxy.java:375) at com.azure.core.http.rest.RestProxy$$Lambda$272/548885561.apply(Unknown Source) at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:118) at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1782) at reactor.core.publisher.MonoCacheTime$CoordinatorSubscriber.signalCached(MonoCacheTime.java:320) at reactor.core.publisher.MonoCacheTime$CoordinatorSubscriber.onNext(MonoCacheTime.java:337) at reactor.core.publisher.Operators$ScalarSubscription.request(Operators.java:2344) at reactor.core.publisher.MonoCacheTime$CoordinatorSubscriber.onSubscribe(MonoCacheTime.java:276) at reactor.core.publisher.FluxFlatMap.trySubscribeScalarMap(FluxFlatMap.java:191) at reactor.core.publisher.MonoFlatMap.subscribeOrReturn(MonoFlatMap.java:53) at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:57) at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52) at reactor.core.publisher.MonoCacheTime.subscribeOrReturn(MonoCacheTime.java:132) at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:57) at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:150) at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:114) at reactor.core.publisher.MonoNext$NextSubscriber.onNext(MonoNext.java:76) at reactor.core.publisher.FluxReplay$UnboundedReplayBuffer.replayNormal(FluxReplay.java:570) at reactor.core.publisher.FluxReplay$UnboundedReplayBuffer.replay(FluxReplay.java:657) at reactor.core.publisher.FluxReplay$ReplayInner.request(FluxReplay.java:1463) at reactor.core.publisher.MonoNext$NextSubscriber.request(MonoNext.java:102) at reactor.core.publisher.FluxMap$MapSubscriber.request(FluxMap.java:155) at reactor.core.publisher.MonoFlatMap$FlatMapMain.onSubscribe(MonoFlatMap.java:103) at reactor.core.publisher.FluxMap$MapSubscriber.onSubscribe(FluxMap.java:86) at reactor.core.publisher.MonoNext$NextSubscriber.onSubscribe(MonoNext.java:64) at reactor.core.publisher.FluxReplay.subscribeOrReturn(FluxReplay.java:1114) at reactor.core.publisher.FluxReplay.subscribe(FluxReplay.java:1086) at reactor.core.publisher.FluxAutoConnectFuseable.subscribe(FluxAutoConnectFuseable.java:60) at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64) at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:150) at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:114) at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:114) at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:73) at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1782) at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:144) at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1782) at reactor.core.publisher.MonoFlatMap$FlatMapInner.onNext(MonoFlatMap.java:241) at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1782) at reactor.core.publisher.MonoFlatMap$FlatMapInner.onNext(MonoFlatMap.java:241) at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1782) at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:144) at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:121) at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1782) at reactor.core.publisher.MonoCollect$CollectSubscriber.onComplete(MonoCollect.java:152) at reactor.core.publisher.FluxReplay$UnboundedReplayBuffer.replayNormal(FluxReplay.java:554) at reactor.core.publisher.FluxReplay$UnboundedReplayBuffer.replay(FluxReplay.java:657) at reactor.core.publisher.FluxReplay$ReplaySubscriber.onComplete(FluxReplay.java:1272) at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onComplete(FluxMapFuseable.java:144) at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onComplete(FluxMapFuseable.java:144) at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1783) at reactor.core.publisher.MonoCollect$CollectSubscriber.onComplete(MonoCollect.java:152) at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:136) at reactor.core.publisher.FluxDoFinally$DoFinallySubscriber.onComplete(FluxDoFinally.java:138) at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:136) at reactor.netty.channel.FluxReceive.onInboundComplete(FluxReceive.java:374) at reactor.netty.channel.ChannelOperations.onInboundComplete(ChannelOperations.java:373) at reactor.netty.channel.ChannelOperations.terminate(ChannelOperations.java:429) at reactor.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:655) at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:96) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436) at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296) at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1526) at io.netty.handler.ssl.SslHandler.decodeNonJdkCompatible(SslHandler.java:1287) at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1324) at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:501) at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:440) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ... 1 more Suppressed: java.lang.Exception: #block terminated with an error at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:99) at reactor.core.publisher.Mono.block(Mono.java:1680) at com.azure.resourcemanager.resources.fluentcore.arm.collection.implementation.GroupableResourcesImpl.getById(GroupableResourcesImpl.java:61) at com.azure.resourcemanager.resources.fluentcore.arm.collection.implementation.GroupableResourcesImpl.getById(GroupableResourcesImpl.java:27) at com.azure.resourcemanager.compute.samples.CreateVirtualMachineUsingCustomImageFromVM.t003(CreateVirtualMachineUsingCustomImageFromVM.java:443) at com.azure.resourcemanager.compute.samples.CreateVirtualMachineUsingCustomImageFromVM.main(CreateVirtualMachineUsingCustomImageFromVM.java:53) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293) ... 1 more

To Reproduce Register an application in azure portal and get application information. Execute demo managed-disk-java-create-virtual-machine-using-custom-image using the application information

Code Snippet String clientId = "xxx", clientSecret = "xxx",
tenantId = "xxx", subscriptionId = "xxx";

    AzureEnvironment environment = AzureEnvironment.AZURE_CHINA;
    AzureProfile profile = new AzureProfile(tenantId, subscriptionId, environment);
    TokenCredential credential = new ClientSecretCredentialBuilder()
            .clientId(clientId).clientSecret(clientSecret)
            .tenantId(tenantId)
            .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint())
            .build();
    AzureResourceManager manager = AzureResourceManager.configure().withLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)
            .authenticate(credential, profile) .withDefaultSubscription();
    String nicId = "xxx";
    NetworkInterface nic = manager.networkInterfaces().getById(nicId);
    Utils.print(nic);
    String diskId = "xxxxxxx";
    Disk dataDisk = manager.disks().getById(diskId);  <-- cause exception

Setup (please complete the following information):

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

joshfree commented 3 years ago

Hi @ylgtang, thank you for filing this issue. Someone from the Mgmt plane SDK team will follow up with you shortly. Thanks

yungezz commented 3 years ago

hi @xccc-msft could you pls help to have a look? thanks

xseeseesee commented 3 years ago

@ylgtang The error of SubscriptionNotFound is from service response. Can you please double check if the subscription ID inside disk ID is expected? If so, I could add Service Attention so the service team may help check from backend. Thanks.

ylgtang commented 3 years ago

@ylgtang The error of SubscriptionNotFound is from service response. Can you please double check if the subscription ID inside disk ID is expected? If so, I could add Service Attention so the service team may help check from backend. Thanks.

As I can get network interface using the subscription ID, but all other API calling like get disk is failed, the subscription ID should be correct. Also, these API calling are all succeeded using the old version sdk(com.microsoft.azure.*).

xseeseesee commented 3 years ago

@ylgtang Thanks for confirming this. Then I will add Service Attention so we could get help from service team for this.

ghost commented 3 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Drewm3, @avirishuv.

Issue Details
**Describe the bug** Call sdk under package com.azure.* with AzureEnvironment.AZURE_CHINA caused ManagementException, Error detail is "code":"SubscriptionNotFound","message":"The subscription 'xxxxxxx' could not be found." Tested VM creation and disks().getById() and virtualMachines().getById(). But interface on network interface can execute success, include create network interface and networkInterfaces().getById(). My technical support engineer told me he can execute it with global account, as I hava not global account, and have not test it. ***Exception or Stack Trace*** java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293) at java.lang.Thread.run(Thread.java:745) Caused by: com.azure.core.management.exception.ManagementException: Status code 404, "{"error":{"code":"SubscriptionNotFound","message":"The subscription 'xxxxxx' could not be found."}}": The subscription 'xxxxxx' could not be found. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at com.azure.core.http.rest.RestProxy.instantiateUnexpectedException(RestProxy.java:334) at com.azure.core.http.rest.RestProxy.lambda$ensureExpectedStatus$5(RestProxy.java:375) at com.azure.core.http.rest.RestProxy$$Lambda$272/548885561.apply(Unknown Source) at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:118) at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1782) at reactor.core.publisher.MonoCacheTime$CoordinatorSubscriber.signalCached(MonoCacheTime.java:320) at reactor.core.publisher.MonoCacheTime$CoordinatorSubscriber.onNext(MonoCacheTime.java:337) at reactor.core.publisher.Operators$ScalarSubscription.request(Operators.java:2344) at reactor.core.publisher.MonoCacheTime$CoordinatorSubscriber.onSubscribe(MonoCacheTime.java:276) at reactor.core.publisher.FluxFlatMap.trySubscribeScalarMap(FluxFlatMap.java:191) at reactor.core.publisher.MonoFlatMap.subscribeOrReturn(MonoFlatMap.java:53) at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:57) at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52) at reactor.core.publisher.MonoCacheTime.subscribeOrReturn(MonoCacheTime.java:132) at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:57) at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:150) at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:114) at reactor.core.publisher.MonoNext$NextSubscriber.onNext(MonoNext.java:76) at reactor.core.publisher.FluxReplay$UnboundedReplayBuffer.replayNormal(FluxReplay.java:570) at reactor.core.publisher.FluxReplay$UnboundedReplayBuffer.replay(FluxReplay.java:657) at reactor.core.publisher.FluxReplay$ReplayInner.request(FluxReplay.java:1463) at reactor.core.publisher.MonoNext$NextSubscriber.request(MonoNext.java:102) at reactor.core.publisher.FluxMap$MapSubscriber.request(FluxMap.java:155) at reactor.core.publisher.MonoFlatMap$FlatMapMain.onSubscribe(MonoFlatMap.java:103) at reactor.core.publisher.FluxMap$MapSubscriber.onSubscribe(FluxMap.java:86) at reactor.core.publisher.MonoNext$NextSubscriber.onSubscribe(MonoNext.java:64) at reactor.core.publisher.FluxReplay.subscribeOrReturn(FluxReplay.java:1114) at reactor.core.publisher.FluxReplay.subscribe(FluxReplay.java:1086) at reactor.core.publisher.FluxAutoConnectFuseable.subscribe(FluxAutoConnectFuseable.java:60) at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64) at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:150) at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:114) at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:114) at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:73) at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1782) at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:144) at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1782) at reactor.core.publisher.MonoFlatMap$FlatMapInner.onNext(MonoFlatMap.java:241) at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1782) at reactor.core.publisher.MonoFlatMap$FlatMapInner.onNext(MonoFlatMap.java:241) at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1782) at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:144) at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:121) at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1782) at reactor.core.publisher.MonoCollect$CollectSubscriber.onComplete(MonoCollect.java:152) at reactor.core.publisher.FluxReplay$UnboundedReplayBuffer.replayNormal(FluxReplay.java:554) at reactor.core.publisher.FluxReplay$UnboundedReplayBuffer.replay(FluxReplay.java:657) at reactor.core.publisher.FluxReplay$ReplaySubscriber.onComplete(FluxReplay.java:1272) at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onComplete(FluxMapFuseable.java:144) at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onComplete(FluxMapFuseable.java:144) at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1783) at reactor.core.publisher.MonoCollect$CollectSubscriber.onComplete(MonoCollect.java:152) at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:136) at reactor.core.publisher.FluxDoFinally$DoFinallySubscriber.onComplete(FluxDoFinally.java:138) at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:136) at reactor.netty.channel.FluxReceive.onInboundComplete(FluxReceive.java:374) at reactor.netty.channel.ChannelOperations.onInboundComplete(ChannelOperations.java:373) at reactor.netty.channel.ChannelOperations.terminate(ChannelOperations.java:429) at reactor.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:655) at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:96) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436) at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296) at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1526) at io.netty.handler.ssl.SslHandler.decodeNonJdkCompatible(SslHandler.java:1287) at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1324) at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:501) at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:440) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ... 1 more Suppressed: java.lang.Exception: #block terminated with an error at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:99) at reactor.core.publisher.Mono.block(Mono.java:1680) at com.azure.resourcemanager.resources.fluentcore.arm.collection.implementation.GroupableResourcesImpl.getById(GroupableResourcesImpl.java:61) at com.azure.resourcemanager.resources.fluentcore.arm.collection.implementation.GroupableResourcesImpl.getById(GroupableResourcesImpl.java:27) at com.azure.resourcemanager.compute.samples.CreateVirtualMachineUsingCustomImageFromVM.t003(CreateVirtualMachineUsingCustomImageFromVM.java:443) at com.azure.resourcemanager.compute.samples.CreateVirtualMachineUsingCustomImageFromVM.main(CreateVirtualMachineUsingCustomImageFromVM.java:53) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293) ... 1 more **To Reproduce** Register an application in azure portal and get application information. Execute demo managed-disk-java-create-virtual-machine-using-custom-image using the application information ***Code Snippet*** String clientId = "xxx", clientSecret = "xxx", tenantId = "xxx", subscriptionId = "xxx"; AzureEnvironment environment = AzureEnvironment.AZURE_CHINA; AzureProfile profile = new AzureProfile(tenantId, subscriptionId, environment); TokenCredential credential = new ClientSecretCredentialBuilder() .clientId(clientId).clientSecret(clientSecret) .tenantId(tenantId) .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) .build(); AzureResourceManager manager = AzureResourceManager.configure().withLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS) .authenticate(credential, profile) .withDefaultSubscription(); String nicId = "xxx"; NetworkInterface nic = manager.networkInterfaces().getById(nicId); Utils.print(nic); String diskId = "xxxxxxx"; Disk dataDisk = manager.disks().getById(diskId); <-- cause exception **Setup (please complete the following information):** - OS: Windows 7 - IDE : STS - 2.1.0 and 2.0.0 (both tested) **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 - [x ] Bug Description Added - [x ] Repro Steps Added - [x ] Setup information Added
Author: ylgtang
Assignees: xccc-msft
Labels: `Compute - VM`, `Mgmt`, `Mgmt - Track 2`, `Service Attention`, `customer-reported`, `question`
Milestone: -
Drewm3 commented 3 years ago

@ylgtang, in this issue I believe you are saying that the issue only occurs when running the code on Azure China, but it works successfully in Global Azure. Is this correct? There are times when Azure China software lags behind Global Azure by a few days, and this may be the issue here. Could you please retry the issue now that it has been 11 days, and let us know if it still fails?

Thanks

ylgtang commented 3 years ago

@Drewm3 Fortunately its still failed, :(

xseeseesee commented 3 years ago

@ylgtang I have created a PR to fix this. Please feel free to review and share comments. Thanks.

weidongxu-microsoft commented 3 years ago

Version 2.2.0 with the fix is released to maven.

@ylgtang Thank you very much for pointing this out.

weidongxu-microsoft commented 3 years ago

Let us know your feedback on the new Java SDK. https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=ISSUES