googleapis / googleapis/google-cloud-php

Bigtable: race condition in resuming ReadRows can lead to unintentional full table scan

Open
#5,858 5 comments 0 reactions 1 assignee Assigned to @bshaffer View on GitHub
api: bigtable lang: php priority: p2 type: bug
Dominant language
PHP
Stars
1.2k
Forks
463
Avg merge
2d 1h
Merged PRs (30d)
145

Description

This client seems to have a similar bug as:

https://github.com/googleapis/google-cloud-go/commit/566ccf326f970b4fd1168bc0b6b474e94eeb6460
and
https://github.com/googleapis/python-bigtable/pull/554

I believe the resumption code:

https://github.com/googleapis/google-cloud-php/blob/6ece84084e1211afba977b3dbefd0b82730dd600/Bigtable/src/ChunkFormatter.php#L211-L222

Is vulnerable to a race condition:
1. client sends a read request for range [a,c]
2. server sends back the data chunks row c
3. but before the OK trailers are received, the deadline expires
4. the retry logic will craft a retry request that will exclude ranges that can been consumed, leaving an empty RowSet
5. client will use the empty RowSet for the retry attempt
6. server will interpret the RPC as a full table scan

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.