Skip to content

bug(Rust SDK): on merge of ShardMessages the buffer budget is freed before messages are send #3932

Description

@haubur

Bug description

Situation
The ShardMessageWithPermit has inner Vec for which size the _permit_bytes are taken.
Merging the batches in appends IggyMessages to the Vec without touching the _permit_bytes.
The loop drops on iteration and thereby frees the permit.

for msg in buffer.drain(..) {
if let Some(last) = merged_batches.last_mut()
&& Self::same_destination(&last.inner, &msg.inner)
{
last.inner.messages.extend(msg.inner.messages);
continue;
}
merged_batches.push(msg);
}

Consequence
The actual bytes in flight can exceed max_buffer_size and the BackpressureMode does not kick.

Affected area / component

Rust SDK

Deployment

None

Versions

No response

Hardware / environment

No response

Sample code

No response

Logs

No response

Iggy server config

No response

Reproduction

No response

Contribution

  • I'm willing to submit a pull request to fix this bug

Good first issue

  • I think this could be a good first issue for a new contributor

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingrustPull requests that update Rust code

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions