Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NatsObjStore.ListAsync hangs if bucket is empty #563

Closed
darkwatchuk opened this issue Jul 12, 2024 · 4 comments · Fixed by #578
Closed

NatsObjStore.ListAsync hangs if bucket is empty #563

darkwatchuk opened this issue Jul 12, 2024 · 4 comments · Fixed by #578
Assignees
Labels
bug Something isn't working

Comments

@darkwatchuk
Copy link
Contributor

Observed behavior

As per title, if an object store bucket has no entries, then calling ListAsync hangs and doesn't return.

Expected behavior

Enumerator should return

Server and client version

Client : .Net 2.3.3
Server : Various

Host environment

No response

Steps to reproduce

No response

@darkwatchuk
Copy link
Contributor Author

Here's a test that fails, not quite sure the best way to solve this...

[Fact]
public async Task Enumerate_empty_object_store()
{
    var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
    var cancellationToken = cts.Token;

    await using var server = NatsServer.StartJS();
    await using var nats = server.CreateClientConnection();
    var js = new NatsJSContext(nats);
    var ob = new NatsObjContext(js);

    var objStore = await ob.CreateObjectStoreAsync(new NatsObjConfig("emptyStore"), cancellationToken);

    await foreach (var stream in objStore.ListAsync(cancellationToken: cancellationToken))
    {
    }
}

@mtmk
Copy link
Collaborator

mtmk commented Jul 12, 2024

thanks @darkwatchuk! this is a bug. we had similar issues with KV watchers and solved them using some message properties.

@mtmk mtmk added the bug Something isn't working label Jul 12, 2024
@Ivandemidov00
Copy link
Contributor

Hi guys. I see the OnNoData function in the NatsKV. I think this solution can be applied to NatsObjStore. Can I fix this bug?

@mtmk
Copy link
Collaborator

mtmk commented Jul 16, 2024

Hi guys. I see the OnNoData function in the NatsKV. I think this solution can be applied to NatsObjStore. Can I fix this bug?

thanks @Ivandemidov00 absolutely please go for it 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants