diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-07-21 14:55:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-21 14:55:31 +0200 |
commit | 53dfc23e429cd53124a54eb3f3066a67aa5ead4c (patch) | |
tree | c45f7f29de84d4bf442e607deb6520ce3e878008 /libpod/container_log_linux.go | |
parent | 5abb38238d56f87e6fe277939b0fcccb78bcda42 (diff) | |
parent | 4e72aa58604f9384c3d2913b16baa41f00d0a9e1 (diff) | |
download | podman-53dfc23e429cd53124a54eb3f3066a67aa5ead4c.tar.gz podman-53dfc23e429cd53124a54eb3f3066a67aa5ead4c.tar.bz2 podman-53dfc23e429cd53124a54eb3f3066a67aa5ead4c.zip |
Merge pull request #14984 from Luap99/logs
fix goroutine leaks in events and logs backend
Diffstat (limited to 'libpod/container_log_linux.go')
-rw-r--r-- | libpod/container_log_linux.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libpod/container_log_linux.go b/libpod/container_log_linux.go index 0686caed2..7e95f2449 100644 --- a/libpod/container_log_linux.go +++ b/libpod/container_log_linux.go @@ -178,8 +178,13 @@ func (c *Container) readFromJournal(ctx context.Context, options *logs.LogOption if !options.Follow || !containerCouldBeLogging { return } - // Sleep until something's happening on the journal. - journal.Wait(sdjournal.IndefiniteWait) + + // journal.Wait() is blocking, this would cause the goroutine to hang forever + // if no more journal entries are generated and thus if the client + // has closed the connection in the meantime to leak memory. + // Waiting only 5 seconds makes sure we can check if the client closed in the + // meantime at least every 5 seconds. + journal.Wait(5 * time.Second) continue } lastReadCursor = cursor |