Fix receiver hanging by closing notifyCh when transfer completes #23
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.
Fix receiver hanging and improve worker coordination in bandwidth-test
Problem
The bandwidth-test tool was hanging when using
--enable-unordered-processingand--dynamic-allocationflags. Investigation revealed two separate coordination issues:Run()method would wait indefinitely on thenotifyChchannel because it was never closed when transfer completedSolutions
1. Receiver Hanging Fix
Added a call to
close(r.notifyCh)when thefinishedflag is set in the receiver'sRun()method inpkg/receiver/receiver.go. This ensures that when the transfer completes, the notification channel is properly closed and the receiver exits gracefully.2. Worker Coordination Improvements
Enhanced the worker MatchController in
worker/match.goto prevent potential race conditions:Changes
notifyChchannel when transfer completion is detectedTesting Status
Thread Safety
Both fixes are thread-safe:
Link to Devin run: https://app.devin.ai/sessions/7aebecaa35434b3287a73d7ed43f7300
Requested by: fatedier ([email protected])