Skip to content

Commit

Permalink
loki.process: fix deadlock on components with no stages (#3299)
Browse files Browse the repository at this point in the history
This fixes a deadlock when loki.process has no stages defined, since
previously it needed at least one stage to create the input pipelines.
  • Loading branch information
rfratto authored and clayton-cornell committed Aug 14, 2023
1 parent dfc06be commit f448c5b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ Main (unreleased)
while flushing remaining logs, preventing `loki.source.file` from being able
to update. (@rfratto)

- Flow: fix deadlock in `loki.process` where a component with no stages would
hang forever on handling logs. (@rfratto)

### Other changes

- Grafana Agent Docker containers and release binaries are now published for
Expand Down
5 changes: 4 additions & 1 deletion component/loki/process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ func (c *Component) Update(args component.Arguments) error {
c.mut.Lock()
defer c.mut.Unlock()

if stagesChanged(c.stages, newArgs.Stages) {
// We want to create a new pipeline if the config changed or if this is the
// first load. This will allow a component with no stages to function
// properly.
if stagesChanged(c.stages, newArgs.Stages) || c.stages == nil {
if c.entryHandler != nil {
c.entryHandler.Stop()
}
Expand Down

0 comments on commit f448c5b

Please sign in to comment.