Regression in EPollArrayWrapper causes NPE when fd > 64 * 1024

Alan Bateman Alan.Bateman at oracle.com
Mon Sep 16 17:49:01 UTC 2013


On 16/09/2013 16:45, Norman Maurer wrote:
> Hi there,
>
> this is my first bug-report here so bear with me if something is 
> missing ;)
>
> During testing netty.io with many concurrent connections one of our 
> users reported a NullPointerException which was thrown by 
> sun.nio.ch.EPollArrayWrapper.setUpdateEvents(...). This was observed 
> as soon as the concurrent connection count > 64 * 1024.
Thanks for this (and the analysis), embarrassing as this has been in 
7u40 for a long time and doesn't seem to be have been noticed. Maybe 
there aren't too many people testing with this number of connections.

I've created this bug to track it:
   8024883: (se) SelectableChannel.register throws NPE of fd >= 64k (lnx)

and just did a few initial testing with the attached. Your mail mentions 
attachments but they seem to have been dropped. If you are looking to 
contribute a patch then you can re-send with the patch inlined?

-Alan


diff --git a/src/solaris/classes/sun/nio/ch/EPollArrayWrapper.java 
b/src/solaris/classes/sun/nio/ch/EPollArrayWrapper.java
--- a/src/solaris/classes/sun/nio/ch/EPollArrayWrapper.java
+++ b/src/solaris/classes/sun/nio/ch/EPollArrayWrapper.java
@@ -175,7 +175,8 @@
              }
          } else {
              Integer key = Integer.valueOf(fd);
-            if ((eventsHigh.get(key) != KILLED) || force) {
+            Byte prev = eventsHigh.get(key);
+            if (prev == null || prev == KILLED || force) {
                  eventsHigh.put(key, Byte.valueOf(events));
              }
          }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20130916/c0796533/attachment.html 


More information about the nio-dev mailing list