Skip to content

[ruby] fix crash when prefork/postfork is used without previously using grpc#33788

Merged
apolcyn merged 2 commits intogrpc:masterfrom
apolcyn:fix_fork_bug
Jul 20, 2023
Merged

[ruby] fix crash when prefork/postfork is used without previously using grpc#33788
apolcyn merged 2 commits intogrpc:masterfrom
apolcyn:fix_fork_bug

Conversation

@apolcyn
Copy link
Copy Markdown
Contributor

@apolcyn apolcyn commented Jul 20, 2023

Should fix #33787

@apolcyn apolcyn added the release notes: no Indicates if PR should not be in release notes label Jul 20, 2023
// sure basic one-time initialization is taken care of. Note that if this is
// the case, then grpc_init() will start up c-core threads; that's OK since
// they will be shut down in C-core's pthread_atfork handler.
gpr_once_init(&g_once_init, grpc_ruby_basic_init);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I had a different solution that didn't involve initializing the threads: Shopify@6277075

But I guess this is OK.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Your fix also looks OK, but I'll favor the fix here for simplicity - I want to minimize the fork related state we track for maintainability.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No problem.

casperisfine pushed a commit to Shopify/grpc that referenced this pull request Jul 20, 2023
@apolcyn apolcyn merged commit d4cbb7a into grpc:master Jul 20, 2023
@copybara-service copybara-service bot added the imported Specifies if the PR has been imported to the internal repository label Jul 20, 2023
mario-vimal pushed a commit to mario-vimal/grpc that referenced this pull request Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bloat/none imported Specifies if the PR has been imported to the internal repository lang/ruby per-call-memory/neutral per-channel-memory/neutral release notes: no Indicates if PR should not be in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Ruby] v1.57.0-alpha SEGV when calling GRPC.postfork_child

4 participants