Bug 1110388

Summary: docker events --since=X un-documented pty-dependent behavior
Product: Red Hat Enterprise Linux 7 Reporter: Chris Evich <cevich>
Component: dockerAssignee: Matthew Heon <mheon>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.0CC: bsarathy, dwalsh, jrieden
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-18 20:45:50 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1109938    

Description Chris Evich 2014-06-17 14:24:38 UTC
Description of problem:

The "streaming" behavior of docker events with --since option, changes if running under tty/pty.  Without the --events option, it always "streams" events as they happen untill the command is killed (expected).  However, if there is no pty/tty, and --since is used, the command exits after outputing past events (unexpected).  When a pty/tty is in control, the past events are output, then events "stream" until the process is killed.

Version-Release number of selected component (if applicable):
docker-0.11.1-19.el7.x86_64

How reproducible:
Easy

Steps to Reproduce:
1. docker events
2. echo "$(docker events)"
3. docker events --since=0
4. echo "$(docker events --since=0)"

Actual results:
#1 and #2 match in output + behavior (i.e. "stream" until killed)
#3 and #4 do NOT match (i.e. output and streaming behavior differ)

Expected results:
#3 and #4 should output and behavior should match.  Preferably "streaming" events, as #1 and #2 do - though 'help' text does not specify.

Additional info:
This is a regression from previous behavior (IIRC, before bug 1095901 was fixed).

An alternative fix could be fixing behavior of --since with a tty/pty, so it always exits after displaying prior events.  The downside would be, for "things" following events output, some could be lost between end of streaming past, and beginning of streaming new.  e.g.  docker events --since=0 > logfile && docker events >> logfile

Found on RHEL 7 GA using Autotest 0.16.0-master-63-g35e93, Docker test 0.7.4, "docker_cli/events" sub-test.

Comment 2 Daniel Walsh 2014-06-27 16:23:05 UTC
Seems to be working on docker-1.0

Comment 3 Matthew Heon 2014-07-18 13:22:50 UTC
Cannot reproduce this on RHEL7 with docker-1.0.0-10 - docker events --since='CURRENT_DATE' hangs, streaming new events, even when launched without a TTY.

Comment 4 Chris Evich 2014-07-18 15:36:42 UTC
Confirmed docker-1.0.0-10.el7.x86_64 Docker version 1.0.0, build 20fdb42/1.0.0


Both with and without --since, the foregound process waits for it's child to finish (or be killed), then dumps everything that was output.  So the behavior is consistent now.

Comment 6 errata-xmlrpc 2014-09-18 20:45:50 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1266.html