Repository navigation
Don't cache CanReuse value - #35575
Conversation
| // This ensures Http2OutputProducer.ProcessDataWrites is in the correct state to be reused. | ||
| public bool CanReuse => !_connectionAborted && HasResponseCompleted; | ||
|
|
||
| protected override void OnReset() |
There was a problem hiding this comment.
Would resetting the value to false in OnReset accomplish the same goal?
There was a problem hiding this comment.
The line on 44 was effectively doing that before. The issue was that !_connectionAborted && HasResponseCompleted was being evaluated too early on a background thread and a RST_STREAM frame could still be processed and abort the stream before pooling. Now CanReuse is evaluated once in the main frame-processing loop right before it's pooled or not.
JamesNK
left a comment
There was a problem hiding this comment.
Please add a unit test. This is subtle behavior and we want to ensure it isn't regressed in the future.
Where is _connectionAborted set to true? Will it always happen before the stream is pooled? I want to make sure there is no chance that a stream is pooled and then some code aborts it while it is in the pool.
When the RST_STREAM is processed. |
I would also love that if you find a good way to do it @JamesNK. The problem is the This would be easy enough to do by adding some sort of event/resettable-Task we could hook in the tests when |
|
Ok. If we can't add a unit test then we should comment. Something like:
|
|
Nice catch! |
|
Why is this is main and not rc1? |
|
@davidfowl merge to main, then backport to rc1 (standard procedure I believe) |
|
/backport to release/6.0-rc1 |
|
Started backporting to release/6.0-rc1: https://github.com/dotnet/aspnetcore/actions/runs/1164353234 |
Fixes #34768
Regression?
Risk
Worst case is that Http2 streams are pooled less often.
Verification
Packaging changes reviewed?