sebastiangraf / jSCSI

A Java iSCSI Framework
http://jscsi.org
BSD 3-Clause "New" or "Revised" License
63 stars 29 forks source link

JCloudsStorageModule is not closing blob file. #15

Closed felipegutierrez closed 9 years ago

felipegutierrez commented 9 years ago

I think I found a issue at JCloudsStorageModule (http://grepcode.com/file/repo1.maven.org/maven2/org.jscsi/target/2.5.2/org/jscsi/target/storage/JCloudsStorageModule.java?av=f), it is not closing the "data = ByteStreams.toByteArray(blob.getPayload().getInput());"

if you guys agree it could be change to : data = ByteStreams2.toByteArrayAndClose(blob.getPayload().getInput());

or

InputStream inputStream = null; try { inputStream = blob.getPayload().getInput(); data = ByteStreams.toByteArray(inputStream); } finally { if (inputStream != null) { inputStream.close(); } }

I got this error "too many files open" when I was testing a 400Gb copy.