Skip to content

[20.10 backport] Fix handling for json-file io.UnexpectedEOF #42174

Merged
thaJeztah merged 2 commits into
moby:20.10from
thaJeztah:20.10_backport_41820_fix_json_unexpected_eof
Mar 20, 2021
Merged

[20.10 backport] Fix handling for json-file io.UnexpectedEOF #42174
thaJeztah merged 2 commits into
moby:20.10from
thaJeztah:20.10_backport_41820_fix_json_unexpected_eof

Conversation

@thaJeztah

Copy link
Copy Markdown
Member

backport of #42104

Before this, we essentially end up doubling any buffered data from the
json decoder by storing it in both d.dec and d.rdr.

Thanks @tobiasstadler for pointing this error out.

Fixes #41820

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

When the multireader hits EOF, we will always get EOF from it, so we
cannot store the multrireader fro later error handling, only for the
decoder.

Thanks @tobiasstadler for pointing this error out.

Signed-off-by: Brian Goff <[email protected]>
(cherry picked from commit 4be98a3)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Tonis mentioned that we can run into issues if there is more error
handling added here. This adds a custom reader implementation which is
like io.MultiReader except it does not cache EOF's.
What got us into trouble in the first place is `io.MultiReader` will
always return EOF once it has received an EOF, however the error
handling that we are going for is to recover from an EOF because the
underlying file is a file which can have more data added to it after
EOF.

Signed-off-by: Brian Goff <[email protected]>
(cherry picked from commit 5a664dc)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah

Copy link
Copy Markdown
Member Author

@cpuguy83 @tonistiigi ptal

@cpuguy83 cpuguy83 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thaJeztah
thaJeztah merged commit 5a697ae into moby:20.10 Mar 20, 2021
@thaJeztah
thaJeztah deleted the 20.10_backport_41820_fix_json_unexpected_eof branch March 20, 2021 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants