RFR(S): 8248910: NPE when freeing the memory for a slice from a buffer

Alan Bateman Alan.Bateman at oracle.com
Mon Aug 3 06:36:50 UTC 2020


On 03/08/2020 02:46, Yangfei (Felix) wrote:
> Hi,
>
>      Bug: https://bugs.openjdk.java.net/browse/JDK-8248910
>      Webrev: http://cr.openjdk.java.net/~fyang/8248910/webrev.00
>
>      As commented on the bug, initially we observed this issue when we use Randoop which is a unit test generator for Java.
>      The overall procedure is described by the newly add test.
>      For a slice from a ByteBuffer, it does not have a cleaner, which leads to the NPE.
>      Here, I think we should not try to free the memory of a slice.
>      Proposed fix adds a null check for cleaner in Util.free before invoking its clean() method.
>
I think we need to diagnose the issue a bit further in the discussion 
here before discussing changes in this area.

I can see there are issues if aligned slices are offered to the buffer 
cache but this should only arise with direct file I/O (JDK specific 
ExtendedOpenOption.DIRECT)? That is an issue that should be fixed but I 
can't tell if it related to your bug or not.

Do you know if Randoop is using direct I/O? Maybe it is instrumenting 
JDK classes to use aligned slices? Or maybe it is using the internal 
buffer cache directly?

-Alan


More information about the nio-dev mailing list