Fix bug with increment read window #535
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue:
Turns out, if
aws_channel_slot_increment_read_window()was called while the "window update task" was running, the "window update task" would not get rescheduled to run again.I was writing read-window-update tests for the python WebSocket bindings, and the test was failing as the read window approached 0. Here's how it played out:
Description of changes:
Fix rescheduling logic for "window update task"
Rant about tests:
I lost a few hours trying to add a regression test here in aws-c-io. First, I tried adding to the existing
socket_handler_echo_and_backpressuretest to reproduce my issue, but it didn't fail! Turns out, the bug can only occur when you have 3+ handlers in the channel. Then I started modifying theread_write_test_handlerso that it could serve as a proper "midchannel" handler that buffers up frames if necessary before sending them downstream. Then realized this would be more work complex than making a new type of test-handler that solely functions as a midchannel handler. Then realized at this point we'd be better off adding true integration tests for websocket that exercise the REAL stack of handlers, instead of a bunch of test handlers. Then realized this would take days, and I already had the new python tests I was working on that exercise the real stack of handlers... so yeah. I'll just rely on the tests I'm adding in aws-crt-python for now, but we should probably add integration tests in aws-c-http someday.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.