diff options
author | Andy Schwerin <schwerin@mongodb.com> | 2016-04-13 18:38:40 -0400 |
---|---|---|
committer | Andy Schwerin <schwerin@mongodb.com> | 2016-04-15 11:21:08 -0400 |
commit | 2b8ceb83a66eb400aa7dcad0a3735f2d6515b755 (patch) | |
tree | 4ae5dcc9e439f3c3d3ae51dcca5d5b02c1fddf5b /src/mongo/util/fail_point.h | |
parent | 0bf837ee16bd39df6a0e502286524553bc96c0f0 (diff) | |
download | mongo-2b8ceb83a66eb400aa7dcad0a3735f2d6515b755.tar.gz |
SERVER-23686 Handle race condition in ThreadPoolTaskExecutor shutdown logic.
Some implementations of NetworkInterface, particularly NetworkInterfaceMock,
cannot be shut down before the ThreadPool used by the ThreadPoolTaskExecutor,
leaving a race between shutting down the pool and scheduling the final completed
network operations into the pool. The workaround is to let the
ThreadPoolTaskExecutor's join() method execute any operation callbacks that get
left behind in this scenario. The safety argument is described in a comment in
the code.
Diffstat (limited to 'src/mongo/util/fail_point.h')
-rw-r--r-- | src/mongo/util/fail_point.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mongo/util/fail_point.h b/src/mongo/util/fail_point.h index 5cdc6bd5c0a..dad6ddef522 100644 --- a/src/mongo/util/fail_point.h +++ b/src/mongo/util/fail_point.h @@ -225,9 +225,11 @@ private: #define MONGO_FAIL_POINT(symbol) MONGO_unlikely(symbol.shouldFail()) #define MONGO_FAIL_POINT_PAUSE_WHILE_SET(symbol) \ - while (MONGO_FAIL_POINT(symbol)) { \ - sleepmillis(100); \ - } + do { \ + while (MONGO_FAIL_POINT(symbol)) { \ + sleepmillis(100); \ + } \ + } while (false) /** * Macro for creating a fail point with block context. Also use this when |