Add logic to work around buggy Android NDKs#13173
Conversation
Old version of the Android NDK have linker issues with thread local support android/ndk#8 and isn't actually fixed until r12b https://developer.android.com/ndk/downloads/revision_history.html. ABSL's config.h is being updated to catch this case and having gRPC rely on that will make sure it also gets the fix (rather than repeating a somewhat lengthy macro). Since gRPC already has a dependency on ABSL, I figured this wouldn't be an issue.
|
Thank you for your pull request. Before we can look at your contribution, we need to ensure all contributors are covered by a Contributor License Agreement. After the following items are addressed, please respond with a new comment here, and the automated system will re-verify.
Regards, |
|
signed linuxfoundation CLA |
Use pthreads on posix instead of relying on thread local support
src/core/lib/support/cpu_posix.cc
Outdated
| unsigned int *thread_id = | ||
| static_cast<unsigned int *>(pthread_getspecific(thread_id_key)); | ||
| if (thread_id == nullptr) { | ||
| thread_id = new unsigned int(thread_counter++); |
There was a problem hiding this comment.
Sorry, we can't use new and delete into the core: https://github.com/grpc/grpc/blob/master/doc/core/moving-to-c%2B%2B.md
Please change to using gpr_malloc and gpr_free instead.
|
Updated with comments from @nicolasnoble |
|
|
|
Copy over Absl macro to deal with C++/C differences.
|
Changed to fix C++ vs C issues. |
|
|
|
Updated to not depend on c++ runtime |
|
|
|
|
|
|
|
I'm not sure if https://sponge.corp.google.com/target?id=69000522-fcae-4512-b985-703153bcaca0&target=github/grpc/c_macos_opt_native&searchFor=&show=FAILED&sortBy=STATUS isn't a new failure, potentially caused by this... |
|
That failure doesn't seem to go through the callpaths in this CL (or rely on having too many pthread_key's created). I'm looking into the best way to run this test on my end |
|
Got this test working locally and it does seem to related to this change. Debugging now. |
Don't delete the key in the pthread_key_create destructor. The key isn't specific to instances of values.
|
Ok, Fix should be uploaded now. I'm hoping this is the last fix needed |
|
|
|
|
All of the test failures are now known flakes, merging. |
Old version of the Android NDK have linker issues with thread local support android/ndk#8 and isn't actually fixed until r12b https://developer.android.com/ndk/downloads/revision_history.html. ABSL's config.h is being updated to catch this case and having gRPC rely on that will make sure it also gets the fix (rather than repeating a somewhat lengthy macro).
Since gRPC already has a dependency on ABSL, I figured this wouldn't be an issue.