Permalink
Browse files

NETTY-410 NioWorker write deadlock

Applied the patch provided by Greg Dhuse.
  • Loading branch information...
1 parent b9ef785 commit 4bf26c31e97790d89d312edfdd9022bf07c952be @trustin trustin committed Jul 31, 2011
Showing with 12 additions and 6 deletions.
  1. +12 −6 src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramWorker.java
@@ -568,15 +568,21 @@ private void write0(final NioDatagramChannel channel) {
}
}
channel.inWriteNowLoop = false;
+
+ // Initially, the following block was executed after releasing
+ // the writeLock, but there was a race condition, and it has to be
+ // executed before releasing the writeLock:
+ //
+ // https://issues.jboss.org/browse/NETTY-410
+ //
+ if (addOpWrite) {
+ setOpWrite(channel);
+ } else if (removeOpWrite) {
+ clearOpWrite(channel);
+ }
}
fireWriteComplete(channel, writtenBytes);
-
- if (addOpWrite) {
- setOpWrite(channel);
- } else if (removeOpWrite) {
- clearOpWrite(channel);
- }
}
private void setOpWrite(final NioDatagramChannel channel) {

0 comments on commit 4bf26c3

Please sign in to comment.