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

chore: make state field volatile in AsyncResultSetImpl #3550

Merged
merged 6 commits into from
Dec 13, 2024

Conversation

olavloite
Copy link
Collaborator

@olavloite olavloite commented Dec 13, 2024

Mark the state field in AsyncResultSetImpl volatile, as it is inspected by different threads. Also make sure the state is only updated while in a synchronized (monitor) block.

Fixes #3484
Fixes #3481
Fixes #3479

Mark the `state` field in `AsyncResultSetImpl` volatile, as it is
inspected by different threads.
@olavloite olavloite requested a review from a team as a code owner December 13, 2024 15:28
@product-auto-label product-auto-label bot added size: xs Pull request size is extra small. api: spanner Issues related to the googleapis/java-spanner API. labels Dec 13, 2024
@product-auto-label product-auto-label bot added size: s Pull request size is small. and removed size: xs Pull request size is extra small. labels Dec 13, 2024
@olavloite
Copy link
Collaborator Author

The failure in integration-tests-against-emulator / units is unrelated to this change, and will be fixed by #3551

@rahul2393 rahul2393 merged commit 432fc4e into main Dec 13, 2024
33 of 34 checks passed
@rahul2393 rahul2393 deleted the make-async-resultset-state-volatile branch December 13, 2024 20:32
surbhigarg92 pushed a commit to surbhigarg92/java-spanner that referenced this pull request Dec 26, 2024
* chore: make state field volatile in AsyncResultSetImpl

Mark the `state` field in `AsyncResultSetImpl` volatile, as it is
inspected by different threads.

* fix: protect writes with monitor

---------

Co-authored-by: rahul2393 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/java-spanner API. size: s Pull request size is small.
Projects
None yet
2 participants