Below is a list of suggestions to help troubleshoot and fix the issue you're experiencing with the StacklessClosedChannelException when reading the blob:
1. Upgrade Dependencies
The error you referenced (see GitHub issue #40106) is known to be present in certain versions of the Azure Storage Blob SDK when used on Windows with the Netty HTTP client. You should:
- Ensure you are using the latest version of the Azure Storage Blob SDK. The issue may have been fixed in a later release.
- Also update the Netty dependencies (if applicable) to versions known to work with your sdk; version mismatches can sometimes cause channel issues.
2. Consider Using an Alternate HTTP Client
Since the problem seems to be related to the Netty HTTP client configuration on Windows, you might try switching to another supported HTTP client (such as the OkHttp client provided by Azure) to see if that resolves the issue. For example:
BlobClient blobClient = new BlobClientBuilder()
.endpoint(searchMultipleWrapper.getSasUrl().trim())
.httpClient(new OkHttpAsyncHttpClientBuilder()
.readTimeout(Duration.ofMinutes(10))
.writeTimeout(Duration.ofMinutes(10))
.responseTimeout(Duration.ofMinutes(10))
.build())
.retryOptions(new RequestRetryOptions(
RetryPolicyType.EXPONENTIAL,
5,
2,
null,
null,
null))
.buildClient();
Switching to a different HTTP client can be a quick way to determine if the Netty-specific issue is the root cause.
3. Validate SAS URL and Timeouts
- SAS URL Validity: Double-check that there are no trailing spaces or encoding issues with your SAS URL.
- Timeouts: The long read and write timeouts (10 minutes) are configured, which may interact with network conditions. Although likely unrelated, you could experiment with shorter timeouts to see if it changes the behavior.
4. Review Connection Provider Settings
Ensure that the custom connection provider configuration isn’t affecting the network connection negatively. You have configured a high number of max connections and a large pending acquire count. It might be worth testing with default settings to rule out throttling issues.
Summary
Considering that the exception is related to the Netty HTTP pipeline closing a channel unexpectedly, and you've already identified a similar reported bug, the most promising approaches are:
- Upgrading to the latest versions of the Azure Storage Blob SDK and Netty libraries.
- Testing with an alternative HTTP client (like OkHttp) to determine if the Netty implementation is causing the problem on Windows.
By taking these steps, you should be able to isolate and resolve the issue with the ByteStream generation from the SAS URL.