Skip to content

[BUG] Iterating over result of BlobServiceClient.listBlobContainers results in infinite loop #18881

@willemv

Description

@willemv

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    ClientThis issue points to a problem in the data-plane of the library.StorageStorage Service (Queues, Blobs, Files)bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.dependency-issue-jacksonIssue caused by dependency version mismatch with one of the Jackson librariesneeds-team-attentionWorkflow: This issue needs attention from Azure service team or SDK team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions