Skip to content

fix: Respect hard stack size limit and swallow limit change exception. #558

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

Merged
merged 2 commits into from
Apr 1, 2024

Conversation

TrevorBergeron
Copy link
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕

@TrevorBergeron TrevorBergeron requested review from a team as code owners April 1, 2024 19:52
@TrevorBergeron TrevorBergeron requested a review from GarrettWu April 1, 2024 19:52
@product-auto-label product-auto-label bot added size: s Pull request size is small. api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. labels Apr 1, 2024
if soft_limit < hard_limit or hard_limit == resource.RLIM_INFINITY:
try:
resource.setrlimit(resource.RLIMIT_STACK, (hard_limit, hard_limit))
except Exception:
Copy link
Contributor

Choose a reason for hiding this comment

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

Any particular reason we want to pass all the exceptions? Generally we should never suppress all exceptions. https://g3doc.corp.google.com/eng/doc/devguide/py/style/index.md?cl=head#s2.4-exceptions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Increasing stack limits isn't a hard requirement for bigframes to work. It merely reduces the likelihood of overflowing stack memory for deeply nested trees algorithms later on. From looking at other codebases that change resource limits, it can be rather error-prone due to each platform's inconsistency/limits/bugs and its hard to guarantee that the operation will succeed, so wanted to play it safe.

@TrevorBergeron TrevorBergeron added the automerge Merge the pull request once unit tests and other checks pass. label Apr 1, 2024
@gcf-merge-on-green gcf-merge-on-green bot merged commit 4833908 into main Apr 1, 2024
15 of 16 checks passed
@gcf-merge-on-green gcf-merge-on-green bot deleted the rlimit_fix branch April 1, 2024 23:02
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Apr 1, 2024
Genesis929 pushed a commit that referenced this pull request Apr 9, 2024
#558)

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
- [ ] Make sure to open an issue as a [bug/issue](https://togithub.com/googleapis/python-bigquery-dataframes/issues/new/choose) before writing your code!  That way we can discuss the change, evaluate designs, and agree on the general idea
- [ ] Ensure the tests and linter pass
- [ ] Code coverage does not decrease (if any source code was changed)
- [ ] Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕
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-dataframes API. size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants