diff options
author | Paul Holzinger <pholzing@redhat.com> | 2022-03-24 11:59:50 +0100 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2022-03-30 15:36:05 -0400 |
commit | e93dc6c784d5242c529077de86e3dbaf33e07666 (patch) | |
tree | e5966211ba8503315190545befa3fc73ebcede66 /libpod | |
parent | 1e8c8e912ad1cb4b7c40206edc94ec1cb125ccf2 (diff) | |
download | podman-e93dc6c784d5242c529077de86e3dbaf33e07666.tar.gz podman-e93dc6c784d5242c529077de86e3dbaf33e07666.tar.bz2 podman-e93dc6c784d5242c529077de86e3dbaf33e07666.zip |
readConmonPipeData: try to improve error
Issue #10927 reports `container create failed (no logs from conmon): EOF`
errors. Since we do not know the root cause it would be helpful to try
to get as much info as possible out of the error.
(buffer).ReadBytes() will return the bytes read even when an error
occurs. So when we get an EOF we could still have some valuable
information in the buffer. Lets try to unmarshal them and if this fails
we add the bytes to the error message.
This does not fix the issue but it might help us getting a better error.
[NO NEW TESTS NEEDED]
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/oci_conmon_linux.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libpod/oci_conmon_linux.go b/libpod/oci_conmon_linux.go index 72864b656..7c4fffa5f 100644 --- a/libpod/oci_conmon_linux.go +++ b/libpod/oci_conmon_linux.go @@ -1585,11 +1585,13 @@ func readConmonPipeData(runtimeName string, pipe *os.File, ociLog string) (int, var si *syncInfo rdr := bufio.NewReader(pipe) b, err := rdr.ReadBytes('\n') - if err != nil { + // ignore EOF here, error is returned even when data was read + // if it is no valid json unmarshal will fail below + if err != nil && !errors.Is(err, io.EOF) { ch <- syncStruct{err: err} } if err := json.Unmarshal(b, &si); err != nil { - ch <- syncStruct{err: err} + ch <- syncStruct{err: fmt.Errorf("conmon bytes %q: %w", string(b), err)} return } ch <- syncStruct{si: si} |