From 23b737146168d836ffb2020d83bf92f943c7ef0b Mon Sep 17 00:00:00 2001 From: "David M. Johnson" Date: Sat, 5 May 2018 21:19:39 -0600 Subject: [PATCH] Attempts to workaround docker daemon sending garbled container output. Seems that when the host is heavily loaded, docker will mix in control chars, etc, to the output of a container. We try to filter as much as possible, but sadly it's not just control chars; printable chars can sneak through. --- clientside/tmcc/linux/docker/dockerclient.pm | 3 ++- clientside/tmcc/linux/docker/libvnode_docker.pm | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/clientside/tmcc/linux/docker/dockerclient.pm b/clientside/tmcc/linux/docker/dockerclient.pm index 69898f96a..84894015a 100644 --- a/clientside/tmcc/linux/docker/dockerclient.pm +++ b/clientside/tmcc/linux/docker/dockerclient.pm @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# Copyright (c) 2017 University of Utah and the Flux Group. +# Copyright (c) 2017, 2018 University of Utah and the Flux Group. # # {{{EMULAB-LICENSE # @@ -282,6 +282,7 @@ sub container_run($$$$;$$$) { } $args->{'Image'} = $image; $args->{'Cmd'} = $cmd; + $args->{'Tty'} = JSON::PP::false; my ($code,$content,$resp); ($code,$content) = $self->container_create($id,$args); if ($code) { diff --git a/clientside/tmcc/linux/docker/libvnode_docker.pm b/clientside/tmcc/linux/docker/libvnode_docker.pm index 1db1a92e5..7184b772c 100644 --- a/clientside/tmcc/linux/docker/libvnode_docker.pm +++ b/clientside/tmcc/linux/docker/libvnode_docker.pm @@ -4128,6 +4128,12 @@ sub analyzeImage($$) if ($needunlock); return $code; } + # Santize the output. For whatever reason(s), under heavy load, it + # comes with non-printable chars occasionally, and with CRLF. Odd. + #$buf =~ s/[^[:ascii:]]//g; + #$buf =~ s/\r\n//g; + $buf =~ s/[\000-\011\014\015-\037\176-\255]//g; + TBDebugTimeStamp("analyze.sh output:\n$buf"); open(FD,">/vms/contexts/analyze-$iid"); print FD $buf; -- GitLab