Repository navigation
face: make UnicastTCPTransport.Close() non-blocking - #229
Merged
tianyuan129 merged 2 commits intoOct 19, 2026
Merged
Conversation
Close() performs an unconditional blocking send on rechan. If a previous Close() already queued the signal while runReceive exited without receiving it (e.g. mgmt faces/destroy followed by the deferred Close in runReceive), the second send blocks forever: the receive/send goroutines leak, the face table entry is never removed, and the face expiration sweeper wedges on the same channel, stopping expiration for all on-demand faces. Use a non-blocking send so repeated Close() calls are safe.
tianyuan129
approved these changes
Oct 19, 2026
Member
Author
|
A bit of information on how to demonstrate the effect of this bug: # console A
sudo ./ndnd fw run ./fw/yanfd.sample.yml
# console B
NDN_CLIENT_TRANSPORT=tcp://127.0.0.1:6363 ndnping /A
# console C
nfdc face # find the TCP face of ndnping
nfdc face 8 # use the FaceID identified
# console A: press CTRL+CWithout the fix, NDNd forwarder cannot exit upon CTRL+C. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Close() performs an unconditional blocking send on rechan. If a previous Close() already queued the signal while runReceive exited without receiving it (e.g. mgmt faces/destroy followed by the deferred Close in runReceive), the second send blocks forever: the receive/send goroutines leak, the face table entry is never removed, and the face expiration sweeper wedges on the same channel, stopping expiration for all on-demand faces.
Use a non-blocking send so repeated Close() calls are safe.
Note: this bug was identified and patch generated by https://muse.ai but the submitter has reviewed the code.