Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@deweerdt
Copy link
Member

@deweerdt deweerdt commented Mar 5, 2019

h2o_http2_conn_unregister_stream wants _refs.link set if
the state is pending. However, when we sent GOAWAY (for
draining), we don't bother linking said struct member in
execute_or_enqueue_request_core. This fixes the issue by transitioning
the stream to END_STREAM in h2o_http2_stream_reset, making the
linking of _refs.link optional.

@kazuho
Copy link
Member

kazuho commented Mar 6, 2019

I'm confused.

Are you suggesting that we have a case where a stream is in REQ_PENDING state but not linked to h2o_http2_conn_t::_pending_reqs? If so, that might be the issue we should address. State should provide sufficient information on how the object looks like.

@deweerdt
Copy link
Member Author

deweerdt commented Mar 6, 2019

Are you suggesting that we have a case where a stream is in REQ_PENDING state but not linked to h2o_http2_conn_t::_pending_reqs? If so, that might be the issue we should address. State should provide sufficient information on how the object looks like.

That's right in https://github.com/h2o/h2o/blob/master/lib/http2/connection.c#L220 we might exit before linking the request to _pending_reqs because we sent a GOAWAY frame. Should this be fixed in execute_or_enqueue_request_core instead?

@kazuho
Copy link
Member

kazuho commented Mar 6, 2019

Should this be fixed in execute_or_enqueue_request_core instead?

I think so. Possibly by moving the code that resets the stream based on the comparison of stream ID and max_open outside of the function.

@deweerdt deweerdt force-pushed the h2o_http2_conn_unregister_stream-assert branch from 2229016 to 4540171 Compare March 7, 2019 00:38
@deweerdt
Copy link
Member Author

deweerdt commented Mar 7, 2019

@kazuho How does 4540171 look?

@kazuho
Copy link
Member

kazuho commented Mar 7, 2019

@deweerdt Looks fine, with the exception that I think we need to do the same for the other path that calls execute_or_enqueue_request_core.

Maybe we should create a function that detects stream IDs above the value sent in GOAWAY and resets a stream, then call the function from the two places that call execute_or_enqueue_request_core?

Honestly speaking I think there could be a better way to handle streams that we are ignoring. There's no need to buffer the request as we do now (though note that the server needs to maintain some state to avoid sending RST_STREAM in response to every frame it receives). But I think we can live with adjusting the current approach, at least for the time being.

`h2o_http2_conn_unregister_stream` wants `_refs.link` set if
the state is pending.  However, when we sent `GOAWAY` (for
draining), we don't bother linking said struct member in
`execute_or_enqueue_request_core`. This fixes the issue by not switching
the stream to `REQ_PENDING` if we're going to reset it.
@deweerdt deweerdt force-pushed the h2o_http2_conn_unregister_stream-assert branch from 4540171 to 156a70a Compare March 7, 2019 01:13
@deweerdt
Copy link
Member Author

deweerdt commented Mar 7, 2019

Maybe we should create a function that detects stream IDs above the value sent in GOAWAY and resets a stream, then call the function from the two places that call execute_or_enqueue_request_core?

Thank you for the suggestion, implemented in 156a70a

@kazuho kazuho merged commit 156a70a into h2o:master Mar 7, 2019
kazuho added a commit that referenced this pull request Mar 7, 2019
`h2o_http2_conn_unregister_stream` assert on shutdown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants