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

make carv2 SectionReaders gracefully reject operations after closure #211

Closed
raulk opened this issue Aug 19, 2021 · 2 comments · Fixed by #212
Closed

make carv2 SectionReaders gracefully reject operations after closure #211

raulk opened this issue Aug 19, 2021 · 2 comments · Fixed by #212
Assignees

Comments

@raulk
Copy link
Member

raulk commented Aug 19, 2021

Right now, if they receive a read after a closure, they panic. See filecoin-project/lotus#7111.

We made the blockstores handle closures gracefully here: #195. We should do the same for standard car IO, so that these readers behave just like any other IO in Go (e.g. file IO, network IO, etc.)

masih added a commit that referenced this issue Aug 19, 2021
Write a test that asserts reader instantiated from `OpenReader` do not
panic and instead error gracefully if underlying IO is closed.

Relates to #211
masih added a commit that referenced this issue Aug 19, 2021
Write a test that asserts reader instantiated from `OpenReader` do not
panic and instead error gracefully if underlying IO is closed.

Relates to #211
@masih masih self-assigned this Aug 19, 2021
@masih
Copy link
Member

masih commented Aug 19, 2021

#212 asserts that reading from readers instantiated by carv2.OpenReader do not panic after the Reader is Closeed.

This leaves me to believe that if such panic occurs in lotus, bubbling up through a carv2.Reader, the Reader must have been instantiated using carv2.NewReader which takes an io.ReaderAt. In which case, the given io.ReaderAt must not be handling reads after closure gracefully; the fix for which would fall beyond the realms of go-car/v2.

As for SectionReader implementations, none implement Closer and delegate read-write to some underlaying reader.

@raulk please shout if I have missed anything.

@raulk
Copy link
Member Author

raulk commented Aug 19, 2021

Thanks @masih for the quick turnaround. Closing this as the issue is related to NewReader with a supplied mmapped region.

@raulk raulk closed this as completed Aug 19, 2021
masih added a commit that referenced this issue Aug 20, 2021
Write a test that asserts reader instantiated from `OpenReader` do not
panic and instead error gracefully if underlying IO is closed.

Relates to #211
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.

2 participants