Commit 11018acb authored by Robin Cheng's avatar Robin Cheng Committed by Facebook GitHub Bot

Fix TSAN issues with FibersTest.

Summary:
Two issues:
 - Executor not properly shutdown before destruction
 - Shadow stack overflow due to TSAN not handling fibers correctly. For this we just reduce the number of tasks for now; the proper fix would be likely quite involved and it's not clear whether it's worth it at this point since I think it only affects diagnostic messages that TSAN prints.

Reviewed By: yfeldblum

Differential Revision: D22901657

fbshipit-source-id: 833454e6f54ab6fc7c53333157197345e8d887e2
parent 0cb1f60c
...@@ -1535,6 +1535,7 @@ TEST(FiberManager, batonWaitTimeoutHandlerExecutor) { ...@@ -1535,6 +1535,7 @@ TEST(FiberManager, batonWaitTimeoutHandlerExecutor) {
}; };
manager.addTask([&]() { task(300); }); manager.addTask([&]() { task(300); });
baton2.wait(); baton2.wait();
executor.join();
} }
TEST(FiberManager, batonWaitTimeoutMany) { TEST(FiberManager, batonWaitTimeoutMany) {
...@@ -1544,7 +1545,10 @@ TEST(FiberManager, batonWaitTimeoutMany) { ...@@ -1544,7 +1545,10 @@ TEST(FiberManager, batonWaitTimeoutMany) {
dynamic_cast<EventBaseLoopController&>(manager.loopController()) dynamic_cast<EventBaseLoopController&>(manager.loopController())
.attachEventBase(evb); .attachEventBase(evb);
constexpr size_t kNumTimeoutTasks = 10000; // TODO(T71050527): It appears that TSAN does not yet maintain the shadow
// stack correctly upon fiber switches, resulting in a shadow stack overflow
// if we push too many tasks here. Cap it in the meantime.
constexpr size_t kNumTimeoutTasks = folly::kIsSanitizeThread ? 1000 : 10000;
size_t tasksCount = kNumTimeoutTasks; size_t tasksCount = kNumTimeoutTasks;
// We add many tasks to hit timeout queue deallocation logic. // We add many tasks to hit timeout queue deallocation logic.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment