GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(bigquerystorage): resume reader connection on `EOS` internal error by tswast · Pull Request #9994 · googleapis/google-cloud-python

Conversation

@tswast

@tswast tswast commented Dec 18, 2019

Copy link
Copy Markdown
Contributor

It's infeasible for the backend to change the status of EOS on DATA
internal errors, so instead we check the error message to see if it's
an error that is resumable. We don't want to try to resume on all
internal errors, so inspecting the message is the best we can do.

This fixes the same error as https://issuetracker.google.com/143292803 but for Python.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@tswast
tswast requested a review from a team December 18, 2019 15:48
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Dec 18, 2019
@tswast
tswast requested a review from shollyman December 18, 2019 15:48
kmjung
kmjung reviewed Dec 18, 2019
View reviewed changes
Comment thread bigquery_storage/google/cloud/bigquery_storage_v1beta1/reader.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@tswast tswast added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Dec 18, 2019
@tswast

tswast commented Jan 3, 2020

Copy link
Copy Markdown
Contributor Author

Closing this PR per "Custom retry logic in GAPIC-generated clients" email thread.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tswast tswast closed this Jan 3, 2020
@tswast
tswast deleted the b143292803-eos-bqstorage branch January 3, 2020 15:59
@tswast
tswast restored the b143292803-eos-bqstorage branch January 8, 2020 19:21
@tswast

tswast commented Jan 8, 2020

Copy link
Copy Markdown
Contributor Author

We were able to reproduce this error in Python with the long-running integration tests. It surfaces as:

E                   grpc._channel._MultiThreadedRendezvous: <_MultiThreadedRendezvous of RPC that terminated with:
E                   	status = StatusCode.INTERNAL
E                   	details = "Received RST_STREAM with error code 2"
E                   	debug_error_string = "{"created":"@1578389183.706753048","description":"Error received from peer ipv4:172.217.219.95:443","file":"src/core/lib/surface/call.cc","file_line":1056,"grpc_message":"Received RST_STREAM with error code 2","grpc_status":13}"
E                   >

It appears to match the related Java code:

https://github.com/grpc/grpc/blob/9dd05c4abc1741223ded8566bc143c927d9cba79/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc#L110

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tswast tswast reopened this Jan 8, 2020
kmjung
kmjung reviewed Jan 8, 2020
View reviewed changes
Comment thread bigquery_storage/google/cloud/bigquery_storage_v1beta1/reader.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread bigquery_storage/tests/unit/test_reader.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

tswast added 2 commits January 8, 2020 14:45
@tswast
fix(bigquerystorage): resume reader connection on EOS internal error
72f84a1
It's infeasible for the backend to change the status of `EOS on DATA`
internal errors, so instead we check the error message to see if it's
an error that is resumable. We don't want to try to resume on *all*
internal errors, so inspecting the message is the best we can do.
@tswast
fix: update resumable errors to match string from test failure
50ecc98
@tswast
tswast force-pushed the b143292803-eos-bqstorage branch from d893035 to 50ecc98 Compare January 8, 2020 20:53
@tswast tswast removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jan 8, 2020
@tswast
tswast requested a review from plamut January 13, 2020 16:21
plamut
plamut suggested changes Jan 15, 2020
View reviewed changes

@plamut plamut left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have one minor refactoring suggestion, otherwise it generally LGTM. We still need to resolve a merge conflict, though.

BTW, what is the best way of reproducing this locally? Is it even feasible?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread bigquery_storage/google/cloud/bigquery_storage_v1beta1/reader.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread bigquery_storage/google/cloud/bigquery_storage_v1beta1/reader.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

tswast added 2 commits January 15, 2020 15:47
@tswast
Merge remote-tracking branch 'upstream/master' into b143292803-eos-bq…
1a4b881
…storage
@tswast
refactor: use more readable any instead of loop
642f714
@tswast
tswast requested a review from plamut January 15, 2020 21:59
@tswast

tswast commented Jan 15, 2020

Copy link
Copy Markdown
Contributor Author

I haven't figured out a way to reproduce it locally, at least not without a lot of time and network bandwidth. We get the error pretty consistently with the following sample code in our internal nightly CI:

# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import concurrent.futures

from google.cloud import bigquery_storage_v1beta1
import pytest


@pytest.mark.parametrize(
    "format_",
    (
        bigquery_storage_v1beta1.enums.DataFormat.AVRO,
        bigquery_storage_v1beta1.enums.DataFormat.ARROW,
    ),
)
def test_long_running_read(bqstorage_client, project_id, format_):
    table_ref = bigquery_storage_v1beta1.types.TableReference()
    table_ref.project_id = "bigquery-public-data"
    table_ref.dataset_id = "samples"
    table_ref.table_id = "wikipedia"

    session = bqstorage_client.create_read_session(
        table_ref,
        "projects/{}".format(project_id),
        requested_streams=5,
        format_=format_
    )
    assert len(session.streams) == 5

    def count_rows(stream):
        read_position = bigquery_storage_v1beta1.types.StreamPosition(
            stream=stream
        )
        reader = bqstorage_client.read_rows(read_position)
        row_count = 0
        for page in reader.rows(session).pages:
            row_count += page.num_items
        return row_count

    with concurrent.futures.ThreadPoolExecutor() as pool:
        row_count = sum(pool.map(count_rows, session.streams))

    assert row_count == 313797035
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@plamut

plamut commented Jan 15, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

OK good, I'll try to reproduce it locally tomorrow, but if it doesn't work, I'll approve and rely on the next nightly run (the code itself LGTM now).

Edit: Since the test takes 90 minute on a GCE instance, and the error is only reproduced roughly half of the time, it would be inefficient to testing the fix in action locally (would require multiple runs). Since the fix is not going to production immediately, we can still revert it should the nightly runs reveal that the issue still persists.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

plamut
plamut approved these changes Jan 15, 2020
View reviewed changes

@plamut plamut left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving under the assumption that the fix is not being shipped to production immediately, and that we can revert it in case the error occurs again in one of the nightly runs.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@tswast
tswast merged commit b492bdc into googleapis:master Jan 15, 2020
@tswast
tswast deleted the b143292803-eos-bqstorage branch January 15, 2020 22:27
This was referenced Jan 29, 2020
chore(asset): bump copyright year to 2020, tweak docstring formatting (via synth) #10223
Merged
chore(automl): bump copyright year to 2020, tweak docstring formatting (via synth) #10224
Merged
chore(bigquery): bump copyright year to 2020, tweak docstring formatting (via synth) #10225
Merged
chore(billingbudgets): bump copyright year to 2020, tweak docstring formatting (via synth) #10227
Merged
This was referenced Jan 29, 2020
docs(datalabeling): update docstrings; bump copyright year to 2020 (via synth) #10229
Merged
feat(documentai): bump copyright year to 2020, tweak docstring formatting (via synth) #10230
Merged
fix(iam): bump copyright year to 2020 (via synth) #10231
Merged
chore(iot): bump copyright year to 2020 (via synth) #10232
Merged
fix(irm): change default retry and timeout config; bump copyright year to 2020 (via synth) #10233
Merged
docs(language): change docstring formatting; bump copyright year to 2020 (via synth) #10234
Merged
chore(phishingprotection): bump copyright year to 2020 (via synth) #10235
Merged
chore(redis): bump copyright year to 2020, tweak docstring formatting (via synth) #10237
Merged
chore(speech): bump copyright year to 2020, tweak docstring formatting (via synth) #10238
Merged
fix(talent): change default timeout values; edit docstrings; bump copyright year to 2020 (via synth) #10239
Merged
chore(texttospeech): bump copyright year to 2020, tweak docstring formatting (via synth) #10240
Merged
chore(trace): bump copyright year to 2020, tweak docstring formatting (via synth) #10241
Merged
chore(vision): bump copyright year to 2020, tweak docstring formatting (via synth) #10242
Merged
chore(websecurityscanner): bump copyright year to 2020, tweak docstring formatting (via synth) #10243
Merged
[CHANGE ME] Re-generated container to pick up changes in the API or client library generator. #10256
Closed
[CHANGE ME] Re-generated datastore to pick up changes in the API or client library generator. #10261
Closed
@stephaniewang526 stephaniewang526 mentioned this pull request Feb 25, 2020
[bigquerystorage, Java] Reconnect on "EOS on DATA frame" Internal Server Errors googleapis/java-bigquerystorage#86
Closed
@larkee larkee mentioned this pull request Aug 4, 2020
fix: resume iterator on EOS internal error googleapis/python-spanner#122
Merged
parthea pushed a commit that referenced this pull request Aug 21, 2025
@tswast
fix(bigquerystorage): resume reader connection on EOS internal error (
6aa83cb
#9994)

* fix(bigquerystorage): resume reader connection on `EOS` internal error

It's infeasible for the backend to change the status of `EOS on DATA`
internal errors, so instead we check the error message to see if it's
an error that is resumable. We don't want to try to resume on *all*
internal errors, so inspecting the message is the best we can do.

* fix: update resumable errors to match string from test failure

* refactor: use more readable any instead of loop
parthea pushed a commit that referenced this pull request Sep 16, 2025
@tswast @parthea
fix(bigquerystorage): resume reader connection on EOS internal error (
e626911
#9994)

* fix(bigquerystorage): resume reader connection on `EOS` internal error

It's infeasible for the backend to change the status of `EOS on DATA`
internal errors, so instead we check the error message to see if it's
an error that is resumable. We don't want to try to resume on *all*
internal errors, so inspecting the message is the best we can do.

* fix: update resumable errors to match string from test failure

* refactor: use more readable any instead of loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@shollyman shollyman Awaiting requested review from shollyman
2 more reviewers
@kmjung kmjung kmjung left review comments
@plamut plamut plamut approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@tswast @plamut @kmjung @googlebot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.