Skip to content

[Rust] close() on a failed stream drops queued ack-callback errors #1191

Open

Description

Description

When a stream fails, the SDK queues one on_error call per pending record for the ack callback. If the caller then calls close(), it returns at once because the stream is already closed (rust/sdk/src/stream/grpc/close.rs), so it never waits for the callback task to deliver those calls. Dropping or freeing the stream then aborts the callback task, and the queued on_error calls are lost.

This affects every SDK with an ack callback, for ordinary and multiplexed streams. A caller that relies on on_error to learn which records failed misses some of them.

Proposed fix

On the already-closed path, close() still waits for pending callbacks, bounded by callback_max_wait_time_ms as on a normal close. Add a regression test: a stream with recovery disabled fails with records pending, the first on_error blocks, close() runs, and after it returns every on_error call has been delivered.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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