astefanutti / kubebox

⎈❏ Terminal and Web console for Kubernetes
http://astefanutti.github.io/kubebox
MIT License
2.14k stars 142 forks source link

Kubebox crashes when viewing pod that actively produces logs #93

Closed JarnoRFB closed 3 years ago

JarnoRFB commented 3 years ago

I just installed kubebox v0.8 on Ubuntu 19.10. Everything seems to work, but when I select a pod that actively produces logs, it just crashes and prints "Error" on the console.

I would be happy to provide more detailed information, but I am not sure how to access the actual error logs.

Also we do not have currently cAdvisor installed on our cluster, so the Resources tabs never works, but that should not infringed the other functionality and I am mainly interested in logs at the moment.

astefanutti commented 3 years ago

Thanks for the report. I'll try to reproduce ASAP, or at least find a way to get more information.

In the meantime, would you be able to run the Docker container version, and see if you reproduce the issue, e.g.:

$ docker run -it --rm -v ~/.kube/:/home/node/.kube/:ro astefanutti/kubebox

It uses another version of Node, and without the single binary executable, so that would help narrowing the analysis.

JarnoRFB commented 3 years ago

Thanks for the quick reply! I ran it in the docker image, and I noticed now that the crash only occurs when the pod starts to stream a lot of logs. I.e. I was watching logs for some minutes, once the pod started to produce several lines of logs per second, kubebox crashed. When running it with the docker image, it printed the following error to the console upon crashing:

TypeError: buffer.readUInt64BE is not a function
    at decodeFrame (/kubebox/client.js:1711:21)
    at decode (/kubebox/client.js:1654:17)
    at decode.next (<anonymous>)
    at TLSSocket.socket.on.data (/kubebox/client.js:1610:31)
    at TLSSocket.emit (events.js:160:13)
    at addChunk (_stream_readable.js:269:12)
    at readableAddChunk (_stream_readable.js:256:11)
    at TLSSocket.Readable.push (_stream_readable.js:213:10)
    at TLSWrap.onread (net.js:602:20)
astefanutti commented 3 years ago

Thanks a lot. It seems the culprit is that call to the readUInt64BE method that does not exist, while it should be readBigUInt64BE:

https://nodejs.org/api/buffer.html#buffer_buf_readbiguint64be_offset

It’s consistent with your use case, as this branch is called only when larger data is received:

https://github.com/astefanutti/kubebox/blob/6320993dc8d1d2f9e4c1e694c354cc60b05dac44/lib/http-then.js#L340

astefanutti commented 3 years ago

It should be fixed with 36915934d4530308a1b37cbf80b70406adb72e3f. Thanks for your patience.