-
Notifications
You must be signed in to change notification settings - Fork 428
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
Bigtable: race condition in resuming ReadRows can lead to unintentional full table scan #5858
Comments
Thanks for reporting this @igorbernstein2! If I understand the solution implemented in python and go correctly, the solution is to validate that the ranges are valid before sending in the request. So in our case, it would be something like this: if (count($ranges) < 1) {
throw new RuntimeException('Invalid range');
}
$rowSet->setRowRanges($ranges); I'm still not sure where the race condition would take place, but we could implement something like that to be safe. WDYT? (cc @saranshdhingra as this looks to be an issue for your team!) |
Maybe this is what I don't understand. If the values in |
The entry point is ResumeableStream: google-cloud-php/Bigtable/src/ChunkFormatter.php Lines 127 to 144 in 91afd16
for every retry attempt it will call updateOptions In the case I described above, ResumeableStream will get the DeadlineExceeded code and invoke updateOptions before sending a retry attempt. UpdateOptions will then truncate the rowset and make it empty. Empty row set means a full table scan. So when ResumableStream sends the next attempt it will trigger a full table scan |
@igorbernstein2 So how should the library behave in this event? A straight up failure with an exception message or ignorance of deadline exceed error code and finish the operation? 🧐 |
This client seems to have a similar bug as:
googleapis/google-cloud-go@566ccf3
and
googleapis/python-bigtable#554
I believe the resumption code:
google-cloud-php/Bigtable/src/ChunkFormatter.php
Lines 211 to 222 in 6ece840
Is vulnerable to a race condition:
The text was updated successfully, but these errors were encountered: