Skip to content
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

fix(p2p): disable sending message when not ready to prevent busy loop #5032

Merged
merged 2 commits into from
Sep 5, 2024

Conversation

Erigara
Copy link
Contributor

@Erigara Erigara commented Sep 4, 2024

Context

It was observed that iroha consume a lot CPU in idle state, turned out it was due to accidental busy loop in p2p code.

Closes: #5033

Solution

Add conditional disabling sending message in Peer even loop when there is no data to be sent to prevent busy loop.

@Erigara Erigara added the Bug Something isn't working label Sep 4, 2024
@Erigara Erigara self-assigned this Sep 4, 2024
mversic
mversic previously approved these changes Sep 5, 2024
@mversic mversic enabled auto-merge (squash) September 5, 2024 03:21
DCNick3
DCNick3 previously approved these changes Sep 5, 2024
Copy link
Contributor

@DCNick3 DCNick3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a correct fix. Although tokio::select! is always tricky..

p2p/src/peer.rs Show resolved Hide resolved
@Erigara Erigara dismissed stale reviews from DCNick3 and mversic via 530aeff September 5, 2024 08:56
@mversic mversic merged commit 995da4e into hyperledger-iroha:main Sep 5, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Increased CPU usage after deployment on Docker/Kubernetes.
3 participants