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

TransactionRunner can get stuck if the first statement is a query and ResultSet#next() is never called #641

Closed
olavloite opened this issue Nov 17, 2020 · 0 comments · Fixed by #643
Assignees
Labels
api: spanner Issues related to the googleapis/java-spanner API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@olavloite
Copy link
Collaborator

The following transaction will wait indefinitely because the first query of the transaction will never actually be executed. All subsequent statements will however wait for a transaction id to be returned by this query.

DatabaseClient client =
        spanner.getDatabaseClient(DatabaseId.of("p", "i", "d"));
client.readWriteTransaction().run(new TransactionCallable<Void>() {
      @Override
      public Void run(TransactionContext transaction) throws Exception {
        transaction.executeQuery("SELECT 1");
        // Any RPC on the transaction after this will hang, including the Commit call that will
        // be executed when this method returns. So this transaction will never finish.
        return null;
      }
});
@olavloite olavloite added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. labels Nov 17, 2020
@olavloite olavloite self-assigned this Nov 17, 2020
@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/java-spanner API. label Nov 17, 2020
olavloite added a commit that referenced this issue Nov 17, 2020
If the first statement of a read/write transaction was a query or a read operation,
and the application would not call ResultSet#next() on the return result, the transaction
would hang indefinetely as the query would be marked as the one that should initiate the
transaction (inline the BeginTransaction option). The query would however never be
executed, as the actual query execution is deferred until the first call to ResultSet#next().

Fixes #641
thiagotnunes pushed a commit that referenced this issue Nov 18, 2020
…643)

If the first statement of a read/write transaction was a query or a read operation,
and the application would not call ResultSet#next() on the return result, the transaction
would hang indefinetely as the query would be marked as the one that should initiate the
transaction (inline the BeginTransaction option). The query would however never be
executed, as the actual query execution is deferred until the first call to ResultSet#next().

Fixes #641
ansh0l pushed a commit to ansh0l/java-spanner that referenced this issue Nov 10, 2022
This is an auto-generated regeneration of the .pb.go files by
cloud.google.com/go/internal/gapicgen. Once this PR is submitted, genbot will
update the corresponding PR to depend on the newer version of go-genproto, and
assign reviewers. Whilst this or any regen PR is open in go-genproto, genbot
will not create any more regeneration PRs. If all regen PRs are closed,
gapicgen will create a new set of regeneration PRs once per night.

If you have been assigned to review this PR, please:

- Ensure that CI is passing. If it's failing, it requires your manual attention.
- Approve and submit this PR if you believe it's ready to ship. That will prompt
genbot to assign reviewers to the google-cloud-go PR.

Corresponding google-cloud-go PR: googleapis/google-cloud-go#4475

Changes:

build(resourcesettings): correct package name for npm
  PiperOrigin-RevId: 385997388
  Source-Link: googleapis/googleapis@70e4a5b

chore: regenerate API index

  Source-Link: googleapis/googleapis@75e9812

feat: Adds BigQuery output table field to batch prediction job output config feat: Adds Feature Store features feat: Adds CustomJob.web_access_uris, CustomJob.enable_web_access fields feat: Adds Endpoint.network, Endpoint.private_endpoints fields and PrivateEndpoints message feat: Adds Execution.State constants: CACHED and CANCELLED feat: Adds IndexEndpoint.private_ip_ranges field feat: Adds IndexEndpointService.deployed_index_id field feat: Adds MetadataService.DeleteArtifact and DeleteExecution methods feat: Adds ModelMonitoringObjectConfig.explanation_config field and ModelMonitoringObjectConfig.ExplanationConfig message feat: Adds ModelMonitoringObjectiveConfig.TrainingPredictionSkewDetectionConfig.attribution_score_skew_thresholds and ModelMonitoringObjectiveConfig.PredictionDriftDetectionConfig.attribution_score_drift_threshold fields feat: Adds fields to Study message
  PiperOrigin-RevId: 385903722
  Source-Link: googleapis/googleapis@4e836c7

fix(nodejs): add dependencies for Node.js package
  PiperOrigin-RevId: 385879584
  Source-Link: googleapis/googleapis@9a0b354

build(nodejs): correct npm artifact name
  PiperOrigin-RevId: 385879379
  Source-Link: googleapis/googleapis@8fdcaf8

chore: regenerate API index

  Source-Link: googleapis/googleapis@4afa0ce

feat: added a new API method FindMostStableBuild
  1. The new API method FindMostStableBuild will find the most stable build for a given build target.
  2. Add a new field rw_firmware_version to the existing Build proto object.

  PiperOrigin-RevId: 385862822
  Source-Link: googleapis/googleapis@63bd33f

build(lifesciences): fix naming for package name
  PiperOrigin-RevId: 385853197
  Source-Link: googleapis/googleapis@43fda80

build(gkeconnect/gateway): correct package name for npm
  PiperOrigin-RevId: 385822138
  Source-Link: googleapis/googleapis@efecdbf

chore: regenerate API index

  Source-Link: googleapis/googleapis@0078ca6

feat!(aiplatform): Removes breaking change from v1 version of AI Platform protos
  PiperOrigin-RevId: 385812643
  Source-Link: googleapis/googleapis@22e280d

chore: Update orchestration/airflow v1 BUILD.bazel for python
  PiperOrigin-RevId: 385809039
  Source-Link: googleapis/googleapis@3585f50

chore(networkmanagement): Fill out Ruby generator options for datafusion, filestore, and networkmanagement
  PiperOrigin-RevId: 385796337
  Source-Link: googleapis/googleapis@90f4259

chore: regenerate API index

  Source-Link: googleapis/googleapis@194c144

feat(osconfig/agentendpoint): OSConfig AgentEndpoint: add basic os info to RegisterAgentRequest, add WindowsApplication type to Inventory
  Committer: @adjackura
  PiperOrigin-RevId: 385699419
  Source-Link: googleapis/googleapis@17a7a0b

chore: regenerate API index

  Source-Link: googleapis/googleapis@ee8c183

docs: remove obsolete content
  Committer: @wora
  PiperOrigin-RevId: 385286731
  Source-Link: googleapis/googleapis@de11e31

chore: use gapic-generator-typescript v2.1.0
  Committer: @alexander-fenster
  PiperOrigin-RevId: 385246182
  Source-Link: googleapis/googleapis@d767d0a

chore: regenerate API index

  Source-Link: googleapis/googleapis@f7a2eba

feat: add standard sql table type, update scalar type enums
  Committer: @shollyman
  PiperOrigin-RevId: 385164907
  Source-Link: googleapis/googleapis@9ae82b8

fix(kms): Updating WORKSPACE files to use the newest version of the Typescript generator.
  Also removing the explicit generator tag for the IAMPolicy mixin for the kms and pubsub APIS as the generator will now read it from the .yaml file.

  PiperOrigin-RevId: 385101839
  Source-Link: googleapis/googleapis@80f4042
rajatbhatta pushed a commit to rajatbhatta/java-spanner that referenced this issue Nov 17, 2022
…cies to v2.4.0 (googleapis#641)

[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.cloud:google-cloud-shared-dependencies](https://togithub.com/googleapis/java-shared-dependencies) | `2.3.0` -> `2.4.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/2.4.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/2.4.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/2.4.0/compatibility-slim/2.3.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/2.4.0/confidence-slim/2.3.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>googleapis/java-shared-dependencies</summary>

### [`v2.4.0`](https://togithub.com/googleapis/java-shared-dependencies/blob/master/CHANGELOG.md#&#8203;240-httpswwwgithubcomgoogleapisjava-shared-dependenciescompare230v240-2021-10-18)

[Compare Source](https://togithub.com/googleapis/java-shared-dependencies/compare/v2.3.0...v2.4.0)

##### Dependencies

-   update dependency com.fasterxml.jackson:jackson-bom to v2.13.0 ([dba11b5](https://www.github.com/googleapis/java-shared-dependencies/commit/dba11b5fe14d39cdd62357e7bb1b82831c481150))
-   update dependency com.google.api-client:google-api-client-bom to v1.32.2 ([dba11b5](https://www.github.com/googleapis/java-shared-dependencies/commit/dba11b5fe14d39cdd62357e7bb1b82831c481150))
-   update dependency com.google.api:api-common to v2.0.5 ([dba11b5](https://www.github.com/googleapis/java-shared-dependencies/commit/dba11b5fe14d39cdd62357e7bb1b82831c481150))
-   update dependency com.google.auth:google-auth-library-bom to v1.2.1 ([dba11b5](https://www.github.com/googleapis/java-shared-dependencies/commit/dba11b5fe14d39cdd62357e7bb1b82831c481150))
-   update dependency com.google.guava:guava-bom to v31 ([#&#8203;498](https://www.togithub.com/googleapis/java-shared-dependencies/issues/498)) ([dba11b5](https://www.github.com/googleapis/java-shared-dependencies/commit/dba11b5fe14d39cdd62357e7bb1b82831c481150))
-   update dependency com.google.http-client:google-http-client-bom to v1.40.1 ([dba11b5](https://www.github.com/googleapis/java-shared-dependencies/commit/dba11b5fe14d39cdd62357e7bb1b82831c481150))
-   update dependency com.google.protobuf:protobuf-bom to v3.18.1 ([#&#8203;494](https://www.togithub.com/googleapis/java-shared-dependencies/issues/494)) ([a30e376](https://www.github.com/googleapis/java-shared-dependencies/commit/a30e3762b5fb0e2d31304d211c12eb2c1320f0c1))
-   update dependency io.grpc:grpc-bom to v1.41.0 ([#&#8203;482](https://www.togithub.com/googleapis/java-shared-dependencies/issues/482)) ([8a7d227](https://www.github.com/googleapis/java-shared-dependencies/commit/8a7d227f2a1dab9ff23d247a4e6131c817804c36))
-   update gax.version to v2.6.1 ([dba11b5](https://www.github.com/googleapis/java-shared-dependencies/commit/dba11b5fe14d39cdd62357e7bb1b82831c481150))
-   update iam.version to v1.1.6 ([#&#8203;485](https://www.togithub.com/googleapis/java-shared-dependencies/issues/485)) ([cef7e09](https://www.github.com/googleapis/java-shared-dependencies/commit/cef7e090bbc2e3ae775fa83505f98df286ba7d42))

</details>

---

### Configuration

📅 **Schedule**: 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 this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-spanner-jdbc).
rajatbhatta pushed a commit to rajatbhatta/java-spanner that referenced this issue Nov 17, 2022
🤖 I have created a release \*beep\* \*boop\*
---
## [2.5.0](https://www.github.com/googleapis/java-spanner-jdbc/compare/v2.4.5...v2.5.0) (2021-10-25)


### Features

* support VIEW in metadata queries ([googleapis#633](https://www.github.com/googleapis/java-spanner-jdbc/issues/633)) ([b929191](https://www.github.com/googleapis/java-spanner-jdbc/commit/b929191a7b6699f9daf9a7c06097e9794c79ff8d)), closes [googleapis#632](https://www.github.com/googleapis/java-spanner-jdbc/issues/632)


### Bug Fixes

* **java:** java 17 dependency arguments ([googleapis#1266](https://www.github.com/googleapis/java-spanner-jdbc/issues/1266)) ([googleapis#645](https://www.github.com/googleapis/java-spanner-jdbc/issues/645)) ([0474502](https://www.github.com/googleapis/java-spanner-jdbc/commit/0474502936ff1a43244fcb830fecfc5f42895899))


### Dependencies

* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.4.0 ([googleapis#641](https://www.github.com/googleapis/java-spanner-jdbc/issues/641)) ([ab26010](https://www.github.com/googleapis/java-spanner-jdbc/commit/ab26010ba107d4ba9591d661743ad542ae3b227f))
* update dependency com.google.cloud:google-cloud-spanner-bom to v6.13.0 ([googleapis#637](https://www.github.com/googleapis/java-spanner-jdbc/issues/637)) ([d981c8c](https://www.github.com/googleapis/java-spanner-jdbc/commit/d981c8c744829aa039b16df0b150caf49a99f1cc))
* update dependency com.google.cloud:google-cloud-spanner-bom to v6.14.0 ([googleapis#647](https://www.github.com/googleapis/java-spanner-jdbc/issues/647)) ([3cda837](https://www.github.com/googleapis/java-spanner-jdbc/commit/3cda83737c25c8878d19bee1727de84e086065b6))
* upgrade Mockito to support Java17 ([googleapis#635](https://www.github.com/googleapis/java-spanner-jdbc/issues/635)) ([d78792f](https://www.github.com/googleapis/java-spanner-jdbc/commit/d78792f7acdd2fdac8a655fba06789ba50457679))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
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. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant