Bug 1011051

Summary: Regression in EPollArrayWrapper causes NPE when fd > 64 * 1024
Product: [Fedora] Fedora Reporter: Norman Maurer <nmaurer>
Component: java-1.8.0-openjdkAssignee: Deepak Bhole <dbhole>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 22CC: ahughes, dbhole, dingham, jerboaa, jvanek, mgoldman, msrb, omajid
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1011090 1011094 (view as bug list) Environment:
Last Closed: 2016-07-19 14:58:40 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 1011090, 1011094    
Description Flags
Patch to fix problem.
Changeset with test-cases to fix the problem none

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.