Azure / azure-storage-java

Microsoft Azure Storage Library for Java
https://docs.microsoft.com/en-us/java/api/overview/azure/storage
MIT License
189 stars 165 forks source link

invalid wasb credentials taking 13-14 minutes to execute #590

Open muskaan62 opened 1 month ago

muskaan62 commented 1 month ago

Which service(blob, file, queue, table) does this issue concern?

Blob/file

Which version of the SDK was used?

from 5.x this issue is happening. till 5.0.0 its working as expected

What problem was encountered?

The execution is taking 14 minutes to complete when give invalid access key

Have you found a mitigation/solution?

No i haven't found a solution, As i am using hadoop file system and the latest 11/12 version are not compatible with hadoop we cant use those. Steps to reproduce

` public static void main(String[] args) { // Replace with your Azure Storage account name and key String accountName = ""; String accountKey = "";

    // Replace with the path you want to access
    String wasbPath = "";
    Configuration conf = new Configuration();
    // Set the configuration for Azure Blob Storage
    conf.set("fs.azure", "org.apache.hadoop.fs.azure.NativeAzureFileSystem");
    conf.set("fs.azure.account.key." + accountName + ".blob.core.windows.net", accountKey);
    long startTime = 0;
    try {
        startTime = System.currentTimeMillis();
        // Get the FileSystem object
        FileSystem fs = FileSystem.get(new URI(wasbPath), conf);

        // Create a Path object for the file
        Path path = new Path(wasbPath);

        // Check if the file exists
        if (fs.exists(path)) {
            // Read the file
            BufferedReader br = new BufferedReader(new InputStreamReader(fs.open(path)));
            String line;
            while ((line = br.readLine()) != null) {
                System.out.println(line);
            }
            br.close();
        } else {
            System.out.println("File does not exist");
        }

        // Close the FileSystem object
        fs.close();
    } catch (Exception e) {
        long endTime = System.currentTimeMillis();
        long executionTimeInMillis = endTime - startTime;
        double executionTimeInMinutes = executionTimeInMillis / (1000.0 * 60.0);
        System.out.println("Execution time: " + executionTimeInMinutes + " minutes");
        e.printStackTrace();
    }
}`

Hadoop Dependency

<dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-common</artifactId>
      <version>3.2.2</version>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-azure</artifactId>
      <version>3.2.2</version>
      <exclusions>
        <exclusion>
          <groupId>com.microsoft.azure</groupId>
          <artifactId>azure-storage</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

Storage dependency

com.microsoft.azure azure-storage 5.1.0