Skip to content

Conversation

@kostasrim
Copy link
Contributor

@kostasrim kostasrim commented Oct 17, 2025

Preempting in the destructor of ProtocolClient is error prone when a thread local shared_ptr releases the underline object as part of an (operator=) assignment statement. The assignment on the thread local will block while the ProtocolClient is released and another fiber can grab a copy of it while the object is in a mixed state.

Furthermore, there is a data race in GetSummary() and ProtocolClient::Sock() initialization. Even though Sock() is not yet initialized, we know prior on which proactor its fiber will run. Therefore, we can remove the call to Sock() and dispatch the callback directly to socket the thread avoiding the data race.

  • remove preemption from ~ProtocolClient
  • fix rare race condition last_io_time_ by making it atomic
  • always dispatch in socket thread for Replica::GetSummary()

@kostasrim kostasrim self-assigned this Oct 17, 2025
@kostasrim
Copy link
Contributor Author

@romange you asked here to deprecate info_replication_valkey_compatible #5864 (review)

To clarify, you mean absl deprecate the flag and remove it ?

break;
}

CloseSocket();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@BorysTheDev is there any other place that I forgot to CloseSocket() ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think so

@kostasrim kostasrim marked this pull request as ready for review October 20, 2025 13:59
@kostasrim kostasrim requested review from dranikpg and romange October 20, 2025 15:14
@kostasrim kostasrim merged commit 6bb5195 into main Oct 22, 2025
16 of 26 checks passed
@kostasrim kostasrim deleted the kpr6 branch October 22, 2025 07:49
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.

5 participants