Skip to content

When building with bazel on a Mac, workaround bazelbuild/bazel#4341#13929

Merged
vjpai merged 1 commit intogrpc:masterfrom
vjpai:tls-bazel2
Jan 5, 2018
Merged

When building with bazel on a Mac, workaround bazelbuild/bazel#4341#13929
vjpai merged 1 commit intogrpc:masterfrom
vjpai:tls-bazel2

Conversation

@vjpai
Copy link
Copy Markdown
Contributor

@vjpai vjpai commented Jan 5, 2018

Fixes #13856.
This is an alternative and more-targeted workaround than the one in #13916 . This way is probably preferred since that way prevented inlining functions and hurt the performance of some microbenchmarks. This will have no effect on any versions except for Mac bazel builds.

@vjpai vjpai requested a review from nicolasnoble January 5, 2018 18:02
@grpc-testing
Copy link
Copy Markdown

****************************************************************

libgrpc.so

     VM SIZE        FILE SIZE
 ++++++++++++++  ++++++++++++++

  [ = ]       0        0  [ = ]


****************************************************************

libgrpc++.so

     VM SIZE        FILE SIZE
 ++++++++++++++  ++++++++++++++

  [ = ]       0        0  [ = ]



@grpc-testing
Copy link
Copy Markdown

[trickle] No significant performance differences

@grpc-testing
Copy link
Copy Markdown

[microbenchmarks] No significant performance differences

@vjpai
Copy link
Copy Markdown
Contributor Author

vjpai commented Jan 5, 2018

@nicolasnoble : I confirmed that this is used when grpc is used as an external bazel dependence.

@vjpai vjpai merged commit 0d3314b into grpc:master Jan 5, 2018
@vjpai vjpai deleted the tls-bazel2 branch January 5, 2018 20:29
@lock lock bot locked as resolved and limited conversation to collaborators Jan 21, 2019
@jtattermusch
Copy link
Copy Markdown
Contributor

@vjpai while trying to enable macOS bazel tests on our CI in #20510, I found out that this fixed the build, but makes some of our macos bazel test fail, because the pthread TLS variables need initialization and in our tests it's not always there.
A bunch of our macos bazel tests thus fail with

Executing tests from //test/core/backoff:backoff_test
-----------------------------------------------------------------------------
D1017 10:13:21.109471000 4373829056 test_config.cc:384]                test slowdown factor: sanitizer=1, fixture=1, poller=1, total=1
[==========] Running 4 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 4 tests from BackOffTest
[ RUN      ] BackOffTest.ConstantBackOff
E1017 10:13:21.110358000 4373829056 tls_pthread.cc:26]                 assertion failed: 0 == pthread_setspecific(tls->key, (void*)value)

is the right solution to add grpc_init() and grpc_shutdown() to our tests as needed so that the ExecCtx's thread local is initialized?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bazel build broken on MacOS because of thread-local exec_ctx

4 participants