Skip to content

Conversation

@msuozzo
Copy link
Contributor

@msuozzo msuozzo commented Jan 6, 2022

In some python deployments (I believe macOS is one), weakref objects aren't guaranteed to exist across gc collections. The proposed check pattern is also used in tensorflow (link) which ran into similar issues a few years ago.

@msuozzo msuozzo requested a review from a team January 6, 2022 01:27
@msuozzo msuozzo requested a review from a team as a code owner January 6, 2022 01:27
@msuozzo msuozzo requested a review from shollyman January 6, 2022 01:27
@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/python-bigquery API. label Jan 6, 2022
@msuozzo msuozzo changed the title Make gc check resilient to broken weakrefs fix: Make gc check resilient to broken weakrefs Jan 6, 2022
@msuozzo msuozzo changed the title fix: Make gc check resilient to broken weakrefs Make gc check resilient to broken weakrefs Jan 6, 2022
In some python deployments (I believe macOS is one), weakref objects aren't guaranteed to exist across gc collections. The proposed check pattern is also used in tensorflow [0] which ran into similar issues a few years ago.

[0]: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/framework/errors_test.py#L33
Copy link
Contributor

@tswast tswast left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! I hadn't noticed any flakes when running the test suite locally on my Mac, but could just be a rare thing.

@msuozzo
Copy link
Contributor Author

msuozzo commented Jan 7, 2022

Any idea what the conventional commit error is?

@plamut
Copy link
Contributor

plamut commented Jan 10, 2022

Any idea what the conventional commit error is?

This is the output, accessible by clicking the "Details" link next to the failed check (is it displayed for you?):

Linting errors for "make gc check resilient to broken weakrefs"
    - subject may not be empty
    - type may not be empty

BTW, I changed the title of the PR to fix that (as an alternative to amending the commit message itself), added the most sensible prefix (test:).

@plamut plamut changed the title Make gc check resilient to broken weakrefs test: make GC check resilient to broken weakrefs Jan 10, 2022
Copy link
Contributor

@plamut plamut left a comment

Choose a reason for hiding this comment

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

LGTM, just have a clarification question, thanks!

Edit: Please just fix the indentation (4 spaces should be used) to conform to this project's style guide, which is why one of the checks failed:

nox > flake8 tests
tests/unit/test_dbapi_connection.py:224:11: E111 indentation is not a multiple of 4
tests/unit/test_dbapi_connection.py:226:15: E111 indentation is not a multiple of 4
tests/unit/test_dbapi_connection.py:227:11: E111 indentation is not a multiple of 4
nox > Command flake8 tests failed with exit code 1
nox > Session lint failed.

@plamut plamut added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 10, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 10, 2022
@plamut
Copy link
Contributor

plamut commented Jan 17, 2022

@tswast I don't have write access anymore, please re-run the tests and merge the fix, thanks!

@tswast tswast added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 18, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 18, 2022
@tswast tswast merged commit f54d81f into googleapis:main Jan 18, 2022
abdelmegahedgoogle pushed a commit to abdelmegahedgoogle/python-bigquery that referenced this pull request Apr 17, 2023
* fix: Make gc check resilient to broken weakrefs

In some python deployments (I believe macOS is one), weakref objects aren't guaranteed to exist across gc collections. The proposed check pattern is also used in tensorflow [0] which ran into similar issues a few years ago.

[0]: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/framework/errors_test.py#L33

* fix: add pragma for coverage

* Fix whitespace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigquery Issues related to the googleapis/python-bigquery API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants