Skip to content

chore(loki.rules.kubernetes, mimir.rules.kubernetes): Add timeout to ruler sync calls#5963

Open
QuentinBisson wants to merge 6 commits intografana:mainfrom
QuentinBisson:fix/loki-mimir-rules-sync-timeout
Open

chore(loki.rules.kubernetes, mimir.rules.kubernetes): Add timeout to ruler sync calls#5963
QuentinBisson wants to merge 6 commits intografana:mainfrom
QuentinBisson:fix/loki-mimir-rules-sync-timeout

Conversation

@QuentinBisson
Copy link
Copy Markdown
Contributor

@QuentinBisson QuentinBisson commented Apr 1, 2026

fix(loki.rules.kubernetes): Add timeout to ruler sync calls
fix(mimir.rules.kubernetes): Add timeout to ruler sync calls

Brief description of Pull Request

Add a 30s context timeout to the ListRules (ruler sync) calls in loki.rules.kubernetes and mimir.rules.kubernetes to prevent the event loop goroutine from blocking indefinitely on transient network issues.

Previously, syncLoki and syncMimir passed the raw component context (no deadline) to the HTTP client. If the remote ruler was unreachable silently (e.g. firewall blackhole, no TCP RST), the request would hang forever, blocking the single event-loop goroutine and preventing any further event processing or recovery.

The shared RulerSyncTimeout constant is defined once in the internal/component/common/kubernetes package and reused by both components to avoid duplication.

PR Checklist

  • Documentation added
  • Tests updated
  • Config converters updated

…ler sync calls

Add a 30s context timeout to the ListRules calls in syncLoki and
syncMimir to prevent the event loop goroutine from blocking indefinitely
when the remote ruler is unreachable (e.g. due to a firewall blackhole).

The shared RulerSyncTimeout constant is defined once in the common
kubernetes package and reused by both components.
@QuentinBisson QuentinBisson requested a review from a team as a code owner April 1, 2026 12:15
Comment thread CHANGELOG.md Outdated
Copy link
Copy Markdown
Contributor Author

@QuentinBisson QuentinBisson left a comment

Choose a reason for hiding this comment

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

@kalleep do you think you could take a look at this PR when you have the time?

@jharvey10 jharvey10 changed the title fix(loki.rules.kubernetes, mimir.rules.kubernetes): add timeout to ruler sync calls chore(loki.rules.kubernetes, mimir.rules.kubernetes): Add timeout to ruler sync calls Apr 23, 2026
@jharvey10
Copy link
Copy Markdown
Contributor

(Just made some tiny tweaks to PR name and description to ensure the changelog shows correct entries for both scopes loki.rules.kubernetes and mimir.rules.kubernetes) 🙂

@QuentinBisson
Copy link
Copy Markdown
Contributor Author

Thank you

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