Skip to content

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

Merged
mversic merged 2 commits intohyperledger-iroha:mainfrom
Erigara:fix_peer_busy_loop
Sep 5, 2024
Merged

fix(p2p): disable sending message when not ready to prevent busy loop#5032
mversic merged 2 commits intohyperledger-iroha:mainfrom
Erigara:fix_peer_busy_loop

Conversation

@Erigara
Copy link
Copy Markdown
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
Copy Markdown
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..

Comment thread p2p/src/peer.rs
@Erigara Erigara dismissed stale reviews from DCNick3 and mversic via 530aeff September 5, 2024 08:56
Erigara and others added 2 commits September 5, 2024 11:57
Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
Co-authored-by: ⭐️NINIKA⭐️ <DCNick3@users.noreply.github.com>
Signed-off-by: Shanin Roman <40040452+Erigara@users.noreply.github.com>
@mversic mversic merged commit 995da4e into hyperledger-iroha:main Sep 5, 2024
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