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_server_request_call #33371

Merged
merged 2 commits into from
Jun 9, 2023

Conversation

peterzhu2118
Copy link
Contributor

The function grpc_rb_server_request_call 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 self-assigned this Jun 9, 2023
@apolcyn apolcyn added kokoro:force-run release notes: yes Indicates if PR needs to be in release notes labels Jun 9, 2023
@peterzhu2118 peterzhu2118 force-pushed the pz-server-request-call-mem-leak branch from 1e47665 to 6c87492 Compare June 9, 2023 17:12
The function grpc_rb_server_request_call 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.
@veblush veblush self-requested a review June 9, 2023 21:28
@apolcyn apolcyn merged commit 4fd6dc2 into grpc:master Jun 9, 2023
59 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_server_request_call 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

5 participants