[BUG] Iterating over result of ShareServiceClient.listShares results in infinite loop
See original GitHub issueDescribe the bug
Calling ShareServiceClient.listShares
and iterating over the results endlessly loops over all shares.
To Reproduce
- Set up an Azure Storage account
- Add a limited amount of shares (e.g. two)
- create a
ShareServiceClient
- call
listShares
on the client, and iterate over the result
Code Snippet
Using stream()
ShareServiceClient azureClient = new ShareServiceClientBuilder()
.connectionString(connectionString)
.buildClient();
azureClient.listShares()
.stream()
.forEach(shareItem -> System.out.println("Share: " + shareItem.getName()));
Using the for-each construct:
for (ShareItem shareItem : azureClient.listShares()) {
System.out.println("Share: " + shareItem.getName());
}
Using the paged functionality:
for (PagedResponse<ShareItem> page : azureClient.listShares().iterableByPage(100)) {
for (ShareItem shareItem : page.getValue()) {
System.out.println("Share:" + shareItem.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-file-share
:12.8.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
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Why does this method result in an infinite loop? - Stack Overflow
It looks like the Select is iterating over its own output. That's a little bit strange in itself, because typically an IEnumerable will...
Read more >Loops in Java – Ultimate Guide - Funnel Garden
We'll cover how you loop over characters in a string, an array of strings, an array of integers, as well as iterating over...
Read more >The Common Lisp Cookbook – Loop, iteration, mapping
Looping an infinite number of times, cycling over a circular list. First, as shown above, ... mapcar returns the results of the lambda...
Read more >Why is this code not working ? Why does It stops looping
Loop's over everyone, let's move on! For a loop iteration to run it ONLY tests for the existence of a letter at the...
Read more >VBA Loops - For, For Each, Do While and Do Until Loops
The Outer For Loop iterates over the variable 'sheet', and the Inner For Loop ... easy to make logical errors resulting in an...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This was recently fixed by the release of azure-core. We should transitively pick up the fix once we release our next version of storage
The issue is fixed in 12.9.0-beta.2 and later, thanks