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

BigQuery Storage Write API: LimitExceededBehavior of FlowControlSettings is ignored in JsonStreamWriter #1539

Closed
tkosse opened this issue Feb 14, 2022 · 2 comments · Fixed by #1642
Assignees
Labels
api: bigquerystorage Issues related to the googleapis/java-bigquerystorage API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@tkosse
Copy link

tkosse commented Feb 14, 2022

Environment details

Java version: 8 latest
Library version(s): 2.8.1

Steps to reproduce

  1. Create a new JsonStreamWriter with FlowControlSettings set
FlowControlSettings flowControlSettings = FlowControlSettings.newBuilder()
      .setLimitExceededBehavior(FlowController.LimitExceededBehavior.ThrowException)
      .build();
JsonStreamWriter writer = JsonStreamWriter.newBuilder(tableName, tableSchema)
      .setFlowControlSettings(flowControlSettings)
      .build();
  1. Simulate service unavailability. After reaching the inflight quota limit writer.append(jsonArr) blocks indefinitely.

Stack trace

io.vertx.core.VertxException: Thread blocked at sun.misc.Unsafe.park(Native Method) at
    java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215) at
    java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2163) at
    com.google.cloud.bigquery.storage.v1.StreamWriter.maybeWaitForInflightQuota(StreamWriter.java:322) at
    com.google.cloud.bigquery.storage.v1.StreamWriter.appendInternal(StreamWriter.java:310) at
    com.google.cloud.bigquery.storage.v1.StreamWriter.append(StreamWriter.java:272) at
    com.google.cloud.bigquery.storage.v1.JsonStreamWriter.append(JsonStreamWriter.java:147) at
    com.google.cloud.bigquery.storage.v1.JsonStreamWriter.append(JsonStreamWriter.java:99)
    ...

Any additional information below

During service problems like omg/48020 or other changes, that affect writing data to BigQuery we must avoid to indefinetly get blocked in our application. We can't afford that our application crashes or hangs because we are not able to ingest data to BigQuery. Instead we would rather have our application discarding those BigQuery events and trigger an alert. If the library would throw an exception instead of blocking, which this LimitExceededBehaviour seems to be intended for, this would be sufficient for us. So in this case WE could decide what to do when the limit is reached and not the library decides to block. This has real dramatic impact if this is permanently blocking due to a bug like omg/48020 and never recovers. To work around this with future bugs we implemented the same inflight quota counting on top and start discarding events before the the library internal quotas are reached. This is obviously not a good solution.

@product-auto-label product-auto-label bot added the api: bigquerystorage Issues related to the googleapis/java-bigquerystorage API. label Feb 14, 2022
@meredithslota meredithslota added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Feb 14, 2022
@stephaniewang526 stephaniewang526 added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Feb 14, 2022
@stephaniewang526 stephaniewang526 self-assigned this Feb 14, 2022
@stephaniewang526 stephaniewang526 removed the priority: p2 Moderately-important priority. Fix may not be included in next release. label Feb 14, 2022
@stephaniewang526 stephaniewang526 removed their assignment Apr 28, 2022
@tkosse
Copy link
Author

tkosse commented May 2, 2022

Hey, are there any plans when this will be implemented?
Are you open for a pull request regarding this feature? If yes, what other things need to be considered when implementing this feature besides the contribution guidelines?

@stephaniewang526
Copy link
Contributor

stephaniewang526 commented May 2, 2022

Hi, this is a nice-to-have feature which has not yet been prioritized. Definitely encourage community contribution. Please name your PR and initial commit something like feat: add support.... Also, make sure to include unit and integration tests in your PR to speed up the review process. We will then review it and provide feedback. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquerystorage Issues related to the googleapis/java-bigquerystorage API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants