-
Notifications
You must be signed in to change notification settings - Fork 645
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
Tar reader stuck with certain files and chunk sizes #2698
Conversation
Cannot share repeating tar files but when reading certain tar files the stage would get stuck waiting for more data to be pushed but without having pulled upstream to actually get the next chunk.
a5471cc
to
62a9d9b
Compare
@@ -37,12 +36,15 @@ private[file] class TarReaderStage | |||
extends SubSourceOutlet[ByteString]("fileOut") | |||
with TarReaderStage.SourceWithTimeout | |||
|
|||
readHeader(ByteString.empty) | |||
setHandlers(flowIn, flowOut, new CollectHeader(ByteString.empty)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't do a pull in the constructor, only set handlers, so instead of calling readHeader
we set collect handlers here directly, we anyway know the buffer is empty.
|
||
def readHeader(buffer: ByteString): Unit = { | ||
if (buffer.length >= TarArchiveEntry.headerLength) { | ||
readFile(buffer) | ||
} else setHandlers(flowIn, flowOut, new CollectHeader(buffer)) | ||
} else { | ||
if (!hasBeenPulled(flowIn)) pull(flowIn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the problematic files/chunk size scenario we'd get here, without flowIn
being pulled, and then switch to CollectHeader
waiting to get the next chunk.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Cannot share repeating tar files (from customer) and did not figure out how to create a repeating file safe to share, but when reading certain tar files the stage would get stuck waiting for more data to be pushed but without having pulled upstream to actually get the next chunk.
References #2697