0

I am using azure sdk for java v11.0.1 to upload files to blob storage. This error comes sometimes once in a week and it creates an outage for the application :

java.util.concurrent.TimeoutException: The source did not signal an event for 60 seconds and has been terminated.
2023-03-21T10:30:53.721545956Z at io.reactivex.internal.operators.single.SingleTimeout$TimeoutMainObserver.run(SingleTimeout.java:123) ~[rxjava-2.2.9.jar!/:na]
2023-03-21T10:30:53.721551557Z at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38) ~[rxjava-2.2.9.jar!/:na]
2023-03-21T10:30:53.721555757Z at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26) ~[rxjava-2.2.9.jar!/:na]
2023-03-21T10:30:53.721559957Z at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
2023-03-21T10:30:53.721563857Z at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[na:na]

The application works fine after a restart. What could be the issue ? I am using azure-storage-blob version 11.0.1 and spring boot version 2.1.6.

1 Answer 1

0

I am using azure sdk for java v11.0.1 to upload files to blob storage.This error comes sometimes once in a week and it creates an outage for the application.

java.util.concurrent.TimeoutException: The source did not signal an event for 60 seconds and has been terminated.
2023-03-21T10:30:53.721545956Z at io.reactivex.internal.operators.single.SingleTimeout$TimeoutMainObserver.run(SingleTimeout.java:123) ~[rxjava-2.2.9.jar!/:na]
2023-03-21T10:30:53.721551557Z at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38) ~[rxjava-2.2.9.jar!/:na]
2023-03-21T10:30:53.721555757Z at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26) ~[rxjava-2.2.9.jar!/:na]
2023-03-21T10:30:53.721559957Z at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
2023-03-21T10:30:53.721563857Z at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[na:na]

The above error message indicates that a timeout occurred while attempting to upload a file to AZURE Storage using the SDK for Java. The timeout occurred because the source did not signal an event for 60 seconds and was terminated automatically.

I have used below code to upload the Files to Azure Blob Storage.

import com.azure.storage.blob.BlobClient;
import com.azure.storage.blob.BlobContainerClient;
import com.azure.storage.blob.BlobServiceClient;
import com.azure.storage.blob.BlobServiceClientBuilder;


public class App {
    public static void main(String[] args) {
   String  connectStr ="DefaultEndpointsProtocol=https;AccountName=<storageaccountname>;AccountKey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxL132fS9qbo2NGFL/GdLuwyWiSn+AStm9symA==;EndpointSuffix=core.windows.net";
   BlobServiceClient  blobServiceClient = new  BlobServiceClientBuilder().connectionString(connectStr).buildClient();
   String  containerName = "<containername>";
   BlobContainerClient  containerClient = blobServiceClient.getBlobContainerClient(containerName);
   String  localPath = "<localpath>;
   BlobClient  blobClient = containerClient.getBlobClient("sample09.xlsx");
   blobClient.uploadFromFile(localPath);
   System.out.println("File uploaded!!!!");;
    }
}

You need to change the below dependency in pom.xml

<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.7.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-storage-blob</artifactId>
<version>12.21.1</version>
</dependency>

Once ran the above code files are uploaded to Azure Container successfully.

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

So does it mean it is a bug in azure sdk for java v11? I need to update the version to v12?
Timeouts can occur for a variety of reasons, such as network latency, server issues, or application load, upgrading to the latest version of the Azure SDK for Java v12 and check the result.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.