[ 
https://issues.apache.org/jira/browse/HADOOP-17382?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17235766#comment-17235766
 ] 

Chen Liang commented on HADOOP-17382:
-------------------------------------

Thanks for the clarification [[email protected]]!

We checked the application code, turns out it's actually {{skip()}} that caused 
the error. Although skip and seek seems to share very similar logic.

(The current check in skip call in AbfsInputStream is as below, similar to seek
{code:java}
    if (currentPos == contentLength) {
      if (n > 0) {
        throw new EOFException(FSExceptionMessages.CANNOT_SEEK_PAST_EOF);
      }
    }
{code}
)

We encountered problem when using {{TarArchiveInputStream}} from 
{{org.apache.commons}}, where it seems to try to skip to past the end when 
{{getNextTarEntry}} is called. This could also be considered a bug in 
{{TarArchiveInputStream}} itself. But we didn't have issue before running on 
AbfsInputStream. So was thinking of if we should the behavior of 
AbfsInputStream#skip (and seek)

> AbfsInputStream#seek throws EOFException when seek past the end of stream
> -------------------------------------------------------------------------
>
>                 Key: HADOOP-17382
>                 URL: https://issues.apache.org/jira/browse/HADOOP-17382
>             Project: Hadoop Common
>          Issue Type: Improvement
>            Reporter: Chen Liang
>            Priority: Major
>              Labels: azure
>
> Currently AbfsInputStream#seek has below check:
> {code}
> public synchronized void seek(long n) throws IOException {
> ...
> if (n > contentLength) {
>  throw new EOFException(FSExceptionMessages.CANNOT_SEEK_PAST_EOF);
> }
> ...
> }
> {code}
> So if a the seek is called with a position past the end of the stream, a 
> EOFException gets thrown. However, it appears to me this behavior is 
> different from some other inputstream impls, such as \{{S3AInputStream}} and 
> \{{LocalFSFileInputStream}}, where seek passing the end is allowed, only that 
> a later read call will return -1 indicating EOF. I think it would be better 
> to have AbfsInputStream do the same thing.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to