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

[Ruby] Fix memory leak in grpc_rb_call_run_batch #33368

Merged
merged 1 commit into from Jun 9, 2023

Conversation

peterzhu2118
Copy link
Contributor

The function grpc_rb_call_run_batch has many places that could raise errors, including in child functions. Since a raised error will longjump out of the function, it will cause memory leaks since the function cannot perform any clean up. This commit fixes the issue by wrapping the whole function in an rb_ensure, which will ensure that a cleanup function is ran before the error is propagated upwards.

@apolcyn apolcyn added the release notes: yes Indicates if PR needs to be in release notes label Jun 7, 2023
@apolcyn apolcyn self-assigned this Jun 9, 2023
The function grpc_rb_call_run_batch has many places that could raise
errors, including in child functions. Since a raised error will longjump
out of the function, it will cause memory leaks since the function
cannot perform any clean up. This commit fixes the issue by wrapping
the whole function in an rb_ensure, which will ensure that a cleanup
function is ran before the error is propagated upwards.
@apolcyn
Copy link
Contributor

apolcyn commented Jun 9, 2023

@peterzhu2118 FYI there is no need to force push - all commits will be squashed down at the time of merging.

@apolcyn apolcyn merged commit a4ab4d0 into grpc:master Jun 9, 2023
61 of 62 checks passed
@copybara-service copybara-service bot added the imported Specifies if the PR has been imported to the internal repository label Jun 9, 2023
mario-vimal pushed a commit to mario-vimal/grpc that referenced this pull request Jun 15, 2023
The function grpc_rb_call_run_batch has many places that could raise
errors, including in child functions. Since a raised error will longjump
out of the function, it will cause memory leaks since the function
cannot perform any clean up. This commit fixes the issue by wrapping the
whole function in an rb_ensure, which will ensure that a cleanup
function is ran before the error is propagated upwards.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
imported Specifies if the PR has been imported to the internal repository lang/ruby release notes: yes Indicates if PR needs to be in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants