diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-09-07 14:18:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-07 14:18:41 +0200 |
commit | c20227bd16cae98247955b14f6dfea33a26c6a0b (patch) | |
tree | c27ae52ccb67343cd06f6654546246543529dd5c /libpod/container_log.go | |
parent | 6e3a2d3ecacc70b27cc29fbf3e7f93494cdc97a4 (diff) | |
parent | 1eaa449590515a0bb6207316fe5fba734ebde335 (diff) | |
download | podman-c20227bd16cae98247955b14f6dfea33a26c6a0b.tar.gz podman-c20227bd16cae98247955b14f6dfea33a26c6a0b.tar.bz2 podman-c20227bd16cae98247955b14f6dfea33a26c6a0b.zip |
Merge pull request #11464 from vrothberg/fix-11461
logs -f: file: fix dead lock
Diffstat (limited to 'libpod/container_log.go')
-rw-r--r-- | libpod/container_log.go | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/libpod/container_log.go b/libpod/container_log.go index 3988bb654..89dd5e8b0 100644 --- a/libpod/container_log.go +++ b/libpod/container_log.go @@ -107,16 +107,18 @@ func (c *Container) readFromLogFile(ctx context.Context, options *logs.LogOption // until EOF. state, err := c.State() if err != nil || state != define.ContainerStateRunning { - // Make sure to wait at least for the poll duration - // before stopping the file logger (see #10675). - time.Sleep(watch.POLL_DURATION) - tailError := t.StopAtEOF() - if tailError != nil && fmt.Sprintf("%v", tailError) != "tail: stop at eof" { - logrus.Errorf("Error stopping logger: %v", tailError) - } if err != nil && errors.Cause(err) != define.ErrNoSuchCtr { logrus.Errorf("Error getting container state: %v", err) } + go func() { + // Make sure to wait at least for the poll duration + // before stopping the file logger (see #10675). + time.Sleep(watch.POLL_DURATION) + tailError := t.StopAtEOF() + if tailError != nil && tailError.Error() != "tail: stop at eof" { + logrus.Errorf("Error stopping logger: %v", tailError) + } + }() return nil } |