mirror of
https://github.com/containers/podman.git
synced 2025-06-26 04:46:57 +08:00
Fix system service
panic from early hangup in events
We weren't actually halting the goroutine that sent events, so it would continue sending even when the channel closed (the most notable cause being early hangup - e.g. Control-c on a curl session). Use a context to cancel the events goroutine and stop sending events. Fixes #6805 Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:
@ -4,6 +4,7 @@ package varlinkapi
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"context"
|
||||
"io"
|
||||
|
||||
"github.com/containers/libpod/libpod"
|
||||
@ -89,7 +90,7 @@ func (i *VarlinkAPI) Attach(call iopodman.VarlinkCall, name string, detachKeys s
|
||||
if ecode, err := ctr.Wait(); err != nil {
|
||||
if errors.Cause(err) == define.ErrNoSuchCtr {
|
||||
// Check events
|
||||
event, err := i.Runtime.GetLastContainerEvent(ctr.ID(), events.Exited)
|
||||
event, err := i.Runtime.GetLastContainerEvent(context.Background(), ctr.ID(), events.Exited)
|
||||
if err != nil {
|
||||
logrus.Errorf("Cannot get exit code: %v", err)
|
||||
exitCode = define.ExecErrorCodeNotFound
|
||||
|
Reference in New Issue
Block a user