Skip to content

Commit

Permalink
Guard against busy spinning in HashedWheelTimer when using windows an…
Browse files Browse the repository at this point in the history
…d a tickDuration of 1 (#9714)

Motivation:

We do not correct guard against the gact that when applying our workaround for windows we may end up with a 0 sleep period. In this case we should just sleep for 1 ms.

Modifications:

Guard agains the case when our calculation will produce 0 as sleep time on windows

Result:

Fixes #9710.
  • Loading branch information
normanmaurer committed Oct 25, 2019
1 parent 5949e19 commit 6841357
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions common/src/main/java/io/netty/util/HashedWheelTimer.java
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,9 @@ private long waitForNextTick() {
// See https://github.com/netty/netty/issues/356
if (PlatformDependent.isWindows()) {
sleepTimeMs = sleepTimeMs / 10 * 10;
if (sleepTimeMs == 0) {
sleepTimeMs = 1;
}
}

try {
Expand Down

0 comments on commit 6841357

Please sign in to comment.