Bug 1011051 - Regression in EPollArrayWrapper causes NPE when fd > 64 * 1024
Regression in EPollArrayWrapper causes NPE when fd > 64 * 1024
Product: Fedora
Classification: Fedora
Component: java-1.8.0-openjdk (Show other bugs)
All Linux
unspecified Severity high
: ---
: ---
Assigned To: Deepak Bhole
Fedora Extras Quality Assurance
Depends On:
Blocks: 1011090 1011094
  Show dependency treegraph
Reported: 2013-09-23 10:28 EDT by Norman Maurer
Modified: 2016-07-19 16:26 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1011090 1011094 (view as bug list)
Last Closed: 2016-07-19 14:58:40 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Patch to fix problem. (1.21 KB, text/plain)
2013-09-23 10:28 EDT, Norman Maurer
no flags Details
Changeset with test-cases to fix the problem (5.31 KB, patch)
2013-09-23 10:32 EDT, Norman Maurer
no flags Details | Diff

  None (edit)
Description Norman Maurer 2013-09-23 10:28:25 EDT
Created attachment 801679 [details]
Patch to fix problem.

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. After more investigating I was able to find the bug in EPollArrayWrapper.setUpdateEvents(...), which is a regression introduced by the following change:


The problem here is that eventsHigh.get(key) will be called once the fd is > 64 * 1024. This may return "null" which is compared to KILLED (which is of type byte) and so may throw a NPE because the compare tries to unbox the return value (which is of type Byte). The regression is present in lastest openjdk8 and in openjdk7u40 and later. It seems to also affects oracle jdk 7u40. All OS'es that use epoll are affected, in my case linux (ubuntu).

Attached you find the proposed fix for openjdk8 and openjdk7 and a reproducer which can be used. The fix does two things:
* Eliminate the access to  the eventsHigh Map if "force" is true.
* Check for null before try to compare the stored events value

For more details and a reproducer see:
Comment 1 Norman Maurer 2013-09-23 10:32:36 EDT
Created attachment 801680 [details]
Changeset with test-cases to fix the problem
Comment 3 Deepak Bhole 2013-09-26 11:50:10 EDT
We will fix this with the next CPU. Assigning to Jiri.
Comment 5 Jaroslav Reznik 2015-03-03 10:06:07 EST
This bug appears to have been reported against 'rawhide' during the Fedora 22 development cycle.
Changing version to '22'.

More information and reason for this action is here:
Comment 6 Fedora End Of Life 2016-07-19 14:58:40 EDT
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this

Thank you for reporting this bug and we are sorry it could not be fixed.
Comment 7 Andrew John Hughes 2016-07-19 16:26:23 EDT
This is in both OpenJDK 7 & 8 for nearly three years, so can be closed as CURRENTLRELEASE for java-1.8.0-openjdk.

Note You need to log in before you can comment on or make changes to this bug.