Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

fix(rpc): recreate dead and uncleaned subscriptions#22281

Merged
CriesofCarrots merged 1 commit intosolana-labs:masterfrom
00nktk:replaceable-sub-token
Jan 5, 2022
Merged

fix(rpc): recreate dead and uncleaned subscriptions#22281
CriesofCarrots merged 1 commit intosolana-labs:masterfrom
00nktk:replaceable-sub-token

Conversation

@00nktk
Copy link
Copy Markdown
Contributor

@00nktk 00nktk commented Jan 4, 2022

Problem

Currently SubscriptionTracker panics if there's a Weak pointer to a dead Arc<SubscriptionTokenInner>. This happens due to a race condition between SubscriptionTracker::subscribe method and SubscriptionTokenInner Drop implementation since both are trying to acquire a write lock to the same DashMap shard (via DashMap::entry method).

Summary of Changes

  • SubscriptionTracker now will recreate the SubscriptionToken with the same id if dead Weak is encountered.
  • SubscriptionTokenInner Drop implementation now checks that the Weak pointer is dead before removing it.

Fixes #21948
Closes #22254

@mergify mergify Bot added the community Community contribution label Jan 4, 2022
@mergify mergify Bot requested a review from a team January 4, 2022 21:10
@CriesofCarrots CriesofCarrots self-requested a review January 4, 2022 21:13
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 5, 2022

Codecov Report

Merging #22281 (567d612) into master (2486e21) will increase coverage by 0.0%.
The diff coverage is 68.1%.

@@           Coverage Diff           @@
##           master   #22281   +/-   ##
=======================================
  Coverage    81.1%    81.1%           
=======================================
  Files         523      523           
  Lines      146705   146714    +9     
=======================================
+ Hits       119012   119028   +16     
+ Misses      27693    27686    -7     

Copy link
Copy Markdown
Contributor

@CriesofCarrots CriesofCarrots left a comment

Choose a reason for hiding this comment

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

Thank you

@CriesofCarrots CriesofCarrots merged commit c1995c6 into solana-labs:master Jan 5, 2022
mergify Bot pushed a commit that referenced this pull request Jan 5, 2022
mergify Bot pushed a commit that referenced this pull request Jan 5, 2022
mergify Bot added a commit that referenced this pull request Jan 5, 2022
(cherry picked from commit c1995c6)

Co-authored-by: Nikita <bananaelecitrus@gmail.com>
mergify Bot added a commit that referenced this pull request Jan 5, 2022
(cherry picked from commit c1995c6)

Co-authored-by: Nikita <bananaelecitrus@gmail.com>
@brooksprumo brooksprumo mentioned this pull request Jan 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

community Community contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rpc node restarts with dead subscription encountered in SubscriptionControl

2 participants