Skip to content

fix: TestSystemdNotifyTimeout to handle full send buffer correctly - #5741

Open
TheMeier wants to merge 1 commit into
prometheus:mainfrom
TheMeier:fix_sdnotify_test
Open

TheMeier wants to merge 1 commit into
prometheus:mainfrom
TheMeier:fix_sdnotify_test

Conversation

@TheMeier

@TheMeier TheMeier commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Pull Request Checklist

Please check all the applicable boxes.

  • Please list all open issue(s) discussed with maintainers related to this change
    • Fixes #
  • Is this a new Receiver integration?
  • Is this a bugfix?
    • I have added tests that can reproduce the bug which pass with this bugfix applied
  • Is this a new feature?
    • I have added tests that test the new feature's functionality
  • Does this change affect performance?
    • I have provided benchmarks comparison that shows performance is improved or is not degraded
      • You can use benchstat to compare benchmarks
    • I have added new benchmarks if required or requested by maintainers
  • Is this a breaking change?
    • My changes do not break the existing cluster messages
    • My changes do not break the existing api
  • I have added/updated the required documentation
  • I have signed-off my commits
  • I will follow best practices for contributing to this project

Which user-facing changes does this PR introduce?

NONE

@TheMeier
TheMeier requested a review from a team as a code owner November 12, 2026 08:17
@TheMeier
TheMeier requested a review from siavashs November 12, 2026 08:17
@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The timeout test now fills the notification queue with repeated sendSystemdNotification calls. It checks the failed fill send and the subsequent READY=1 send against the expected error and five-second timeout.

Changes: Systemd notification timeout test

Layer / File(s) Summary
Queue fill and timeout assertions
app/systemd_linux_test.go
The test makes up to 4096 sends to fill the queue. After a send fails, it attempts READY=1 and checks both errors and the five-second timeout. It reports an explicit error if the queue does not fill within the attempt limit.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Merge Risk: Minimal · up to 7ea2d

This change only adjusts a test for the systemd notification timeout. It does not alter production behavior, and no merge-blocking concerns were identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the test being fixed, TestSystemdNotifyTimeout, and the full send buffer problem. The raw summary says the test now fills the Unix datagram receive queue through sendSystemdNotificatio…
Description check Passed The description follows the repository template. The bugfix box is checked and the author states that tests reproduce the bug. Signed-off and best-practice boxes are checked. The release-notes block s…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the test being fixed, TestSystemdNotifyTimeout, and the full send buffer problem. The raw summary says the test now fills the Unix datagram receive queue through sendSystemdNotification, so the title matches the main change. It follows the 'area: short description' form, and the 'fix:' prefix is a reasonable area. The title is slightly long at 66 characters, but it is specific.

Full details: Description check

Explanation

The description follows the repository template. The bugfix box is checked and the author states that tests reproduce the bug. Signed-off and best-practice boxes are checked. The release-notes block says NONE, which is valid for a test-only change. Unchecked items such as benchmarks and documentation do not apply to this change. The issue link is missing, but the template marks it as applicable only when an issue exists. The description is mostly complete.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 335f30f and 7ea2df1.

Files selected for processing: 1

  • app/systemd_linux_test.go

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@jamesconwaydev jamesconwaydev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The reasoning holds. With one reused sender, the writes that pile up are charged to that socket's own send buffer, so it can block on its own sk_sndbuf while the receiver still has room. The READY=1 from a fresh socket then goes straight through. Dialing per datagram, as sendSystemdNotification does, fills the receiver's queue itself, so the final send is tested against the condition the test is named for.

One small thing: the fill loop has no bound. If the queue never fills, say on a platform that drops instead of blocking, the first select fails the test after 5 s, but the goroutine keeps dialing until the test binary exits. It can also be left blocked on the second done <-. A cap on the loop, a few thousand sends, would keep a failure from turning into a spin.

I read this against main's app/systemd_linux.go (100 ms systemdNotifyTimeout); I didn't run it.

Signed-off-by: Christoph Maser <christoph.maser+github@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants