Bug 1359199

Summary: Race condition using docker exec with tty
Product: Red Hat Enterprise Linux 7 Reporter: Andy Goldstein <agoldste>
Component: dockerAssignee: Lokesh Mandvekar <lsm5>
Status: CLOSED ERRATA QA Contact: atomic-bugs <atomic-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.2CC: lsm5, lsu
Target Milestone: rcKeywords: Extras, ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-08-03 20:56:57 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:

Description Andy Goldstein 2016-07-22 13:43:44 UTC
Description of problem: Sometimes when running 'docker exec -it ...', output from the command is lost.


Version-Release number of selected component (if applicable): 1.10.3-44.el7


How reproducible: easily


Steps to Reproduce:
1. docker run -d --name c7 centos:centos7 sleep 9999999
2. while true; do x=$(docker exec -t c7 cat /etc/hosts); if [ -z "${x}" ]; then break; fi; done

Actual results: the while loop exits


Expected results: the while loop should not exit


Additional info:

If you remove the -t (docker exec c7 cat /etc/hosts), there is no issue.

This is fixed by https://github.com/docker/docker/pull/21018

Comment 3 Luwen Su 2016-07-25 08:56:35 UTC
Wors well for me in docker-1.10.3-46.el7.8.x86_64,
I wait for a moment to see the ouput, but the ``while`` ends.

# while true; do x=$(docker exec -t c9 cat /etc/hosts); echo ${x} ;if [ -z "${x}" ]; then break; fi; done
 172.17.0.2 7aeb15a8df81host ip6-loopback
 172.17.0.2 7aeb15a8df81host ip6-loopback
 172.17.0.2 7aeb15a8df81host ip6-loopback
 172.17.0.2 7aeb15a8df81host ip6-loopback
 172.17.0.2 7aeb15a8df81host ip6-loopback
 172.17.0.2 7aeb15a8df81host ip6-loopback
 172.17.0.2 7aeb15a8df81host ip6-loopback
 172.17.0.2 7aeb15a8df81host ip6-loopback
 172.17.0.2 7aeb15a8df81host ip6-loopback
 172.17.0.2 7aeb15a8df81host ip6-loopback
 172.17.0.2 7aeb15a8df81host ip6-loopback
 172.17.0.2 7aeb15a8df81host ip6-loopback
 172.17.0.2 7aeb15a8df81host ip6-loopback
 172.17.0.2 7aeb15a8df81host ip6-loopback
 172.17.0.2 7aeb15a8df81host ip6-loopback
.....

Comment 5 errata-xmlrpc 2016-08-03 20:56:57 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.

https://rhn.redhat.com/errata/RHBA-2016-1446.html