From f30b36cb4071f5d4280b522c6361778c2e4f1137 Mon Sep 17 00:00:00 2001 From: Brett Jones Date: Mon, 9 Dec 2019 17:03:18 -0600 Subject: [PATCH] receive: close DBReadOnly after flushing Signed-off-by: Brett Jones --- CHANGELOG.md | 4 ++++ pkg/receive/tsdb.go | 1 + 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c655527ee0..81637a35c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ NOTE: As semantic versioning states all 0.y.z releases can contain breaking chan We use *breaking* word for marking changes that are not backward compatible (relates only to v0.y.z releases.) ## Unreleased +### Fixed + +- [#1856](https://github.com/thanos-io/thanos/pull/1856) Receive: close DBReadOnly after flushing to fix a memory leak. + ### Added - [#1852](https://github.com/thanos-io/thanos/pull/1852) Add support for `AWS_CONTAINER_CREDENTIALS_FULL_URI` by upgrading to minio-go v6.0.44 diff --git a/pkg/receive/tsdb.go b/pkg/receive/tsdb.go index da463fe874..8a081f0601 100644 --- a/pkg/receive/tsdb.go +++ b/pkg/receive/tsdb.go @@ -92,6 +92,7 @@ func (f *FlushableStorage) Flush() error { if err != nil { return errors.Wrap(err, "opening read-only DB") } + defer ro.Close() if err := ro.FlushWAL(f.path); err != nil { return errors.Wrap(err, "flushing WAL") }