hubble-cli: prevent empty strings in colorer escape sequences to fix excessive cpu usage#44119
Conversation
7f4fa7b to
ce6d0bb
Compare
ce6d0bb to
92b3fbb
Compare
|
/test |
|
@chancez This small pull request is waiting for a review from you. |
|
@tporeba You'll need to address the CI failures before we can merge :) |
e2035ea to
05824d6
Compare
Add additional empty string checks to the code generating colorer escape sequences. Empty strings in sequences were misinterpreted and caused a lot of unnecessary string replace calls in terminalEscaperWriter increasing CPU usage significantly under high load. Fixes cilium#42564 Signed-off-by: Tomasz Poręba <tporeba@gmail.com>
05824d6 to
e95c0f3
Compare
|
/test |
|
I see that tklauser did that before I noticed. Thank you :) |
|
@pchaigno @tklauser Could you please add necessary labels to this PR, so this gets backported to versions 1.17, 1.18, 1.19? But I don't have necessary permissions to do that myself. |
|
@tporeba I've added the labels for backporting to all supported versions. The regression is severe enough and the patch simple enough that I think we can argue for backporting to v1.18 and v1.17. |
Please ensure your pull request adheres to the following guidelines:
description and a
Fixes: #XXXline if the commit addresses a particularGitHub issue.
Fixes: <commit-id>tag, thenplease add the commit author[s] as reviewer[s] to this issue.
// no, thank you :)
This PR adds additional empty string checks to the colorer
sequences()func responsible for generating color escape sequences.A bug in this func caused non-empty list of sequenced being generated for cases when coloring was expected to be disabled - there was an empty string returned in the array in such cases. Those empty strings were misinterpreted and caused a lot of unnecessary string replace calls in
terminalEscaperWriter, increasing CPU usage ofhubble observecommand significantly under high load.Fixes: #42564