Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent tx_executor reading from sock if operation is canceled #4704

Merged

Conversation

BorysTheDev
Copy link
Contributor

fixes: #4689

problem: we read from the socket after it was shutdown

@BorysTheDev BorysTheDev requested review from romange and adiholden March 5, 2025 08:59
@BorysTheDev BorysTheDev changed the title fix: prevent tx_executor reading from sock if operations is canceled fix: prevent tx_executor reading from sock if operation is canceled Mar 5, 2025
@@ -67,8 +67,6 @@ class ClusterShardMigration {

auto tx_data = tx_reader.NextTxData(&reader, cntx);
if (!tx_data) {
in_migration_->ReportError(GenericError("No tx data"));
Copy link
Collaborator

Choose a reason for hiding this comment

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

why do you need this?
if there is no transaction data you need to report error? if its not running doesnt it mean that error was already reported?

Copy link
Contributor Author

@BorysTheDev BorysTheDev Mar 5, 2025

Choose a reason for hiding this comment

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

we do report inside tx_reader.NextTxData(&reader, cntx); If the cntx is canceled we don't need report. If we have error it is already reported

Copy link
Collaborator

Choose a reason for hiding this comment

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

So why do you need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't get the question. I'v removed it, because we don't need it

Copy link
Collaborator

Choose a reason for hiding this comment

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

ops sorry my eys are playing with me

break;

std::optional<TransactionData> tx_data;
while ((tx_data = tx_reader.NextTxData(&reader, cntx))) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

here it looks like we did not call the NextTxData if the cntx was closed..
so the problem is in cluster code only where you do not have such if as there was here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is no problem here. just decided to make it shorter

@BorysTheDev BorysTheDev merged commit 4d300f8 into main Mar 5, 2025
10 checks passed
@BorysTheDev BorysTheDev deleted the prevent_tx_executor_read_from_socket_if_op_is_canceled branch March 5, 2025 12:00
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.

Check error in the cluster code
2 participants