kube icon indicating copy to clipboard operation
kube copied to clipboard

getting "unexpected EOF during chunk size line" when showing container logs

Open Masber opened this issue 2 years ago • 2 comments

Current and expected behavior

I use a code like this to get container logs:

    use futures_util::{StreamExt, TryStreamExt};
...
                let mut logs = pods_api
                .log_stream(
                    &cfs_session_pod_name, 
                    &kube::api::LogParams {
                        follow: true,
                        // tail_lines: Some(1),
                        container: Some(container_name),
                        ..kube::api::LogParams::default()
                    }
                ).await?.boxed();
                
                while let Some(line) = logs.try_next().await? {
                    print!("{}", std::str::from_utf8(&line).unwrap());
                }

This code shows container logs however it fails after a while with the error message:

Error: HyperError(hyper::Error(Body, hyper::Error(Body, Custom { kind: UnexpectedEof, error: "unexpected EOF during chunk size line" })))

Possible solution

No response

Additional context

No response

Environment

Client Version: v1.22.1
Server Version: v1.21.4

Configuration and features

kube = { version = "0.74.0", features = ["runtime", "derive", "native-tls", "ws"] }
k8s-openapi = { version = "0.15.0", features = ["v1_24"] }

Affected crates

No response

Would you like to work on fixing this bug?

No response

Masber avatar Nov 07 '22 16:11 Masber

How long after does it start failing for you? In the other watch apis we actually catch the EOFs because it tends to happen after about 5 minutes: https://github.com/kube-rs/kube/blob/f6ca7df140ec1e538b5fc6309e25ec5093bc17d3/kube-client/src/client/mod.rs#L279-L324

We currently do not do this for request_text_stream (above in same file), but in theory we could do this.

clux avatar Nov 08 '22 02:11 clux

it takes a while to appear, I have not counted the minutes but definitely more than 2 mins

Masber avatar Nov 08 '22 21:11 Masber