diff options
author | Matthew Heon <matthew.heon@pm.me> | 2020-07-01 16:21:57 -0400 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2020-07-02 09:57:39 -0400 |
commit | 9e4cf6ca513fa0646f33ade14955e1fc4335e176 (patch) | |
tree | 9c820378fb4e2d0873ca24da5766691ffc4b6ccd /libpod/events/journal_linux.go | |
parent | 1a1e3f4b24e6f856a5c2e16da0cc34a8191c9403 (diff) | |
download | podman-9e4cf6ca513fa0646f33ade14955e1fc4335e176.tar.gz podman-9e4cf6ca513fa0646f33ade14955e1fc4335e176.tar.bz2 podman-9e4cf6ca513fa0646f33ade14955e1fc4335e176.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 'libpod/events/journal_linux.go')
-rw-r--r-- | libpod/events/journal_linux.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libpod/events/journal_linux.go b/libpod/events/journal_linux.go index 482435038..d341ca7b5 100644 --- a/libpod/events/journal_linux.go +++ b/libpod/events/journal_linux.go @@ -3,6 +3,7 @@ package events import ( + "context" "fmt" "strconv" "time" @@ -53,7 +54,7 @@ func (e EventJournalD) Write(ee Event) error { } // Read reads events from the journal and sends qualified events to the event channel -func (e EventJournalD) Read(options ReadOptions) error { +func (e EventJournalD) Read(ctx context.Context, options ReadOptions) error { defer close(options.EventChannel) eventOptions, err := generateEventOptions(options.Filters, options.Since, options.Until) if err != nil { |