Improve Http3 closing
Categories
(Core :: Networking: HTTP, enhancement, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox76 | --- | fixed |
People
(Reporter: dragana, Assigned: dragana)
References
(Blocks 1 open bug)
Details
(Whiteboard: [necko-triaged])
Attachments
(2 files)
Http3 is a bit tricky in the regard of closing a connection. There are a couple of ways this can happen:
- a socket error
- a Firefoxshutdown
- a neqo error
- http3 timeout
- necko closing connection without a shutdown
Assignee | ||
Comment 1•4 years ago
|
||
This is explainer how this should work:
Socket error:
mSocketError will be set.
ProcessInput or ProcessOutput will return an error and their callers will close connection by calling CloseTransaction(the name is because of compatibility with http1.1)
Their callers are:
- HttpConnectionUDP::OnInputStreamReady -> HttpConnectionUDP::OnSocketReadable -> Http3Session::WriteSegmentsAgain -> ProcessInput
HttpConnectionUDP::OnQuicTimeoutExpired - HttpConnectionUDP::OnQuicTimeoutExpired -> ProcessOutput
- HttpConnectionUDP::OnOutputStreamReady -> HttpConnectionUDP::OnSocketWritable -> Http3Session::ReadSegmentsAgain -> ProcessOutput
CloseTransaction will call mHttp3Session->Close. Because this is a socket error we do not need to try to send any CLOSE_CONNECTION frame, we can just close neqo and remove references.
Firefox Shutdown:
on shutdown CloseTransaction will be called with aIsShutdown set. This will also close Http3Session and remove any reference. A CLOSE_CONNECTION frame will not be sent.
Neqo error:
A Http3Event::Tag::ConnectionClosing event will be received from neqo. mError will be set to NS_ERROR_NET_HTTP3_PROTOCOL_ERROR (TODO, I think this is fine, buy may be revisited) and the same error will be return. A caller will closed the connection by calling CloseTransaction.
Callers are:
- HttpConnectionUDP::OnQuicTimeoutExpired -> ProcessEvents
- HttpConnectionUDP::OnInputStreamReady -> HttpConnectionUDP::OnSocketReadable -> Http3Session::WriteSegmentsAgain -> ProcessInput
In this case will close Http3Session, but we will keep Http3Session and HttpConnectionUDP still in nsHttpConnectiomMgr's active list. The connection is in the active list but it will not be used for any transaction.
There are a couple of ways it will be removed from the list:
- After a neqo timeout a Http3Event::Tag::ConnectionClosed event will be received. This event be read in one of 2 paths above(moste probably from OnQuicTimeoutExpired). This will try to close http3 session again and this time the http3Session will change into CLOSED state and it will delete all reference.
- There is a shutdown: CloseTransaction will be called with aIsShutdown set. This will also close Http3Session and remove any reference.
Http3 timeout:
A Http3Event::Tag::ConnectionClosed event will be received (without receiving a Http3Event::Tag::ConnectionClosing event).
A caller will closed the connection by calling CloseTransaction.
Callers are:
- HttpConnectionUDP::OnQuicTimeoutExpired -> ProcessEvents
- HttpConnectionUDP::OnInputStreamReady -> HttpConnectionUDP::OnSocketReadable -> Http3Session::WriteSegmentsAgain -> ProcessInputCloseTransaction will call mHttp3Session->Close. Because this is a timeout and neqo has been closed already we can just remove references.
necko closing connection without a shutdown:
CloseTransaction will call mHttp3Session->Close. In this case will close Http3Session, but we will keep Http3Session and HttpConnectionUDP still in nsHttpConnectiomMgr's active list. The connection is in the active list but it will not be used for any transaction.
There are a couple of ways it will be removed from the list:
- After a neqo timeout a Http3Event::Tag::ConnectionClosed event will be received. This event be read in one of 2 paths above(most probably from OnQuicTimeoutExpired). This will try to close http3 session again and this time the http3Session will change into/ CLOSED state and it will delete all reference.
- There is a shutdown: CloseTransaction will be called with aIsShutdown set. This will also close Http3Session and remove any reference.
Assignee | ||
Comment 2•4 years ago
|
||
Assignee | ||
Comment 3•4 years ago
|
||
Updated•4 years ago
|
Pushed by ddamjanovic@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/bf921cb07c7d Make closing of http3 connection more understandable and remove some unused code. r=mayhemer
Pushed by ddamjanovic@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/bb6a227ceda7 Check that Http3Session is present in HttpConnectionUDP::CloseTransaction. r=kershaw
Comment 6•4 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/bf921cb07c7d
https://hg.mozilla.org/mozilla-central/rev/bb6a227ceda7
Description
•