RFR: JDK-8241883: (zipfs) SeekableByteChannel:close followed by SeekableByteChannel:close will throw an NPE

Lance Andersen lance.andersen at oracle.com
Tue Apr 7 20:11:08 UTC 2020



> On Apr 7, 2020, at 3:30 PM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
> 
> On 07/04/2020 17:18, Lance Andersen wrote:
>> Hi all,
>> 
>> Please review the fix for JDK-8241883, which addresses an issue with Zip FS where multiple calls to SeekableByteChannel::close results in an NPE.
>> 
>> This issue was discovered while adding the additional Zip FS test coverage for FileChannel and SeekableByteChannel
>> 
>> Here is the diff for the patch:
>> ——————————
>> $ hg diff
>> diff -r f4c174bf0276 src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java
>> --- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java      Tue Apr 07 09:03:05 2020 -0400
>> +++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java      Tue Apr 07 11:38:29 2020 -0400
>> @@ -892,6 +892,10 @@
>>  
>>          @Override
>>          public void close() throws IOException {
>> +            // Check to see if close() has been previously called
>> +            if(!isOpen()) {
>> +                return;
>> +            }
>>              // will update the entry
>>              try (OutputStream os = getOutputStream(e)) {
>>                  os.write(toByteArray());
>> 
> How robust is async close in the zip file system? Just wondering how it works when a SeekableByteChannel is being accessed in one thread when the zip file system is closed by another.

I can look to add some tests going forward as I am not sure we have any existing tests
Best
Lance

> 
> -Alan.

 <http://oracle.com/us/design/oracle-email-sig-198324.gif>
 <http://oracle.com/us/design/oracle-email-sig-198324.gif> <http://oracle.com/us/design/oracle-email-sig-198324.gif>
 <http://oracle.com/us/design/oracle-email-sig-198324.gif>Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering 
1 Network Drive 
Burlington, MA 01803
Lance.Andersen at oracle.com <mailto:Lance.Andersen at oracle.com>



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20200407/6013fc44/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: oracle_sig_logo.gif
Type: image/gif
Size: 658 bytes
Desc: not available
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20200407/6013fc44/oracle_sig_logo-0001.gif>


More information about the nio-dev mailing list