-
Notifications
You must be signed in to change notification settings - Fork 48
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
Conversation
if soft_limit < hard_limit or hard_limit == resource.RLIM_INFINITY: | ||
try: | ||
resource.setrlimit(resource.RLIMIT_STACK, (hard_limit, hard_limit)) | ||
except Exception: |
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.
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
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.
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.
#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> 🦕
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:
Fixes #<issue_number_goes_here> 🦕