[threading] Implement thready-tsan mode (#33193)

This test mode tries to create threads wherever it legally can to
maximize the chances of TSAN finding errors in our codebase.

<!--

If you know who should review your pull request, please assign it to
that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the
appropriate
lang label.

-->

---------

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
pull/33270/head
Craig Tiller 2 years ago committed by GitHub
parent d39a379232
commit 338c55978b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      CMakeLists.txt
  2. 2
      Makefile
  3. 10
      build_autogenerated.yaml
  4. 2
      config.m4
  5. 2
      config.w32
  6. 2
      gRPC-C++.podspec
  7. 3
      gRPC-Core.podspec
  8. 2
      grpc.gemspec
  9. 3
      grpc.gyp
  10. 2
      package.xml
  11. 17
      src/core/BUILD
  12. 14
      src/core/lib/event_engine/default_event_engine.cc
  13. 10
      src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc
  14. 8
      src/core/lib/event_engine/thready_event_engine/thready_event_engine.h
  15. 6
      src/core/lib/promise/party.cc
  16. 1
      src/python/grpcio/grpc_core_dependencies.py
  17. 2
      test/core/event_engine/test_suite/BUILD
  18. 2
      test/core/event_engine/test_suite/thready_posix_event_engine_test.cc
  19. 33
      test/core/event_engine/thready_event_engine/BUILD
  20. 10
      tools/bazel.rc
  21. 2
      tools/doxygen/Doxyfile.c++.internal
  22. 2
      tools/doxygen/Doxyfile.core.internal
  23. 46
      tools/internal_ci/linux/grpc_bazel_rbe_thready_tsan.cfg
  24. 41
      tools/internal_ci/linux/pull_request/grpc_bazel_rbe_thready_tsan.cfg

5
CMakeLists.txt generated

@ -2085,6 +2085,7 @@ add_library(grpc
src/core/lib/event_engine/thread_pool/original_thread_pool.cc
src/core/lib/event_engine/thread_pool/thread_pool_factory.cc
src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc
src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc
src/core/lib/event_engine/time_util.cc
src/core/lib/event_engine/trace.cc
src/core/lib/event_engine/utils.cc
@ -2786,6 +2787,7 @@ add_library(grpc_unsecure
src/core/lib/event_engine/thread_pool/original_thread_pool.cc
src/core/lib/event_engine/thread_pool/thread_pool_factory.cc
src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc
src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc
src/core/lib/event_engine/time_util.cc
src/core/lib/event_engine/trace.cc
src/core/lib/event_engine/utils.cc
@ -4318,6 +4320,7 @@ add_library(grpc_authorization_provider
src/core/lib/event_engine/thread_pool/original_thread_pool.cc
src/core/lib/event_engine/thread_pool/thread_pool_factory.cc
src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc
src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc
src/core/lib/event_engine/time_util.cc
src/core/lib/event_engine/trace.cc
src/core/lib/event_engine/utils.cc
@ -11551,6 +11554,7 @@ add_executable(frame_test
src/core/lib/event_engine/thread_pool/original_thread_pool.cc
src/core/lib/event_engine/thread_pool/thread_pool_factory.cc
src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc
src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc
src/core/lib/event_engine/time_util.cc
src/core/lib/event_engine/trace.cc
src/core/lib/event_engine/utils.cc
@ -21496,7 +21500,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
test/core/event_engine/test_suite/tests/server_test.cc
test/core/event_engine/test_suite/tests/timer_test.cc
test/core/event_engine/test_suite/thready_posix_event_engine_test.cc
test/core/event_engine/thready_event_engine/thready_event_engine.cc
third_party/googletest/googletest/src/gtest-all.cc
third_party/googletest/googlemock/src/gmock-all.cc
)

2
Makefile generated

@ -1465,6 +1465,7 @@ LIBGRPC_SRC = \
src/core/lib/event_engine/thread_pool/original_thread_pool.cc \
src/core/lib/event_engine/thread_pool/thread_pool_factory.cc \
src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc \
src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc \
src/core/lib/event_engine/time_util.cc \
src/core/lib/event_engine/trace.cc \
src/core/lib/event_engine/utils.cc \
@ -2020,6 +2021,7 @@ LIBGRPC_UNSECURE_SRC = \
src/core/lib/event_engine/thread_pool/original_thread_pool.cc \
src/core/lib/event_engine/thread_pool/thread_pool_factory.cc \
src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc \
src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc \
src/core/lib/event_engine/time_util.cc \
src/core/lib/event_engine/trace.cc \
src/core/lib/event_engine/utils.cc \

@ -714,6 +714,7 @@ libs:
- src/core/lib/event_engine/thread_pool/original_thread_pool.h
- src/core/lib/event_engine/thread_pool/thread_pool.h
- src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h
- src/core/lib/event_engine/thready_event_engine/thready_event_engine.h
- src/core/lib/event_engine/time_util.h
- src/core/lib/event_engine/trace.h
- src/core/lib/event_engine/utils.h
@ -1513,6 +1514,7 @@ libs:
- src/core/lib/event_engine/thread_pool/original_thread_pool.cc
- src/core/lib/event_engine/thread_pool/thread_pool_factory.cc
- src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc
- src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc
- src/core/lib/event_engine/time_util.cc
- src/core/lib/event_engine/trace.cc
- src/core/lib/event_engine/utils.cc
@ -2091,6 +2093,7 @@ libs:
- src/core/lib/event_engine/thread_pool/original_thread_pool.h
- src/core/lib/event_engine/thread_pool/thread_pool.h
- src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h
- src/core/lib/event_engine/thready_event_engine/thready_event_engine.h
- src/core/lib/event_engine/time_util.h
- src/core/lib/event_engine/trace.h
- src/core/lib/event_engine/utils.h
@ -2501,6 +2504,7 @@ libs:
- src/core/lib/event_engine/thread_pool/original_thread_pool.cc
- src/core/lib/event_engine/thread_pool/thread_pool_factory.cc
- src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc
- src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc
- src/core/lib/event_engine/time_util.cc
- src/core/lib/event_engine/trace.cc
- src/core/lib/event_engine/utils.cc
@ -3586,6 +3590,7 @@ libs:
- src/core/lib/event_engine/thread_pool/original_thread_pool.h
- src/core/lib/event_engine/thread_pool/thread_pool.h
- src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h
- src/core/lib/event_engine/thready_event_engine/thready_event_engine.h
- src/core/lib/event_engine/time_util.h
- src/core/lib/event_engine/trace.h
- src/core/lib/event_engine/utils.h
@ -3876,6 +3881,7 @@ libs:
- src/core/lib/event_engine/thread_pool/original_thread_pool.cc
- src/core/lib/event_engine/thread_pool/thread_pool_factory.cc
- src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc
- src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc
- src/core/lib/event_engine/time_util.cc
- src/core/lib/event_engine/trace.cc
- src/core/lib/event_engine/utils.cc
@ -7524,6 +7530,7 @@ targets:
- src/core/lib/event_engine/thread_pool/original_thread_pool.h
- src/core/lib/event_engine/thread_pool/thread_pool.h
- src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h
- src/core/lib/event_engine/thready_event_engine/thready_event_engine.h
- src/core/lib/event_engine/time_util.h
- src/core/lib/event_engine/trace.h
- src/core/lib/event_engine/utils.h
@ -7795,6 +7802,7 @@ targets:
- src/core/lib/event_engine/thread_pool/original_thread_pool.cc
- src/core/lib/event_engine/thread_pool/thread_pool_factory.cc
- src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc
- src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc
- src/core/lib/event_engine/time_util.cc
- src/core/lib/event_engine/trace.cc
- src/core/lib/event_engine/utils.cc
@ -12157,7 +12165,6 @@ targets:
- test/core/event_engine/test_suite/tests/client_test.h
- test/core/event_engine/test_suite/tests/server_test.h
- test/core/event_engine/test_suite/tests/timer_test.h
- test/core/event_engine/thready_event_engine/thready_event_engine.h
src:
- test/core/event_engine/event_engine_test_utils.cc
- test/core/event_engine/test_suite/event_engine_test_framework.cc
@ -12166,7 +12173,6 @@ targets:
- test/core/event_engine/test_suite/tests/server_test.cc
- test/core/event_engine/test_suite/tests/timer_test.cc
- test/core/event_engine/test_suite/thready_posix_event_engine_test.cc
- test/core/event_engine/thready_event_engine/thready_event_engine.cc
deps:
- grpc_unsecure
- grpc_test_util

2
config.m4 generated

@ -548,6 +548,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/event_engine/thread_pool/original_thread_pool.cc \
src/core/lib/event_engine/thread_pool/thread_pool_factory.cc \
src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc \
src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc \
src/core/lib/event_engine/time_util.cc \
src/core/lib/event_engine/trace.cc \
src/core/lib/event_engine/utils.cc \
@ -1467,6 +1468,7 @@ if test "$PHP_GRPC" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/event_engine/cf_engine)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/event_engine/posix_engine)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/event_engine/thread_pool)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/event_engine/thready_event_engine)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/event_engine/windows)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/event_engine/work_queue)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/experiments)

2
config.w32 generated

@ -513,6 +513,7 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\event_engine\\thread_pool\\original_thread_pool.cc " +
"src\\core\\lib\\event_engine\\thread_pool\\thread_pool_factory.cc " +
"src\\core\\lib\\event_engine\\thread_pool\\work_stealing_thread_pool.cc " +
"src\\core\\lib\\event_engine\\thready_event_engine\\thready_event_engine.cc " +
"src\\core\\lib\\event_engine\\time_util.cc " +
"src\\core\\lib\\event_engine\\trace.cc " +
"src\\core\\lib\\event_engine\\utils.cc " +
@ -1599,6 +1600,7 @@ if (PHP_GRPC != "no") {
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\event_engine\\cf_engine");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\event_engine\\posix_engine");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\event_engine\\thread_pool");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\event_engine\\thready_event_engine");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\event_engine\\windows");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\event_engine\\work_queue");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\experiments");

2
gRPC-C++.podspec generated

@ -785,6 +785,7 @@ Pod::Spec.new do |s|
'src/core/lib/event_engine/thread_pool/original_thread_pool.h',
'src/core/lib/event_engine/thread_pool/thread_pool.h',
'src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h',
'src/core/lib/event_engine/thready_event_engine/thready_event_engine.h',
'src/core/lib/event_engine/time_util.h',
'src/core/lib/event_engine/trace.h',
'src/core/lib/event_engine/utils.h',
@ -1822,6 +1823,7 @@ Pod::Spec.new do |s|
'src/core/lib/event_engine/thread_pool/original_thread_pool.h',
'src/core/lib/event_engine/thread_pool/thread_pool.h',
'src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h',
'src/core/lib/event_engine/thready_event_engine/thready_event_engine.h',
'src/core/lib/event_engine/time_util.h',
'src/core/lib/event_engine/trace.h',
'src/core/lib/event_engine/utils.h',

3
gRPC-Core.podspec generated

@ -1223,6 +1223,8 @@ Pod::Spec.new do |s|
'src/core/lib/event_engine/thread_pool/thread_pool_factory.cc',
'src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc',
'src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h',
'src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc',
'src/core/lib/event_engine/thready_event_engine/thready_event_engine.h',
'src/core/lib/event_engine/time_util.cc',
'src/core/lib/event_engine/time_util.h',
'src/core/lib/event_engine/trace.cc',
@ -2548,6 +2550,7 @@ Pod::Spec.new do |s|
'src/core/lib/event_engine/thread_pool/original_thread_pool.h',
'src/core/lib/event_engine/thread_pool/thread_pool.h',
'src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h',
'src/core/lib/event_engine/thready_event_engine/thready_event_engine.h',
'src/core/lib/event_engine/time_util.h',
'src/core/lib/event_engine/trace.h',
'src/core/lib/event_engine/utils.h',

2
grpc.gemspec generated

@ -1129,6 +1129,8 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/event_engine/thread_pool/thread_pool_factory.cc )
s.files += %w( src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc )
s.files += %w( src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h )
s.files += %w( src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc )
s.files += %w( src/core/lib/event_engine/thready_event_engine/thready_event_engine.h )
s.files += %w( src/core/lib/event_engine/time_util.cc )
s.files += %w( src/core/lib/event_engine/time_util.h )
s.files += %w( src/core/lib/event_engine/trace.cc )

3
grpc.gyp generated

@ -768,6 +768,7 @@
'src/core/lib/event_engine/thread_pool/original_thread_pool.cc',
'src/core/lib/event_engine/thread_pool/thread_pool_factory.cc',
'src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc',
'src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc',
'src/core/lib/event_engine/time_util.cc',
'src/core/lib/event_engine/trace.cc',
'src/core/lib/event_engine/utils.cc',
@ -1262,6 +1263,7 @@
'src/core/lib/event_engine/thread_pool/original_thread_pool.cc',
'src/core/lib/event_engine/thread_pool/thread_pool_factory.cc',
'src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc',
'src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc',
'src/core/lib/event_engine/time_util.cc',
'src/core/lib/event_engine/trace.cc',
'src/core/lib/event_engine/utils.cc',
@ -1779,6 +1781,7 @@
'src/core/lib/event_engine/thread_pool/original_thread_pool.cc',
'src/core/lib/event_engine/thread_pool/thread_pool_factory.cc',
'src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc',
'src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc',
'src/core/lib/event_engine/time_util.cc',
'src/core/lib/event_engine/trace.cc',
'src/core/lib/event_engine/utils.cc',

2
package.xml generated

@ -1111,6 +1111,8 @@
<file baseinstalldir="/" name="src/core/lib/event_engine/thread_pool/thread_pool_factory.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/event_engine/thready_event_engine/thready_event_engine.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/event_engine/time_util.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/event_engine/time_util.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/event_engine/trace.cc" role="src" />

@ -2237,6 +2237,22 @@ grpc_cc_library(
],
)
grpc_cc_library(
name = "thready_event_engine",
srcs = ["lib/event_engine/thready_event_engine/thready_event_engine.cc"],
hdrs = ["lib/event_engine/thready_event_engine/thready_event_engine.h"],
external_deps = [
"absl/functional:any_invocable",
"absl/status",
"absl/status:statusor",
"absl/strings",
],
deps = [
"//:event_engine_base_hdrs",
"//:gpr",
],
)
grpc_cc_library(
name = "default_event_engine",
srcs = [
@ -2252,6 +2268,7 @@ grpc_cc_library(
"default_event_engine_factory",
"event_engine_trace",
"no_destruct",
"thready_event_engine",
"//:config",
"//:debug_location",
"//:event_engine_base_hdrs",

@ -32,6 +32,10 @@
#include "src/core/lib/gprpp/no_destruct.h"
#include "src/core/lib/gprpp/sync.h"
#ifdef GRPC_MAXIMIZE_THREADYNESS
#include "src/core/lib/event_engine/thready_event_engine/thready_event_engine.h" // IWYU pragma: keep
#endif
namespace grpc_event_engine {
namespace experimental {
@ -57,13 +61,21 @@ void EventEngineFactoryReset() {
g_event_engine->reset();
}
std::unique_ptr<EventEngine> CreateEventEngine() {
std::unique_ptr<EventEngine> CreateEventEngineInner() {
if (auto* factory = g_event_engine_factory.load()) {
return (*factory)();
}
return DefaultEventEngineFactory();
}
std::unique_ptr<EventEngine> CreateEventEngine() {
#ifdef GRPC_MAXIMIZE_THREADYNESS
return std::make_unique<ThreadyEventEngine>(CreateEventEngineInner());
#else
return CreateEventEngineInner();
#endif
}
std::shared_ptr<EventEngine> GetDefaultEventEngine(
grpc_core::SourceLocation location) {
grpc_core::MutexLock lock(&*g_mu);

@ -12,21 +12,25 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "test/core/event_engine/thready_event_engine/thready_event_engine.h"
#include <grpc/support/port_platform.h>
#include "src/core/lib/event_engine/thready_event_engine/thready_event_engine.h"
#include <memory>
#include <string>
#include <thread>
#include <type_traits>
#include <vector>
#include "src/core/lib/gprpp/crash.h"
#include "src/core/lib/gprpp/thd.h"
namespace grpc_event_engine {
namespace experimental {
void ThreadyEventEngine::Asynchronously(absl::AnyInvocable<void()> fn) {
std::thread([fn = std::move(fn)]() mutable { fn(); }).detach();
grpc_core::Thread t("thready_event_engine", std::move(fn), nullptr,
grpc_core::Thread::Options().set_joinable(false));
t.Start();
}
absl::StatusOr<std::unique_ptr<EventEngine::Listener>>

@ -12,8 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef GRPC_TEST_CORE_EVENT_ENGINE_THREADY_EVENT_ENGINE_THREADY_EVENT_ENGINE_H
#define GRPC_TEST_CORE_EVENT_ENGINE_THREADY_EVENT_ENGINE_THREADY_EVENT_ENGINE_H
#ifndef GRPC_SRC_CORE_LIB_EVENT_ENGINE_THREADY_EVENT_ENGINE_THREADY_EVENT_ENGINE_H
#define GRPC_SRC_CORE_LIB_EVENT_ENGINE_THREADY_EVENT_ENGINE_THREADY_EVENT_ENGINE_H
#include <grpc/support/port_platform.h>
#include <memory>
#include <utility>
@ -103,4 +105,4 @@ class ThreadyEventEngine final : public EventEngine {
} // namespace experimental
} // namespace grpc_event_engine
#endif // GRPC_TEST_CORE_EVENT_ENGINE_THREADY_EVENT_ENGINE_THREADY_EVENT_ENGINE_H
#endif // GRPC_SRC_CORE_LIB_EVENT_ENGINE_THREADY_EVENT_ENGINE_THREADY_EVENT_ENGINE_H

@ -29,9 +29,7 @@
#include "src/core/lib/promise/activity.h"
#include "src/core/lib/promise/trace.h"
// #define GRPC_PARTY_MAXIMIZE_THREADS
#ifdef GRPC_PARTY_MAXIMIZE_THREADS
#ifdef GRPC_MAXIMIZE_THREADYNESS
#include "src/core/lib/gprpp/thd.h" // IWYU pragma: keep
#include "src/core/lib/iomgr/exec_ctx.h" // IWYU pragma: keep
#endif
@ -202,7 +200,7 @@ void Party::RunLocked() {
PartyOver();
}
};
#ifdef GRPC_PARTY_MAXIMIZE_THREADS
#ifdef GRPC_MAXIMIZE_THREADYNESS
Thread thd(
"RunParty",
[body]() {

@ -522,6 +522,7 @@ CORE_SOURCE_FILES = [
'src/core/lib/event_engine/thread_pool/original_thread_pool.cc',
'src/core/lib/event_engine/thread_pool/thread_pool_factory.cc',
'src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc',
'src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc',
'src/core/lib/event_engine/time_util.cc',
'src/core/lib/event_engine/trace.cc',
'src/core/lib/event_engine/utils.cc',

@ -65,12 +65,12 @@ grpc_cc_test(
uses_polling = True,
deps = [
"//src/core:posix_event_engine",
"//src/core:thready_event_engine",
"//test/core/event_engine:event_engine_test_utils",
"//test/core/event_engine/test_suite/posix:oracle_event_engine_posix",
"//test/core/event_engine/test_suite/tests:client",
"//test/core/event_engine/test_suite/tests:server",
"//test/core/event_engine/test_suite/tests:timer",
"//test/core/event_engine/thready_event_engine",
],
)

@ -18,12 +18,12 @@
#include <grpc/grpc.h>
#include "src/core/lib/event_engine/posix_engine/posix_engine.h"
#include "src/core/lib/event_engine/thready_event_engine/thready_event_engine.h"
#include "test/core/event_engine/test_suite/event_engine_test_framework.h"
#include "test/core/event_engine/test_suite/posix/oracle_event_engine_posix.h"
#include "test/core/event_engine/test_suite/tests/client_test.h"
#include "test/core/event_engine/test_suite/tests/server_test.h"
#include "test/core/event_engine/test_suite/tests/timer_test.h"
#include "test/core/event_engine/thready_event_engine/thready_event_engine.h"
#include "test/core/util/test_config.h"
int main(int argc, char** argv) {

@ -1,33 +0,0 @@
# Copyright 2023 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_package")
licenses(["notice"])
grpc_package(
name = "test/core/event_engine/thready_event_engine",
visibility = "tests",
)
grpc_cc_library(
name = "thready_event_engine",
srcs = ["thready_event_engine.cc"],
hdrs = ["thready_event_engine.h"],
deps = [
"//:event_engine_base_hdrs",
"//src/core:default_event_engine",
"//src/core:time",
],
)

@ -107,6 +107,16 @@ build:tsan --copt=-DGRPC_TSAN
build:tsan --linkopt=-fsanitize=thread
build:tsan --action_env=TSAN_OPTIONS=suppressions=test/core/util/tsan_suppressions.txt:halt_on_error=1:second_deadlock_stack=1
# a TSAN build that tries to create new threads whenever possible
build:thready_tsan --strip=never
build:thready_tsan --copt=-fsanitize=thread
build:thready_tsan --copt=-fno-omit-frame-pointer
build:thready_tsan --copt=-DGPR_NO_DIRECT_SYSCALLS
build:thready_tsan --copt=-DGRPC_TSAN
build:thready_tsan --copt=-DGRPC_MAXIMIZE_THREADYNESS
build:thready_tsan --linkopt=-fsanitize=thread
build:thready_tsan --action_env=TSAN_OPTIONS=suppressions=test/core/util/tsan_suppressions.txt:halt_on_error=1:second_deadlock_stack=1
build:tsan_macos --strip=never
build:tsan_macos --copt=-fsanitize=thread
build:tsan_macos --copt=-fno-omit-frame-pointer

@ -2125,6 +2125,8 @@ src/core/lib/event_engine/thread_pool/thread_pool.h \
src/core/lib/event_engine/thread_pool/thread_pool_factory.cc \
src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc \
src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h \
src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc \
src/core/lib/event_engine/thready_event_engine/thready_event_engine.h \
src/core/lib/event_engine/time_util.cc \
src/core/lib/event_engine/time_util.h \
src/core/lib/event_engine/trace.cc \

@ -1903,6 +1903,8 @@ src/core/lib/event_engine/thread_pool/thread_pool.h \
src/core/lib/event_engine/thread_pool/thread_pool_factory.cc \
src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc \
src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h \
src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc \
src/core/lib/event_engine/thready_event_engine/thready_event_engine.h \
src/core/lib/event_engine/time_util.cc \
src/core/lib/event_engine/time_util.h \
src/core/lib/event_engine/trace.cc \

@ -0,0 +1,46 @@
# Copyright 2019 The gRPC Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Config file for the internal CI (in protobuf text format)
# Location of the continuous shell script in repository.
build_file: "grpc/tools/internal_ci/linux/grpc_bazel_rbe.sh"
timeout_mins: 90
action {
define_artifacts {
regex: "**/*sponge_log.*"
regex: "github/grpc/reports/**"
}
}
gfile_resources: "/bigstore/grpc-testing-secrets/gcp_credentials/resultstore_api_key"
bazel_setting {
# In order for Kokoro to recognize this as a bazel build and publish the bazel resultstore link,
# the bazel_setting section needs to be present and "upsalite_frontend_address" needs to be
# set. The rest of configuration from bazel_setting is unused (we configure everything when bazel
# command is invoked).
upsalite_frontend_address: "https://source.cloud.google.com"
}
env_vars {
# flags will be passed to bazel invocation
key: "BAZEL_FLAGS"
value: "--cache_test_results=no --config=thready_tsan"
}
env_vars {
key: "UPLOAD_TEST_RESULTS"
value: "true"
}

@ -0,0 +1,41 @@
# Copyright 2019 The gRPC Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Config file for the internal CI (in protobuf text format)
# Location of the continuous shell script in repository.
build_file: "grpc/tools/internal_ci/linux/grpc_bazel_rbe.sh"
timeout_mins: 90
action {
define_artifacts {
regex: "**/*sponge_log.*"
regex: "github/grpc/reports/**"
}
}
gfile_resources: "/bigstore/grpc-testing-secrets/gcp_credentials/resultstore_api_key"
bazel_setting {
# In order for Kokoro to recognize this as a bazel build and publish the bazel resultstore link,
# the bazel_setting section needs to be present and "upsalite_frontend_address" needs to be
# set. The rest of configuration from bazel_setting is unused (we configure everything when bazel
# command is invoked).
upsalite_frontend_address: "https://source.cloud.google.com"
}
env_vars {
# flags will be passed to bazel invocation
key: "BAZEL_FLAGS"
value: "--config=thready_tsan"
}
Loading…
Cancel
Save