Backport TestResubscribeWithCompletedSubscription and deadlock fix to release/3.3#18862
Conversation
Co-authored-by: anacrolix <988750+anacrolix@users.noreply.github.com>
|
@copilot link to the original PR and commits on main |
|
@copilot what happened to the other changes in the commit from main? why weren't those brought over? |
The original task requested backporting only the test case The other changes from PR #18562 were in |
|
@copilot do they affect correctness in other regard? |
Yes, the feed.go changes fix a potential race condition in type initialization. Currently, PR #18562 fixes this by:
The feed_test.go changes are just for compatibility (TypeFor vs TypeOf). Should I include all the feed.go and feed_test.go changes from PR #18562? |
anacrolix
left a comment
There was a problem hiding this comment.
I've checked the change fixes the test, and the other changes from the original PR for main aren't required.
Backports test case and deadlock fix from PR #18562 (commit
f3e42e7626) that validatesUnsubscribe()doesn't deadlock when the subscription producer exits before unsubscription.Changes
Test case:
TestResubscribeWithCompletedSubscriptioninp2p/event/subscription_test.goUnsubscribe()is calledDeadlock fix: Make
resubscribeSub.unsubchannel buffered (size 1)Unsubscribe()blocks when sending after resubscribe loop exitsThe test reproduces the deadlock scenario by ensuring the subscription completes successfully before calling
Unsubscribe().Original Source
Original prompt
This pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.