aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-09-16 17:00:59 -0700
committerGravatar Nicolas "Pixel" Noble <pixel@nobis-crew.org>2015-09-17 21:59:31 +0200
commit787fb130561bec4a8178720158d93ce01c031c8a (patch)
tree0c7ec35d8d53bd4e861ec12adea16c29450069a5 /src
parent3c142b8bcc6b87d34854772816553825a8705bdf (diff)
Move in-flight callback check up
Fixes #3203 We entered a live lock race between the promotion callback and pollers, which was only resolved when the background executor got lucky enough to pick up the async work.
Diffstat (limited to 'src')
-rw-r--r--src/core/iomgr/pollset_posix.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/core/iomgr/pollset_posix.c b/src/core/iomgr/pollset_posix.c
index 6bd1b61f24..2a3ae4bb75 100644
--- a/src/core/iomgr/pollset_posix.c
+++ b/src/core/iomgr/pollset_posix.c
@@ -187,6 +187,12 @@ void grpc_pollset_work(grpc_pollset *pollset, grpc_pollset_worker *worker,
if (pollset->shutting_down) {
goto done;
}
+ if (pollset->in_flight_cbs) {
+ /* Give do_promote priority so we don't starve it out */
+ gpr_mu_unlock(&pollset->mu);
+ gpr_mu_lock(&pollset->mu);
+ goto done;
+ }
if (!pollset->kicked_without_pollers) {
push_front_worker(pollset, worker);
added_worker = 1;
@@ -422,12 +428,6 @@ static void basic_pollset_maybe_work(grpc_pollset *pollset,
int r;
int nfds;
- if (pollset->in_flight_cbs) {
- /* Give do_promote priority so we don't starve it out */
- gpr_mu_unlock(&pollset->mu);
- gpr_mu_lock(&pollset->mu);
- return;
- }
fd = pollset->data.ptr;
if (fd && grpc_fd_is_orphaned(fd)) {
GRPC_FD_UNREF(fd, "basicpoll");