Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a potential deadlock issue in the loki.source.journal component by implementing the same synchronization pattern that was previously applied to the syslog component. The fix ensures proper handling of component stopping and reloading to prevent deadlock scenarios.
Key changes:
- Refactored the main run loop to use a separate
reloadTargets()method instead of inline target management - Added a draining routine to handle entries during component shutdown/reload
- Improved synchronization by copying state before releasing locks during stop operations
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/component/loki/source/journal/journal.go | Implements deadlock prevention by refactoring target lifecycle management and adding proper draining routines |
| internal/component/loki/source/syslog/syslog.go | Shows the reference implementation pattern being applied to journal component |
| CHANGELOG.md | Documents the deadlock fix for the journal component |
kalleep
approved these changes
Oct 9, 2025
Contributor
kalleep
left a comment
There was a problem hiding this comment.
Great, as we talked about in slack we should review other loki components to make sure they all follow the same pattern
kalleep
pushed a commit
that referenced
this pull request
Oct 9, 2025
* loki.source.journal: fix deadlock * changelog * remove redundant field * rephrase changelog
kalleep
added a commit
that referenced
this pull request
Oct 9, 2025
* loki.source.journal: fix deadlock (#4571) * fix: add logging wrapper for cloudwatch exporter with support for debug field (#4553) * Use sync timeout to decide how long to retry waiting for k8s api for prometheus.operator.* components (#4568) --------- Co-authored-by: Piotr <17101802+thampiotr@users.noreply.github.com> Co-authored-by: Sam DeHaan <sam.dehaan@grafana.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Description
loki.source.journal needs the same fix as we have done in #4352
Which issue(s) this PR fixes
Notes to the Reviewer
PR Checklist