You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-dev@hadoop.apache.org by "Colin Patrick McCabe (JIRA)" <ji...@apache.org> on 2012/06/03 22:06:23 UTC

[jira] [Created] (HDFS-3492) fix some misuses of InputStream#skip

Colin Patrick McCabe created HDFS-3492:
------------------------------------------

             Summary: fix some misuses of InputStream#skip
                 Key: HDFS-3492
                 URL: https://issues.apache.org/jira/browse/HDFS-3492
             Project: Hadoop HDFS
          Issue Type: Bug
         Environment: It seems that we have a few cases where programmers are calling InputStream#skip and not handling "short skips."  Unfortunately, the skip method is documented and implemented so that it doesn't actually skip the requested number of bytes, but simply tries to skip at most that amount of bytes.  A better name probably would have been trySkip or similar.

It seems like most of the time when the argument to skip is small enough, we'll succeed almost all of the time.  This is no doubt an implementation artifact of some of the popular stream implementations.  This tends to hide the bug-- however, it is still waiting to emerge at some point if those implementations ever change or if buffer sizes are adjusted, etc.

All of these cases can be fixed by calling IOUtils#skipFully to get the behavior that the programmer expects-- i.e., skipping by the specified amount.
            Reporter: Colin Patrick McCabe
            Assignee: Colin Patrick McCabe
            Priority: Minor




--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Reopened] (HDFS-3492) fix some misuses of InputStream#skip

Posted by "Todd Lipcon (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HDFS-3492?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Todd Lipcon reopened HDFS-3492:
-------------------------------


This actually seems to have broken TestShortCircuitLocalRead. Looking more closely at the QA results above, it didn't even run the HDFS tests (perhaps because of the cmake issues). I will revert this.
                
> fix some misuses of InputStream#skip
> ------------------------------------
>
>                 Key: HDFS-3492
>                 URL: https://issues.apache.org/jira/browse/HDFS-3492
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: Colin Patrick McCabe
>            Assignee: Colin Patrick McCabe
>            Priority: Minor
>             Fix For: 2.0.1-alpha
>
>         Attachments: HDFS-3492.001.patch
>
>
> It seems that we have a few cases where programmers are calling InputStream#skip and not handling "short skips."  Unfortunately, the skip method is documented and implemented so that it doesn't actually skip the requested number of bytes, but simply tries to skip at most that amount of bytes.  A better name probably would have been trySkip or similar.
> It seems like most of the time when the argument to skip is small enough, we'll succeed almost all of the time.  This is no doubt an implementation artifact of some of the popular stream implementations.  This tends to hide the bug-- however, it is still waiting to emerge at some point if those implementations ever change or if buffer sizes are adjusted, etc.
> All of these cases can be fixed by calling IOUtils#skipFully to get the behavior that the programmer expects-- i.e., skipping by the specified amount.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira