grafana / agent

Vendor-neutral programmable observability pipelines.
https://grafana.com/docs/agent/
Apache License 2.0
1.59k stars 486 forks source link

Fix memory leak in loki.process on config update #7004

Closed ptodev closed 1 month ago

ptodev commented 1 month ago

PR Description

A goroutine wasn't being stopped in Update, which resulted in a memory leak.

The same change was also introduced to Alloy.

PR Checklist

ptodev commented 1 month ago

Hi @thampiotr, would you mind reviewing the latest commit please? The unit tests kept being flaky, and I realised it's because the loki.process code needs to be improved further to shut down more gracefully. If you're happy with this change, I'll also open a PR for Alloy to have it.