googleapis / googleapis/google-cloud-rust

Publisher leaks a batch-actor task and unbounded channel per ordering key

Open
#6,723 3 comments 0 reactions 0 assignees View on GitHub
api: pubsub type: bug
Dominant language
Rust
Stars
955
Forks
144
Avg merge
1d 5h
Merged PRs (30d)
279

Description

Unconfirmed. This is the result of a search with Claude, may be a false positive.

In `src/pubsub/src/publisher/actor.rs`, publishing with an ordering key spawns a dedicated `BatchActor` task and adds an entry to `batch_actors`:

https://github.com/googleapis/google-cloud-rust/blob/f02b42c2ac5720334cd2b5335824bd4166264527/src/pubsub/src/publisher/actor.rs#L130-L147

```rust
// TODO(#4012): Remove batch actors when there are no outstanding operations on the ordering key.
```

Batch actors and their associated task handles and channels are never removed from `batch_actors`. In applications that use dynamic or short-lived ordering keys (e.g. per-entity or per-session keys), this creates an unbounded memory and background task leak.

Contributor guide

Open the contributing guide

Research direction

Start in src/pubsub/src/publisher/actor.rs around the BatchActor creation at lines 130-147, then trace how batch_actors, task handles, and channels are managed for ordering keys. Verify the suspected leak with dynamic or short-lived keys. Done means actors and their associated resources are removed once an ordering key has no outstanding operations, without disrupting publishing.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.