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.35k stars 1.99k forks source link

[BUG] om.azure.core.exception.HttpResponseException: Deserialization Failed. #41869

Closed shweta5595 closed 1 month ago

shweta5595 commented 1 month ago

Describe the bug I am using azure-storage-blob v12.16.0 dependency to get storage blobs data. It was working fine until last month, but now I am getting following exception: com.azure.core.exception.HttpResponseException: Deserialization Failed. Exception or Stack Trace

com.azure.core.exception.HttpResponseException: Deserialization Failed.
    at com.azure.core.implementation.serializer.HttpResponseBodyDecoder.decodeByteArray(HttpResponseBodyDecoder.java:99) ~[azure-core-1.49.0.jar:1.49.0]
    at com.azure.core.implementation.serializer.HttpResponseDecoder$HttpDecodedResponse.getDecodedBody(HttpResponseDecoder.java:93) ~[azure-core-1.49.0.jar:1.49.0]
    at com.azure.core.implementation.http.rest.AsyncRestProxy.lambda$decodeBytes$8(AsyncRestProxy.java:169) ~[azure-core-1.49.0.jar:1.49.0]
    at reactor.core.publisher.MonoCallable.call(MonoCallable.java:92) ~[reactor-core-3.4.29.jar:3.4.29]
    at reactor.core.publisher.FluxSubscribeOnCallable$CallableSubscribeOnSubscription.run(FluxSubscribeOnCallable.java:227) ~[reactor-core-3.4.29.jar:3.4.29]
    at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68) ~[reactor-core-3.4.29.jar:3.4.29]
    at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28) ~[reactor-core-3.4.29.jar:3.4.29]
    at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264) ~[na:na]
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java) ~[na:na]
    at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
    at java.base/java.lang.Thread.run(Thread.java:829) ~[na:na]
    Suppressed: java.lang.Exception: #block terminated with an error
        at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:99) ~[reactor-core-3.4.29.jar:3.4.29]
        at reactor.core.publisher.Flux.blockLast(Flux.java:2761) ~[reactor-core-3.4.29.jar:3.4.29]
        at com.azure.core.util.paging.ContinuablePagedByIteratorBase.requestPage(ContinuablePagedByIteratorBase.java:102) ~[azure-core-1.49.0.jar:1.49.0]
        at com.azure.core.util.paging.ContinuablePagedByItemIterable$ContinuablePagedByItemIterator.<init>(ContinuablePagedByItemIterable.java:75) ~[azure-core-1.49.0.jar:1.49.0]
        at com.azure.core.util.paging.ContinuablePagedByItemIterable.iterator(ContinuablePagedByItemIterable.java:55) ~[azure-core-1.49.0.jar:1.49.0]
        at java.base/java.lang.Iterable.spliterator(Iterable.java:101) ~[na:na]
        at com.azure.core.util.paging.ContinuablePagedIterable.stream(ContinuablePagedIterable.java:85) ~[azure-core-1.49.0.jar:1.49.0]
        at com.sams.cash.DLQProcessor.reprocessor.util.BlobUtil.getBlobCsv(BlobUtil.java:31) ~[classes/:na]
        at com.sams.cash.DLQProcessor.reprocessor.handler.PayoutMissedEventsHandler.process(PayoutMissedEventsHandler.java:31) ~[classes/:na]
        at com.sams.cash.DLQProcessor.reprocessor.client.QueueClientListener.onMessageAsync(QueueClientListener.java:68) ~[classes/:na]
        at com.microsoft.azure.servicebus.MessageAndSessionPump.lambda$receiveAndPumpMessage$0(MessageAndSessionPump.java:176) ~[azure-servicebus-3.6.6.jar:na]
        at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1072) ~[na:na]
        at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:478) ~[na:na]
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[na:na]
        ... 6 common frames omitted

To Reproduce Steps to reproduce the behavior:

Code Snippet

public String getBlobCsv(String fileName) {
    String directory = getDirectoryName(fileName);
    String csvString = "";
    BlobContainerClient blobContainerClient = blobClient.getContainerClient();
    PagedIterable<BlobItem> blobs;
    blobs = blobContainerClient.listBlobsByHierarchy(directory);
    log.info("Total Count of blobs  : {}",
        blobContainerClient.listBlobsByHierarchy(directory).stream().count());

    BlobItem blobItem = blobs.stream().filter(blob -> blob.getName().contains(fileName)).findFirst()
        .orElse(null);
    if (blobItem != null) {
      com.azure.storage.blob.BlobClient blobClient = blobContainerClient
          .getBlobClient(blobItem.getName());

      if (blobClient != null) {
        try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
          blobClient.download(outputStream);
          csvString = new String(outputStream.toByteArray());
        } catch (IOException e) {
          log.info("Exception occurred while downloading blob : {}", e.getMessage());
        }
      }
    }
    return csvString;
  }

Expected behavior I should be able to list blobs without any error , as before. There has been no functional change in code in past 1.5 years. Also

Screenshots If applicable, add screenshots to help explain your problem.

Setup (please complete the following information):

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:

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

github-actions[bot] commented 1 month ago

@ibrahimrabab @ibrandes @kyleknap @seanmcc-msft

github-actions[bot] commented 1 month ago

Thank you for your feedback. Tagging and routing to the team member best able to assist.

alzimmermsft commented 1 month ago

Thank you for reporting this issue @shweta5595!

Looking at the stack trace you've included, I notice that azure-core 1.49.0 is being used alongside azure-storage-blob 12.16.0. This could be a possible issue with dependency skew, possibly resulting in this issue happening due to dependency conflicts. If possible, could you include the output of mvn dependency:tree on your application. This would help determine if the root issue is in dependency skew.

Additionally, if this is happening consistently, could you include the cause of the HttpResponseException? When this is thrown HttpResponseBodyDecoder should include the causal exception in HttpResponseException which should give a strong indication on what is failing during deserialization.

github-actions[bot] commented 1 month ago

Hi @shweta5595. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

github-actions[bot] commented 1 month ago

Hi @shweta5595, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

shweta5595 commented 1 month ago

Hi , we can close this ticket , this was due to jackson version incompatibility .