commit | 6e56f8c07dbf98ca72044783b54f2ffcd84e8b7e | [log] [tgz] |
---|---|---|
author | Reilly Grant <[email protected]> | Wed Jan 12 02:45:55 2022 |
committer | Chromium LUCI CQ <[email protected]> | Wed Jan 12 02:45:55 2022 |
tree | ebd8eb67c6e137acb3b264004922c3a4ccf2a50d | |
parent | 92442de2dd58c420101dd3a7ad9361dabae7874a [diff] |
Fix data race in MessagePumpGLibFdWatchTest::TearDown TSan has identified a data race when closing FDs in the TearDown() method because these FDs were also used by the IO thread. To resolve this issue, wait until the IO thread to exit before closing these FDs. Example failure: https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20TSan%20Tests/72713/overview Change-Id: Id5e68ee4e77abde9dd9260874f019720c1381183 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3382038 Auto-Submit: Reilly Grant <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Commit-Queue: Daniel Cheng <[email protected]> Cr-Commit-Position: refs/heads/main@{#957893}
diff --git a/base/message_loop/message_pump_glib_unittest.cc b/base/message_loop/message_pump_glib_unittest.cc index 2a05e5b..3fcbde3 100644 --- a/base/message_loop/message_pump_glib_unittest.cc +++ b/base/message_loop/message_pump_glib_unittest.cc
@@ -554,6 +554,9 @@ } void TearDown() override { + // Wait for the IO thread to exit before closing FDs which may have been + // passed to it. + io_thread_.Stop(); if (IGNORE_EINTR(close(pipefds_[0])) < 0) PLOG(ERROR) << "close"; if (IGNORE_EINTR(close(pipefds_[1])) < 0)