Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.11
-
None
-
3
-
d98fd12ca (dev), a79c09d3b (6.10), 4b54ab7e3 (6.9), 499a1ccc0 (tqtc/lts-6.8)
Description
It was observed that the stream was not calling "sendRST_STREAM" in its destructor.
Consider following case:
stream->sendHEADERS(initialHeaders, false)
stream->sendDATA(message, closeStream) with closeStream = true
Now the stream is in "State::HalfClosedLocal" state. Note that "QHttp2Stream::headersReceived" has not been received yet. If this stream dies for whatever reason it will result in an connection error as it's destructor removed it from the m_streams member but didn't sent any RST_STREAM due to its state:
QHttp2Stream::~QHttp2Stream() noexcept { if (auto *connection = getConnection()) { if (m_state == State::Open || m_state == State::HalfClosedRemote) { ... // Check if we can still send data, then send RST_STREAM: if (connection->getSocket()) { if (isUploadingDATA()) sendRST_STREAM(CANCEL); else sendRST_STREAM(HTTP2_NO_ERROR); } } connection->m_streams.remove(streamID()); } }
Now the code that handles the received headers will not find the stream (it's not marked as reset locally due to the missing call):
} else if (auto it = m_streams.constFind(streamID); it == m_streams.cend()) { // RFC 9113, 6.2: HEADERS frames MUST be associated with a stream. // A connection error is not required but it seems to be the right thing to do. qCDebug(qHttp2ConnectionLog, "[%p] Received HEADERS on non-existent stream %d", this, streamID); return connectionError(PROTOCOL_ERROR, "HEADERS on invalid stream"); }