Skip to content

fix(logstash source): preserve writer windows when generating ACKs#25531

Open
bruceg wants to merge 2 commits into
masterfrom
bruceg/fix-logstash-pipelining
Open

fix(logstash source): preserve writer windows when generating ACKs#25531
bruceg wants to merge 2 commits into
masterfrom
bruceg/fix-logstash-pipelining

Conversation

@bruceg
Copy link
Copy Markdown
Member

@bruceg bruceg commented May 29, 2026

Summary

Filebeat expects ACKs to remain within the current Lumberjack writer window. The logstash source decoder was ignoring WindowSize frames and the receiver could later batch frames from multiple windows together before building an ACK. When that happened, Vector could ACK the highest sequence in the merged batch instead of the last sequence in the current window.

That behavior has resulted "invalid sequence number received" errors on the sender side and results in reconnects and duplicate retransmits under load.

Fix this by preserving writer window boundaries during decode, tracking which decoded frames close a window, and emitting one ACK frame per completed window when a batched read contains multiple windows. This keeps the existing batching behavior in the generic TCP path while making the logstash receiver respect the expected ACK semantics.

Also add unit tests that demonstrate the bug with both sequence resets and monotonic sequences across adjacent windows.

Vector configuration

N/A

How did you test this PR?

Unit tests included. I tried to test using Filebeat itself, but triggering this is highly timing dependent.

Change Type

  • Bug fix
  • New feature
  • Dependencies
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

References

Notes

  • Please read our Vector contributor resources.
  • Do not hesitate to use @vectordotdev/vector to reach out to us regarding this PR.
  • Some CI checks run only after we manually approve them.
    • We recommend adding a pre-push hook, please see this template.
    • Alternatively, we recommend running the following locally before pushing to the remote branch:
      • make fmt
      • make check-clippy (if there are failures it's possible some of them can be fixed with make clippy-fix)
      • make test
  • After a review is requested, please avoid force pushes to help us review incrementally.
    • Feel free to push as many commits as you want. They will be squashed into one before merging.
    • For example, you can run git merge origin master and git push.
  • If this PR introduces changes Vector dependencies (modifies Cargo.lock), please
    run make build-licenses to regenerate the license inventory and commit the changes (if any). More details on the dd-rust-license-tool.

@bruceg bruceg requested a review from a team as a code owner May 29, 2026 23:51
@bruceg bruceg added type: bug A code related bug. source: logstash Anything `logstash` source related labels May 29, 2026
@github-actions github-actions Bot added the domain: sources Anything related to the Vector's sources label May 29, 2026
@bruceg bruceg requested a review from Jansen-w May 29, 2026 23:53
Filebeat expects ACKs to remain within the current Lumberjack writer window.
The logstash source decoder was ignoring WindowSize frames and the receiver
could later batch frames from multiple windows together before building an ACK.
When that happened, Vector could ACK the highest sequence in the merged batch
instead of the last sequence in the current window.

That behavior could surface as "invalid sequence number received" on the sender
side and could contribute to reconnects and duplicate retransmits under load.

Fix this by preserving writer window boundaries during decode, tracking which
decoded frames close a window, and emitting one ACK frame per completed window
when a batched read contains multiple windows. This keeps the existing batching
behavior in the generic TCP path while making the logstash receiver respect the
expected ACK semantics.

Also add unit tests that demonstrate the bug with both sequence resets and
monotonic sequences across adjacent windows.
@bruceg bruceg force-pushed the bruceg/fix-logstash-pipelining branch from 7ee8e13 to b68bf9f Compare May 29, 2026 23:54
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7ee8e13e03

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/sources/logstash.rs Outdated
Comment thread changelog.d/50215_logstash_ack_windows.fix.md Outdated
@bruceg
Copy link
Copy Markdown
Member Author

bruceg commented May 30, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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

Labels

domain: sources Anything related to the Vector's sources source: logstash Anything `logstash` source related type: bug A code related bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant