Skip to content

Commit

Permalink
[Wisp] Fix wisp poller dead lock in PUSH scheduling policy.
Browse files Browse the repository at this point in the history
Summary:
Assume a coroutine that is waiting a synchronize monitor was scheduled to a carrier thread, and the carrier thread is doing as a poller. If the poller is trying to get this synchronize monitor at this moment, and then the poller will park because can not acquire the monitor. This case will cause a deadlock.

Test Plan: test/jdk/com/alibaba/wisp

Reviewed-by: yulei

Issue:
dragonwell-project#165
  • Loading branch information
nebula-xm authored and ZhaiMo15 committed Oct 16, 2023
1 parent c6bca3c commit 136b604
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,11 @@ private void recordTaskByFD(int fd, WispTask task, int events) {
if (fd < LOW_FD_BOUND) {
getFd2TaskLow(events)[fd] = task;
} else {
WispCarrier carrier = WispCarrier.current();
final boolean isInCritical0 = carrier.isInCritical;
carrier.isInCritical = true;
getFd2TaskHigh(events).put(fd, task);
carrier.isInCritical = isInCritical0;
}
}

Expand All @@ -192,7 +196,11 @@ private WispTask removeTaskByFD(int fd, int events) {
task = fd2TaskLow[fd];
fd2TaskLow[fd] = null;
} else {
WispCarrier carrier = WispCarrier.current();
final boolean isInCritical0 = carrier.isInCritical;
carrier.isInCritical = true;
task = getFd2TaskHigh(events).remove(fd);
carrier.isInCritical = isInCritical0;
}
return task;
}
Expand Down

0 comments on commit 136b604

Please sign in to comment.