Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A few bugs in RecordIO #9239

Closed
JiayiFeng opened this issue Mar 20, 2018 · 0 comments · Fixed by #9240
Closed

A few bugs in RecordIO #9239

JiayiFeng opened this issue Mar 20, 2018 · 0 comments · Fixed by #9240

Comments

@JiayiFeng
Copy link
Collaborator

JiayiFeng commented Mar 20, 2018

  1. Issue 1:
    bool Header::Parse(std::istream& is) {
    uint32_t magic;
    size_t read_size =
    is.readsome(reinterpret_cast<char*>(&magic), sizeof(uint32_t));
    if (read_size < sizeof(uint32_t)) {
    return false;
    }
    PADDLE_ENFORCE_EQ(magic, kMagicNumber);

readsome can only read a file from the buffer. But here is the first time we read from is, so it is possible that the file is not in the buffer and we can read nothing.

  1. Issue 2:
    void Scanner::Reset() {
    stream_->seekg(0, std::ios::beg);
    ParseNextChunk();
    }

Before seekg(), we shall invoke stream_->clear() to clear steam's flags.

@JiayiFeng JiayiFeng changed the title A bug in RecordIO A few bugs in RecordIO Mar 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant