[ 
https://issues.apache.org/jira/browse/VFS-505?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robbie Haertel updated VFS-505:
-------------------------------

          Description: 
This is probably the same issue as 
https://issues.apache.org/jira/browse/VFS-350, but for version 2.0 and for the 
.tar reader.

The problem: After successfully reading some files from the .tar, I 
unexpectedly get:

{noformat}

Caused by: java.io.IOException: reading from an output buffer
at org.apache.commons.vfs2.provider.tar.TarBuffer.readRecord(TarBuffer.java:211)
at 
org.apache.commons.vfs2.provider.tar.TarInputStream.read(TarInputStream.java:384)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:273)
at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
at 
org.apache.commons.vfs2.util.MonitorInputStream.read(MonitorInputStream.java:100)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:283)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:325)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at com.google.common.io.LineReader.readLine(LineReader.java:76)
at edu.byu.nlp.io.LineReaderIterator.readLineQuietly(LineReaderIterator.java:31)

{noformat}

Note that I have several read-only streams open on the same .tar file. The are 
being read on the same thread, but reads to different files are interleaved. 
Even more interesting is that the same code path works fine when only reading a 
small subset of the data (this, too, includes interleaving reads to different 
files in the same .tar file). It may be a function of the number of bytes read.

Note that I do NOT have any files open for writing.

  was:
I can turn this into a test case if needed.

A source snippet:

{noformat}

FileObject annotations = root.getChild("annotations");
FileContent annotationsContent = annotations.getContent();
InputStream input = annotationsContent.getInputStream();
InputStreamReader isr = new InputStreamReader(input, Charset.forName("utf-8"));
BufferedReader lineReader = new BufferedReader(isr);
String line;
while ((line = lineReader.readLine()) != null) {
}




java.io.IOException: reading from an output buffer
        at 
org.apache.commons.vfs.provider.tar.TarBuffer.readRecord(TarBuffer.java:213)
        at 
org.apache.commons.vfs.provider.tar.TarInputStream.read(TarInputStream.java:386)
        at java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
        at 
org.apache.commons.vfs.util.MonitorInputStream.read(MonitorInputStream.java:74)
        at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)
        at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)
        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
        at java.io.InputStreamReader.read(InputStreamReader.java:167)
        at java.io.BufferedReader.fill(BufferedReader.java:136)
        at java.io.BufferedReader.readLine(BufferedReader.java:299)
        at java.io.BufferedReader.readLine(BufferedReader.java:362)
        at com.basistech.lsh.utils.TdtTestData.<init>(TdtTestData.java:130)
        at 
com.basistech.lsh.utils.TdtTestDataTest.testTestDataReader(TdtTestDataTest.java:36)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
        at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
        at 
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
        at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

{noformat}



    Affects Version/s:     (was: 1.0)
                       2.0

> Reading from an input stream in a .tar ends up with a 'reading from an output 
> buffer' exception
> -----------------------------------------------------------------------------------------------
>
>                 Key: VFS-505
>                 URL: https://issues.apache.org/jira/browse/VFS-505
>             Project: Commons VFS
>          Issue Type: Bug
>    Affects Versions: 2.0
>            Reporter: Robbie Haertel
>
> This is probably the same issue as 
> https://issues.apache.org/jira/browse/VFS-350, but for version 2.0 and for 
> the .tar reader.
> The problem: After successfully reading some files from the .tar, I 
> unexpectedly get:
> {noformat}
> Caused by: java.io.IOException: reading from an output buffer
> at 
> org.apache.commons.vfs2.provider.tar.TarBuffer.readRecord(TarBuffer.java:211)
> at 
> org.apache.commons.vfs2.provider.tar.TarInputStream.read(TarInputStream.java:384)
> at java.io.BufferedInputStream.read1(BufferedInputStream.java:273)
> at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
> at 
> org.apache.commons.vfs2.util.MonitorInputStream.read(MonitorInputStream.java:100)
> at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:283)
> at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:325)
> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177)
> at java.io.InputStreamReader.read(InputStreamReader.java:184)
> at com.google.common.io.LineReader.readLine(LineReader.java:76)
> at 
> edu.byu.nlp.io.LineReaderIterator.readLineQuietly(LineReaderIterator.java:31)
> {noformat}
> Note that I have several read-only streams open on the same .tar file. The 
> are being read on the same thread, but reads to different files are 
> interleaved. Even more interesting is that the same code path works fine when 
> only reading a small subset of the data (this, too, includes interleaving 
> reads to different files in the same .tar file). It may be a function of the 
> number of bytes read.
> Note that I do NOT have any files open for writing.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to