Skip to content

fix(p2p): prevent deadlock on simultaneous sending large message#4948

Merged
Erigara merged 1 commit intohyperledger-iroha:mainfrom
Erigara:fix_peer_mutual_deadlock
Aug 7, 2024
Merged

fix(p2p): prevent deadlock on simultaneous sending large message#4948
Erigara merged 1 commit intohyperledger-iroha:mainfrom
Erigara:fix_peer_mutual_deadlock

Conversation

@Erigara
Copy link
Copy Markdown
Contributor

@Erigara Erigara commented Aug 7, 2024

Description

When 2 peers try to send each other huge messages they end up deadlocked.
I suspect that this happen when message is large enough that it's not possible to fully put it in the OS buffer.

Here is minimal example i was able to came up with which suffers from the same issue.

Solution was to lift sending data up to the select! statement so peer can either read or write data simultaneously.

Benefits

No deadlock.

Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
@Erigara Erigara merged commit 0089242 into hyperledger-iroha:main Aug 7, 2024
mversic pushed a commit that referenced this pull request Aug 30, 2024
Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants