diff options
author | Fabricio Voznika <fvoznika@google.com> | 2018-12-27 14:58:41 -0800 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-12-27 14:59:50 -0800 |
commit | 46e6577014c849d7306c63905db25f3c695fa7e7 (patch) | |
tree | f0beec40f3bbda38bf209809b091cf537b66cba8 /test/util/BUILD | |
parent | bce2f9751f415da869d04ccb53833b024373666d (diff) |
Fix deadlock between epoll_wait and getdents
epoll_wait acquires EventPoll.listsMu (in EventPoll.ReadEvents) and
then calls Inotify.Readiness which tries to acquire Inotify.evMu.
getdents acquires Inotify.evMu (in Inotify.queueEvent) and then calls
readyCallback.Callback which tries to acquire EventPoll.listsMu.
The fix is to release Inotify.evMu before calling Queue.Notify. Queue
is thread-safe and doesn't require Inotify.evMu to be held.
Closes #121
PiperOrigin-RevId: 227066695
Change-Id: Id29364bb940d1727f33a5dff9a3c52f390c15761
Diffstat (limited to 'test/util/BUILD')
-rw-r--r-- | test/util/BUILD | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/util/BUILD b/test/util/BUILD index f981a8d1d..10507eae4 100644 --- a/test/util/BUILD +++ b/test/util/BUILD @@ -259,3 +259,16 @@ cc_library( srcs = ["test_main.cc"], deps = [":test_util"], ) + +cc_library( + name = "epoll_util", + testonly = 1, + srcs = ["epoll_util.cc"], + hdrs = ["epoll_util.h"], + deps = [ + ":file_descriptor", + ":posix_error", + ":save_util", + "@com_google_googletest//:gtest", + ], +) |