-
Notifications
You must be signed in to change notification settings - Fork 70
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
[auto_discovery] process templates larger than the page buffer size #145
Conversation
if(adPipe != null) { | ||
int offset = 0; | ||
byte[] buffer = new byte[0]; | ||
while (adPipe.available() > 0) { |
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.
Is there a possible race condition here where adPipe.available()
might return 0 after the read but before the writer is unblocked? Would it be safer to introduce a separator to look for?
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.
hmm good point, what do you think @truthbk?
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.
I'd have to look at the internals, I'm not sure. I haven't encountered issues while testing, but this is a valid point.
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! Feel free to merge once you've removed the unused variable ;)
byte[] buffer = new byte[len]; | ||
adPipe.read(buffer); | ||
if(adPipe != null) { | ||
int offset = 0; |
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.
you can remove this var
After taking a look at the internals, I believe @theduderog was indeed correct and we will need to use a separator to guarantee we know when no more data is expected in the iteration. Will have to fix that here, and in the
We have a single writer, so it'd be less problematic, that said, better safe than sorry - adding a separator/terminator. |
…hing in the pipe.
We must be able to process templates as large as necessary - customer encountered we were just processing 64K configurations at most when reading from the pipe - consistent with the default page buffer on linux. Let's read the entire buffer... Also, this is necessary to avoid blocking the writing side indefinitely.