summaryrefslogtreecommitdiff
path: root/pkg/varlinkapi/events.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2020-07-01 16:21:57 -0400
committerMatthew Heon <matthew.heon@pm.me>2020-07-06 13:14:31 -0400
commit4995c511e581723ee9d441d500eda2e6d2e8a839 (patch)
tree595ada761cdd9fb6e10cfea00feab6fbf99702f2 /pkg/varlinkapi/events.go
parent637ff7b7e915f0f6e5d9377382a521d9148120a2 (diff)
downloadpodman-4995c511e581723ee9d441d500eda2e6d2e8a839.tar.gz
podman-4995c511e581723ee9d441d500eda2e6d2e8a839.tar.bz2
podman-4995c511e581723ee9d441d500eda2e6d2e8a839.zip
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>
Diffstat (limited to 'pkg/varlinkapi/events.go')
-rw-r--r--pkg/varlinkapi/events.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/pkg/varlinkapi/events.go b/pkg/varlinkapi/events.go
index 2e468b706..910b64a57 100644
--- a/pkg/varlinkapi/events.go
+++ b/pkg/varlinkapi/events.go
@@ -3,6 +3,7 @@
package varlinkapi
import (
+ "context"
"time"
"github.com/containers/libpod/v2/libpod/events"
@@ -27,7 +28,7 @@ func (i *VarlinkAPI) GetEvents(call iopodman.VarlinkCall, filter []string, since
eventChannel := make(chan *events.Event)
go func() {
readOpts := events.ReadOptions{FromStart: fromStart, Stream: stream, Filters: filter, EventChannel: eventChannel}
- eventsError = i.Runtime.Events(readOpts)
+ eventsError = i.Runtime.Events(context.Background(), readOpts)
}()
if eventsError != nil {
return call.ReplyErrorOccurred(eventsError.Error())