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] Iterating over result of BlobServiceClient.listBlobContainers results in infinite loop #18881

Closed
3 tasks done
willemv opened this issue Jan 29, 2021 · 7 comments
Closed
3 tasks done
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. dependency-issue-jackson Issue caused by dependency version mismatch with one of the Jackson libraries needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team Storage Storage Service (Queues, Blobs, Files)

Comments

@willemv
Copy link

willemv commented Jan 29, 2021

Describe the bug
Calling BlobServiceClient.listBlobContainers and iterating over the results endlessly loops over all containers

To Reproduce

  • Set up an Azure Storage account
  • Add a limited amount of blob containers (e.g. two)
  • create a BlobServiceClient
  • call listBlobContainers on the client, and iterate over the result

Code Snippet
Using stream()

BlobServiceClient azureClient = new BlobServiceClientBuilder()
        .connectionString(connectionString)
        .buildClient();
azureClient.listBlobContainers()
           .stream()
           .forEach(blobContainerItem -> System.out.println("Container: " + blobContainerItem.getName()));

Using the for-each construct:

for (BlobContainerItem blobContainerItem : azureClient.listBlobContainers()) {
    System.out.println("Container: " + blobContainerItem.getName());
}

Using the paged functionality:

for (PagedResponse<BlobContainerItem> page : azureClient.listBlobContainers().iterableByPage(100)) {
    for (BlobContainerItem blobContainerItem : page.getValue()) {
        System.out.println("Container: " + blobContainerItem.getName());
    }
}

Expected behavior
The name of each available share is printed once

Actual result: this keeps printing the same share names over and over, without ever stopping.

Setup (please complete the following information):

  • OS: Linux, macOS, Windows
  • IDE : IntelliJ, Eclipse, gradle, maven, ...
  • Version of the Library used:
    • azure-storage-blob : 12.10.0
    • azure-storage-common : 12.10.0
    • azure-core: 1.12.0

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
@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jan 29, 2021
@alzimmermsft alzimmermsft added Client This issue points to a problem in the data-plane of the library. Storage Storage Service (Queues, Blobs, Files) labels Jan 29, 2021
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Jan 29, 2021
@rickle-msft
Copy link
Contributor

Hi, @willemv. Thanks for reporting this issue. Can you please take a look at #9465 and see if any of the solutions there might apply to your scenario? Specifically at the end of the thread we concluded in that case it was either a classloader or dependency issue depending on the scenario.

@willemv
Copy link
Author

willemv commented Feb 2, 2021

Hi @rickle-msft , #9465 looks like our bug indeed. I know we have jackson in our classpath. I will investigate and see if the mentioned workarounds work for us.

@willemv
Copy link
Author

willemv commented Feb 12, 2021

@rickle-msft #9465 looks like our bug, but the workarounds don't work for us.

The problem starts when you have a more recent version of jackson in the classpath than the one that the azure java sdk uses by default.

I.e., by default the azure sdk uses version '2.11.3'. In our project we need a more recent version. At the time of writing, the most recent version of jackson is "2.12.1". If we use that version, you get the infinite loop.

I've attached a sample gradle project with unit tests that you can open in typical IDE's, so you can see what I did to reproduce this : azure-bug-reproduction.zip

This project allows you to switch between jackson version 2.11.3 and 2.12.1 by adjusting the build.gradle file. It has a series of unit tests that show the problem with jackson version 2.12.1. You can specify the ConnectionString to use when running this test by setting the necessary environment variables (or simply editing the source files of course).

This also contains unit tests for another problem I encountered: ShareServiceClient#listShares() and BlobServiceClient#listBlobContainers() both throw an exception when no shares or blob containers are present in the account. I'll log a separate issue for that, but I didn't feel like creating a separate gradle project for that.

@rickle-msft
Copy link
Contributor

@willemv I recently found out that there's actually work underway to upgrade our jackson dependency, so I think this should be resolved for you soon: #18884

@gapra-msft
Copy link
Member

This issue will be resolved once the 12.11.0-beta.2 azure-storage-blob library is released

@gapra-msft gapra-msft added bug This issue requires a change to an existing behavior in the product in order to be resolved. and removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Mar 26, 2021
@gapra-msft
Copy link
Member

Hi @willemv, we recently released azure-storage-blob 12.11.0-beta.2 that should fix this issue. Please try it out and let us know if you are still hitting the issue.

Feel free to close this once you've confirmed the latest release fixes your issue.

@gapra-msft gapra-msft added the needs-author-feedback Workflow: More information is needed from author to address the issue. label Apr 22, 2021
@willemv
Copy link
Author

willemv commented Apr 26, 2021

The issue is fixed in 12.11.0-beta.2 and later, thanks

@ghost ghost added needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team and removed needs-author-feedback Workflow: More information is needed from author to address the issue. labels Apr 26, 2021
@willemv willemv closed this as completed Apr 26, 2021
@alzimmermsft alzimmermsft added the dependency-issue-jackson Issue caused by dependency version mismatch with one of the Jackson libraries label Oct 6, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. dependency-issue-jackson Issue caused by dependency version mismatch with one of the Jackson libraries needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

No branches or pull requests

4 participants