Skip to content

Minio 6.0.2: Unexpected Behavior with Unavailable Endpoints #1041

@teun2408

Description

@teun2408

Issue Summary:

Upgrading from Minio .NET SDK version 6.0.1 to 6.0.2 has introduced unexpected behavior when interacting with non-existent Minio server endpoints. Specifically, methods like BucketExistsAsync and GetObjectAsync do not behave as expected when provided with endpoints that are not running Minio servers. Instead of throwing exceptions or indicating errors, they return unexpected results, such as always returning true for bucket existence checks and returning empty streams for object downloads.

Steps to Reproduce:

  1. Use Minio .NET SDK version 6.0.2.
  2. Configure the SDK with an endpoint that does not host a Minio server (e.g., "127.0.0.1:11111").
  3. Use the BucketExistsAsync method to check for the existence of a bucket that doesn't exist.
  4. Use the GetObjectAsync method to download an object from a non-existent bucket.
using Minio;

var s3Client = new MinioClient()
    .WithEndpoint("127.0.0.1:11111")
    .WithCredentials("accesskey", "secretkey")
    .Build();

//Should throw an exception, but it does not in 6.0.2, in 6.0.1 it throws a System.AggregateException
//Instead, in 6.0.2 it just returns true even though the Minio server does not exist, nor the bucket.
bool bucketExists = s3Client.BucketExistsAsync(new Minio.DataModel.Args.BucketExistsArgs().WithBucket("bucketname")).Result;

if (bucketExists)
{
    Console.WriteLine("Bucket exists according to Minio");
}

MemoryStream stream = new MemoryStream();

// An exception should be thrown here, but it is not, instead, it returns an empty stream even though neither the server, bucket, or object exists.
await s3Client.GetObjectAsync(new Minio.DataModel.Args.GetObjectArgs().WithBucket("bucketname").WithObject("objectname").WithCallbackStream(x => x.CopyTo(stream)));

Console.WriteLine($"Stream length: {stream.Length}");

Expected Behavior:

  • The BucketExistsAsync method should throw an exception or return false when provided with an endpoint that does not host a Minio server.
  • The GetObjectAsync method should throw an exception when attempting to download an object from a non-existent bucket.

Actual Behavior:

  • When using BucketExistsAsync with a non-existent Minio server endpoint, it consistently returns true, incorrectly indicating the existence of the bucket.
  • When using GetObjectAsync with a non-existent bucket or object, it returns an empty stream instead of throwing an exception or indicating an error.

Environment Details:

  • Minio .NET SDK version: 6.0.2
  • Operating System: Windows 11
  • .NET 8

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions