RFC on 8165823: (se) EPollArrayWrapper throws NPE if limits.conf set to 65536 and fd=65536
Brian Burkhalter
brian.burkhalter at oracle.com
Tue Oct 4 15:26:06 UTC 2016
Hi Christoph,
Thanks for your comments.
On Oct 4, 2016, at 12:44 AM, Langer, Christoph <christoph.langer at sap.com> wrote:
> I agree to your code analysis, that for a ulimit value of 65536 still the NPE should not occur, assuming the fd number can't be higher than 65535. However, is there a guarantee about the file descriptor numbers themselves being in the range between 0 and OPEN_MAX - 1? Maybe just the count of open file descriptors has to be in the OPEN_MAX range but single number values could well be out of that range? At least on certain operating systems?
Based on my reading of [1, 2] it seems like the fd number must be in the range [0,OPEN_MAX), i.e., 0 <= fd < OPEN_MAX.
RLIMIT_NOFILE
Specifies a value one greater than the maximum file descriptor
number that can be opened by this process.
It is possible of course that some operating systems interpret this as the cardinality rather than the exclusive least upper bound.
> I remember Thomas has just recently done some work in the area of file descriptors: @Thomas: Do you have anything to add here?
I would be curious to hear about it.
In the worse case the code could be made more defensive for this case with for example a getEventsHigh() method which would lazily initialize the eventsHigh HashMap. The penalty of course would be in performance.
Best regards,
Brian
[1] https://linux.die.net/man/2/getrlimit
[2] http://manpages.ubuntu.com/manpages/xenial/man2/getrlimit.2.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20161004/966fe707/attachment.html>
More information about the nio-dev
mailing list