Skip to content

fix(routing): add per-peer timeouts for PutValue and Provide#1222

Merged
guillaumemichel merged 1 commit intomasterfrom
fix/put-operation-timeouts
Jan 21, 2026
Merged

fix(routing): add per-peer timeouts for PutValue and Provide#1222
guillaumemichel merged 1 commit intomasterfrom
fix/put-operation-timeouts

Conversation

@lidel
Copy link
Copy Markdown
Member

@lidel lidel commented Jan 20, 2026

when communicating with unresponsive peers, PutValue and classicProvide could (a) hang indefinitely because they used context.WithCancel without timeout or (b) reused the "global" parent context without a per-operation timeout.

this PR adds a 30-second per-peer timeout to prevent a single slow peer from blocking the entire operation. the timeout matches what updatePeerValues already used, now extracted into a shared constant.

this is another "belt and suspenders" protection, inspired by issue was fixed in libp2p/go-libp2p#3448 where stream.Close could hang indefinitely on unresponsive peers

when communicating with unresponsive peers, PutValue and classicProvide
could hang indefinitely because they used context.WithCancel or reused
the parent context without a per-operation timeout.

this adds a 30-second per-peer timeout to prevent a single slow peer
from blocking the entire operation. the timeout matches what
updatePeerValues already used, now extracted into a shared constant.

similar issue was fixed in go-libp2p#3448 where stream.Close could hang
indefinitely on unresponsive peers.
@lidel lidel marked this pull request as ready for review January 21, 2026 02:00
Copy link
Copy Markdown
Collaborator

@guillaumemichel guillaumemichel left a comment

Choose a reason for hiding this comment

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

Thanks!

@guillaumemichel guillaumemichel merged commit 77a76e9 into master Jan 21, 2026
9 checks passed
@guillaumemichel guillaumemichel deleted the fix/put-operation-timeouts branch January 21, 2026 08:46
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.

2 participants