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

Stream stalled if the remaining window size is less than MAX_HTTP_PAYLOAD_SIZE #25

Closed
tatsuhiro-t opened this issue Aug 9, 2013 · 4 comments
Labels

Comments

@tatsuhiro-t
Copy link

This is pathological case, but if the remaining window size is less than MAX_HTTP_PAYLOAD_SIZE, and it is not the last piece of response, the response stream is stalled.
It can be reproducible using nghttp with -w13 and response file size is bigger than that.

@molnarg
Copy link
Owner

molnarg commented Aug 11, 2013

I've solved this with a better heuristic algorithm for chunking that tries to achieve equally sized chunks that are smaller than the initial window size (and MAX_HTTP_PAYLOAD_SIZE), but probably needs more work in the future.

@tatsuhiro-t
Copy link
Author

So if there is 99 bytes window left, then dead lock still occurs. Why do
you just cut the first min(remaining_window, MAX_HTTP_PAYLOAD_SIZE,
buffer.size) bytes of buffer and send it?

@molnarg
Copy link
Owner

molnarg commented Aug 12, 2013

Sounds good, but I feel like deadlocks will be possible even then... The best thing would be maybe to postpone chunking until before sending out the next chunk (lazy chunking). The next chunk size would be determined by the function you mentioned, and then next chunk size with the same function etc. And when window runs out, stop until there's window available again.

@molnarg molnarg reopened this Aug 12, 2013
@molnarg
Copy link
Owner

molnarg commented Aug 12, 2013

Solved in bd7886b.

@molnarg molnarg closed this as completed Aug 12, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants