Bug 1289476 - docker run crashes with "Unrecognized input header" when container outputs to stdout and stderr simultaneously
docker run crashes with "Unrecognized input header" when container outputs to...
Product: Fedora
Classification: Fedora
Component: docker (Show other bugs)
x86_64 Linux
unspecified Severity unspecified
: ---
: ---
Assigned To: Antonio Murdaca
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2015-12-08 04:27 EST by Tobias Henkel
Modified: 2016-12-20 11:44 EST (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2016-12-20 11:44:52 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Tobias Henkel 2015-12-08 04:27:57 EST
Description of problem:
During docker run (e.g. docker run --rm <CONTAINER> <SCRIPT>) the docker client run sometimes crashes with the error message "Unrecognized input header" if SCRIPT is doing multithreaded outputs to stdout and stderr.
This seems to be caused by broken multiplexing of stdout and stderr in the docker daemon.

`docker version`:
Docker version 1.9.1-fc23, build f7c1d52-dirty

`uname -a`:
Linux fedora23-1.novalocal 4.2.3-300.fc23.x86_64 #1 SMP Mon Oct 5 15:42:54 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

How reproducible:
This can be reproduced by doing a "docker run" with a executable (see below) which does multithreaded writes to stdout and stderr.

Steps to Reproduce:

1. Create Dockerfile
$ cat > Dockerfile <<EOF
FROM fedora:23
RUN dnf install -y gcc-c++ && dnf clean all
COPY main.cpp /main.cpp
RUN g++ -std=c++11 -pthread /main.cpp -o /test

2. Create test program
$ cat > main.cpp <<EOF
#include <thread>
#include <iostream>

void print_stdout() {
        for (int i=0; i<10000; ++i) {
                std::cout <<
void print_stderr() {
        for (int i=0; i<10000; i++) {
                std::cerr << "Error!";
int main() {
        std::thread t1(print_stdout);
        std::thread t2(print_stderr);


3. Create test script:
$ cat > run-test.sh <<EOF
set -e
set -o pipefail
for i in \`seq 1 10\`; do
        docker run --rm dockertest 2>&1 | { grep "Unrecognized input header" || true; }
echo "No error"

4. Make test script executable: chmod +x run-test.sh
5. Build container: docker build -t dockertest .
6. Execute test: ./run-test.sh

Actual Results:
Script prints "Unrecognized input header" which comes from the crashed docker client.

Expected Results:
Script prints "No error"

Additional Notes:
This bug does not occur when I build and run upstream docker 1.9.1 (following https://docs.docker.com/v1.5/contributing/devenvironment/).
Comment 1 Tobias Henkel 2015-12-08 04:45:11 EST
Missed workaround:

If it's not necessary to distinguish between stdout and stderr the error can be avoided by redirecting stderr to stdout inside the container.
Comment 2 Tobias Henkel 2015-12-08 05:50:47 EST
Additional Note:
This bug also appeared after upgrading docker from 1.7.0 to 1.8.2 on F22.
Comment 3 Antonio Murdaca 2015-12-09 05:31:51 EST
Looking, actually tried everything (including your c++ code, C code with threads and go with goroutines) to reproduce this and I'm not able to get the error you're getting.
Comment 4 Tobias Henkel 2015-12-09 06:09:58 EST
Hm that's strange. I get this on all Fedora machines I tested:

 - Laptop with F23 and docker 1.8.2-fc23
 - Workstation with F22 and docker 1.8.2-fc22
 - VM with F22 (cloud image) and docker 1.8.2-fc22
 - VM with F23 (cloud image) and docker 1.9.1-fc23

Maybe worth to note:

On all machines I have the following differences to the default config:
 - Different networking settings (--bip=
 - btrfs storage backend

My docker info on the F23 VM:

$ docker info
Containers: 1
Images: 174
Server Version: 1.9.1-fc23
Storage Driver: btrfs
 Build Version: Btrfs v4.2.2
 Library Version: 101
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 4.2.3-300.fc23.x86_64
Operating System: Fedora 23 (Cloud Edition)
CPUs: 8
Total Memory: 7.799 GiB
Name: fedora23-1.novalocal
Comment 5 Antonio Murdaca 2015-12-09 07:55:01 EST
Thanks Tobias, my setup is entirely different, I'll try to setup my vms as you mentioned in hope to reproduce it.
Comment 6 Daniel Walsh 2016-02-22 14:26:10 EST
Any update on this?
Comment 8 Antonio Murdaca 2016-06-03 15:21:26 EDT
I still cannot reproduce the original issue - I'd say, Tobias can you try out if this is still happening with docker 1.10.3? Thanks
Comment 9 Daniel Walsh 2016-06-03 16:11:49 EDT
Well we will claim it is fixed in docker-1.10.3  :^)
Comment 10 Fedora End Of Life 2016-11-24 09:03:32 EST
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 11 Fedora End Of Life 2016-12-20 11:44:52 EST
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.