8000 cilium-cli: Fix logger busy loop by jrajahalme · Pull Request #38199 · cilium/cilium · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

cilium-cli: Fix logger busy loop #38199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 17, 2025

Conversation

jrajahalme
Copy link
Member
@jrajahalme jrajahalme commented Mar 14, 2025

Eliminate concurrent logger busy loop when no tests are yet running. This happens when cilium-cli waits for test deployments to be ready.

1st commit provides the straightforward fix by adding 50ms sleep in the loop where the printer is waiting for messages.

2nd commit refactors ConcurrentLogger to eliminate the need for time.Sleep as well as internal locking as follows:

  • have the same goroutine receiving and writing the messages, eliminating the need for locking
  • choose any available test as the current one and stream its messages directly, while buffering messages for all other tests
  • when the current test is finished, write out the logs of all other finished tests and choose any one of the available tests as the current one

Break busy loop with 50ms sleeps when no tests are yet running. This
happens when cilium-cli waits for test deployments to be ready.

Signed-off-by: Jarno Rajahalme <jarno@isovalent.com>
@jrajahalme jrajahalme added release-note/bug This PR fixes an issue in a previous release of Cilium. cilium-cli-exclusive This PR only impacts cilium-cli binary labels Mar 14, 2025
@jrajahalme jrajahalme requested review from a team as code owners March 14, 2025 14:47
@jrajahalme jrajahalme requested review from brlbil and derailed March 14, 2025 14:47
@github-actions github-actions bot added the cilium-cli This PR contains changes related with cilium-cli label Mar 14, 2025
@jrajahalme jrajahalme force-pushed the cilium-cli-fix-logger-busy-loop branch from 2d1755e to 903d25c Compare March 14, 2025 14:48
@jrajahalme
Copy link
Member Author

/test

Concurrent logger busy-looped when waiting for the first test to start.

While this could be fixed by checking for this case and sleeping a while,
it is better to simplify the structure as follows:

- have the same goroutine receiving and writing messages, eliminating the
  need for locking

- choose any available test as the current one and stream its messages
  directly, while buffering messages for all other tests

- when the current test is finished, print out the logs of all other
  finished tests and choose any one of the available tests as the current
  one

Signed-off-by: Jarno Rajahalme <jarno@isovalent.com>
@jrajahalme jrajahalme force-pushed the cilium-cli-fix-logger-busy-loop branch from 903d25c to f232190 Compare March 14, 2025 14:56
@jrajahalme
Copy link
Member Author

/test

@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Mar 17, 2025
@joestringer joestringer added this pull request to the merge queue Mar 17, 2025
Merged via the queue into cilium:main with commit da3fecc Mar 17, 2025
67 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cilium-cli This PR contains changes related with cilium-cli cilium-cli-exclusive This PR only impacts cilium-cli binary ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/bug This PR fixes an issue in a previous release of Cilium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0