Don't count internal ApplicationCallbackExecCtx against ExcCtx count#17973
Merged
ericgribkoff merged 2 commits intogrpc:masterfrom Feb 9, 2019
Merged
Don't count internal ApplicationCallbackExecCtx against ExcCtx count#17973ericgribkoff merged 2 commits intogrpc:masterfrom
ericgribkoff merged 2 commits intogrpc:masterfrom
Conversation
This was originally done for ExcCtx in grpc#15825. This avoids a hang in our pre-fork handler, where grpc_core::Executor::RunClosures attempts to increment the thread count from an invocation of grpc_prefork():
vjpai
reviewed
Feb 8, 2019
src/core/lib/iomgr/exec_ctx.h
Outdated
| static void GlobalShutdown(void) { gpr_tls_destroy(&callback_exec_ctx_); } | ||
|
|
||
| private: | ||
| uintptr_t flags_; |
Contributor
There was a problem hiding this comment.
flags_{0} will solve your MSAN issues
vjpai
approved these changes
Feb 9, 2019
Contributor
Author
|
Thanks @vjpai! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This was originally done for ExcCtx in
#15825. This avoids a hang in our
pre-fork handler, where grpc_core::Executor::RunClosures attempts to
increment the thread count from an invocation of grpc_prefork().
The stack trace of the hang without this change:
At least one other option besides the
GRPC_APP_CALLBACK_EXEC_CTX_FLAG_IS_INTERNAL_THREADflag introduced here is to look at the existing excctx and inherit whether to increment/decrement the thread count based on its setting. But it's not clear to me that an ApplicationCallbackExecCtx will always be created with an associated ExecCtx - in which case the increment/decrement calls may be suitable to delete altogether.As for why this wasn't caught by our test infrastructure: this was an oversight on my part, and I'm reviving #16513 to make sure we have test coverage for this in the future.