google-cloud-nio: CloudStorageReadChannel: fix critical bug that could cause the channel position to overflow - #2283
Conversation
|
The long nightmare is almost over! |
|
👍 |
|
This will fix broadinstitute/gatk#2516 and broadinstitute/gatk#3316 |
|
Changes Unknown when pulling 72215b5 on droazen:dr_fix_CloudStorageReadChannel_position_overflow into ** on GoogleCloudPlatform:master**. |
…shaded This includes the fix for the position overflowing in CloudStorageReadChannel (googleapis/google-cloud-java#2283), as well as the fix for the intermittent 503 errors we've already been depending on (googleapis/google-cloud-java#2281)
…shaded This includes the fix for the position overflowing in CloudStorageReadChannel (googleapis/google-cloud-java#2283), as well as the fix for the intermittent 503 errors we've already been depending on (googleapis/google-cloud-java#2281)
…shaded (#3373) This includes the fix for the position overflowing in CloudStorageReadChannel (googleapis/google-cloud-java#2283), as well as the fix for the intermittent 503 errors we've already been depending on (googleapis/google-cloud-java#2281)
|
@garrettjonesgoogle Could we please get an official review on this PR and #2281? Without these patches This PR (#2283) fixes a nasty bug that could cause the channel position to overflow and become either negative or a wildly incorrect positive value, leading to corruption of the input stream from the client perspective. This is not a hypothetical problem -- we experienced it quite frequently! The other PR (#2281) wraps additional GCS operations within retry loops. Without that patch, 10-20% of our jobs were failing with transient 503 errors. Thanks for your help! |
michaelbausor
left a comment
There was a problem hiding this comment.
LGTM, one nit from Codacy
| // This position value will overflow to a negative value if a long -> int cast is attempted | ||
| long startPosition = 11918483280L; | ||
| ArgumentCaptor<Long> captor = ArgumentCaptor.forClass(Long.class); | ||
| final CloudStorageReadChannel channel = CloudStorageReadChannel.create(gcsStorage, file, startPosition, 1); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
…d cause the channel position to overflow This fixes a critical bug in CloudStorageReadChannel in which the channel position (a long) was getting down-cast to int in CloudStorageReadChannel.innerOpen(). This could cause the channel position to become negative or a wildly incorrect positive value if the channel position was greater than MAX_INT. In practice, this bug would only manifest itself if the channel was constructed with a non-zero initial position, or if the channel was reopened in response to an error. Included a test case that fails without the fix, and passes with the fix.
72215b5 to
398cdaa
Compare
|
@michaelbausor Thanks for the review! I've addressed the codacy error, so this should be good to go now I think. |
|
Thanks for merging this and #2281 @michaelbausor! Is there a timeline for the next |
|
Re the timing of the next release, @garrettjonesgoogle will know best |
…low (#2283) This fixes a critical bug in CloudStorageReadChannel in which the channel position (a long) was getting down-cast to int in CloudStorageReadChannel.innerOpen(). This could cause the channel position to become negative or a wildly incorrect positive value if the channel position was greater than MAX_INT. In practice, this bug would only manifest itself if the channel was constructed with a non-zero initial position, or if the channel was reopened in response to an error. Included a test case that fails without the fix, and passes with the fix.
…low (#2283) This fixes a critical bug in CloudStorageReadChannel in which the channel position (a long) was getting down-cast to int in CloudStorageReadChannel.innerOpen(). This could cause the channel position to become negative or a wildly incorrect positive value if the channel position was greater than MAX_INT. In practice, this bug would only manifest itself if the channel was constructed with a non-zero initial position, or if the channel was reopened in response to an error. Included a test case that fails without the fix, and passes with the fix.
* chore(main): release 3.35.0 * chore: generate libraries at Thu Jan 15 15:40:14 UTC 2026 --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: cloud-java-bot <cloud-java-bot@google.com>
…eapis#2283) [](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.truth:truth](https://togithub.com/google/truth) | `1.4.3` -> `1.4.4` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>google/truth (com.google.truth:truth)</summary> ### [`v1.4.4`](https://togithub.com/google/truth/releases/tag/v1.4.4) [Compare Source](https://togithub.com/google/truth/compare/v1.4.3...v1.4.4) - Annotated the rest of the main package for nullness, and moved the `@NullMarked` annotation from individual classes up to the package to avoid [a warning under `--release 8`](https://togithub.com/google/truth/issues/1320). ([`e107aea`](https://togithub.com/google/truth/commit/e107aeadc)) - Improved the failure message for `matches` to conditionally suggest using `containsMatch`. ([`7e9fc7a`](https://togithub.com/google/truth/commit/7e9fc7aec)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View the [repository job log](https://developer.mend.io/github/googleapis/java-bigtable). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MjUuMSIsInVwZGF0ZWRJblZlciI6IjM3LjQzOC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
This fixes a critical bug in CloudStorageReadChannel in which the channel position
(a long) was getting down-cast to int in CloudStorageReadChannel.innerOpen(). This
could cause the channel position to become negative or a wildly incorrect positive
value if the channel position was greater than MAX_INT.
In practice, this bug would only manifest itself if the channel was constructed with
a non-zero initial position, or if the channel was reopened in response to an error.
Included a test case that fails without the fix, and passes with the fix.