summaryrefslogtreecommitdiff
path: root/libpod/storage.go
diff options
context:
space:
mode:
authorW. Trevor King <wking@tremily.us>2018-06-28 08:00:23 -0700
committerAtomic Bot <atomic-devel@projectatomic.io>2018-06-28 15:53:02 +0000
commitc82166afabd63f6271990be89ffa6609d3dc6712 (patch)
treecaa892a71ef31efd282ee677605e6f089e33f5de /libpod/storage.go
parent333ab8c21120c3f7e6b3df7a6a49ca860f079266 (diff)
downloadpodman-c82166afabd63f6271990be89ffa6609d3dc6712.tar.gz
podman-c82166afabd63f6271990be89ffa6609d3dc6712.tar.bz2
podman-c82166afabd63f6271990be89ffa6609d3dc6712.zip
cmd/podman/utils.go: Cancel-able resize writes
On Thu, Jun 28, 2018 at 03:48:26AM -0700, Marco Vedovati wrote [1]: > The root cause is a deadlock between two channel writes made by two > different goroutines: > > 1. `resizeTty() : go func(){} : sendUpdate()` is sending a resize > message thru `resize` right at the beginning, but the channel is > never read if some startup error occurs. > > 2. Upon program termination, `startAttachCtr() : defer func(){} ` is > telling the goroutine in "1." to stop via the `resizeTerminate` > channel. But that guy is still waiting for the write to `resize` > to complete so the the termination message is never read. > > I think the go deadlock detection does not kick in because not all > goroutines are seen as asleep. E.g. `os/signal Notify()` is enough > to have the deadlock not detected. 333ab8c2 (Fix podman hangs when detecting startup error in container attached mode, 2018-06-27, #1010) addressed this with a deferred drain. This commit adjusts that approach to use a single select to cover "have we been canceled?", "has there been a resize signal?", and (when we have one) "can we write the most recent resize event to the resize channel?". A side benefit to this approach is that if we have a slow resize consumer and several resize signals, the resizeTty function will keep updating its local resizeEvent. Once the resize channel is able to accept, only the most-recent event will be written. Previously we'd have written one resize event for every received signal, even if the resize consumer was falling behind. [1]: https://github.com/projectatomic/libpod/pull/1010#issuecomment-400994436 Signed-off-by: W. Trevor King <wking@tremily.us> Closes: #1018 Approved by: rhatdan
Diffstat (limited to 'libpod/storage.go')
0 files changed, 0 insertions, 0 deletions