Closed Bug 1814712 Opened 2 years ago Closed 2 years ago

Server-initiated close with code and reason are received by neqo, but not forwarded to WebTransport

Categories

(Core :: Networking: HTTP, defect, P2)

defect

Tracking

()

RESOLVED FIXED
112 Branch
Tracking Status
firefox112 --- fixed

People

(Reporter: jesup, Assigned: edgul)

References

(Blocks 2 open bugs)

Details

(Whiteboard: [necko-triaged])

Attachments

(2 files)

When running close.https.any.js wpt test, the server-initiated close tests timeout in neqo. neqo receives the close with correct code and reasons and logs it:

2023-02-02 18:31:53.141258 UTC - [Parent 3562716: Socket Thread]: V/neqo_http3::* [neqo_http3::features::extended_connect::webtransport_session] [WebTransportSession session=0] Received frame: Some(CloseSession { error: 32, message: "abc" }) fin=true

However, it appears to not actually close the connection and eventually times out in quic and reports a session closed with code 0, "".

2023-02-02 18:32:23.154016 UTC - [Parent 3562716: Socket Thread]: I/neqo_transport::* [neqo_transport::connection] [Client e491d119683eed278e835af3dd93ef20723ace] idle timeout expired

Requires all my patches up for review, plus a few fixes from kershaw
run with :
./mach wpt --enable-webtransport-h3 testing/web-platform/tests/webtransport/close.https.any.js

Attached file timeout log

Starts at the test in question, ends after the timeout and when it's reported to WebTransportParent

Severity: -- → S3
Priority: -- → P2
Whiteboard: [necko-triaged]

Ed, Sunil - this is another bug one of you could take

Flags: needinfo?(smayya)
Flags: needinfo?(edgul)

It looks like the Http3Server is not sending any info back to the client for SessionClosed ServerEvent.
https://searchfox.org/mozilla-central/rev/5ccb73c0217d1710b10d6e6e297cf3396d10ec23/netwerk/test/http3server/src/main.rs#487-496

I suspect we just need some kind of session.response here.
I also suspect this is related to or duplicate of Bug 1816143.

Assignee: nobody → edgul
Flags: needinfo?(smayya)
Flags: needinfo?(edgul)

Hey Randell,

I'm seeing:

  • only the occasional timeout error.
  • more commonly FAIL server initiated closure with code and reason - promise_test: Unhandled rejection with value: object "WebTransportError: WebTransport connection rejected" on close.https.any.html
  • more commonly FAIL server initiated closure with code and reason - assert_equals: code expected 32 but got 0 on close.https.any.worker.html

Curious:

  1. Did you noticed this as being intermittent at all?
  2. Were you testing only with close.https.any.html or the workers or both?
Flags: needinfo?(rjesup)

(In reply to Ed Guloien [:edgul] from comment #4)

Hey Randell,

I'm seeing:

  • only the occasional timeout error.
  • more commonly FAIL server initiated closure with code and reason - promise_test: Unhandled rejection with value: object "WebTransportError: WebTransport connection rejected" on close.https.any.html
  • more commonly FAIL server initiated closure with code and reason - assert_equals: code expected 32 but got 0 on close.https.any.worker.html

Curious:

  1. Did you noticed this as being intermittent at all?
  2. Were you testing only with close.https.any.html or the workers or both?

I've noticed this error and I am going to submit a patch in bug 1816439 to fix it.

In addition, I can get the close code and reason here with the following code:

diff --git a/netwerk/protocol/http/Http3Session.cpp b/netwerk/protocol/http/Http3Session.cpp
index 5608a8426d1a7..4ad5cc3e52442 100644
--- a/netwerk/protocol/http/Http3Session.cpp
+++ b/netwerk/protocol/http/Http3Session.cpp
@@ -703,8 +703,13 @@ nsresult Http3Session::ProcessEvents() {
             // TODO read status and reason properly.
             // TODO we do not hanlde the case when a WebTransport session stream
             // is closed before headers are send.
-            nsCString reason = ""_ns;
-            wt->OnSessionClosed(0, reason);
+            SessionCloseReasonExternal& reasonExternal =
+                event.web_transport._0.session_closed.reason;
+            nsCString reason(reinterpret_cast<const char*>(data.Elements()),
+                             data.Length());
+            LOG(("reason.tag=%d err=%lld data=%s\n", reasonExternal.tag,
+                 reasonExternal.error._0, reason.get()));
+            wt->OnSessionClosed(reasonExternal.error._0, reason);
           } break;
           case WebTransportEventExternal::Tag::NewStream: {
             LOG(

Note that we might want to check the tag value to differentiate the close reason.

Flags: needinfo?(rjesup)

Note that we might want to check the tag value to differentiate the close reason.

Do you mean feed the OnSesssionClosed first parameter conditionally?

Ie:

  • if error -> reasonExtrenal.error._0
  • if status -> reasonExtrenal.status._0
  • if clean -> reasonExtrenal.clean._0

If so will the second parameter always be directly from data?

Flags: needinfo?(kershaw)

(In reply to Ed Guloien [:edgul] from comment #6)

Note that we might want to check the tag value to differentiate the close reason.

Do you mean feed the OnSesssionClosed first parameter conditionally?

Ie:

  • if error -> reasonExtrenal.error._0
  • if status -> reasonExtrenal.status._0
  • if clean -> reasonExtrenal.clean._0

Yes.

If so will the second parameter always be directly from data?

No, the data only contains value when the tag is Clean.

Flags: needinfo?(kershaw)
Duplicate of this bug: 1816143
Blocks: 1793822
Pushed by eguloien@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6b49ea08ffb1 Added code and reason forwarding to necko WebTransport from neqo on server-initiated close. r=kershaw,necko-reviewers

Backed out for causing build bustages on Http3Session.cpp

  • Backout link
  • Push with failures
  • Failure Log
  • Failure line: /builds/worker/checkouts/gecko/netwerk/protocol/http/Http3Session.cpp:728:73: error: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
Flags: needinfo?(edgul)

Thanks, fixed and trying again.

Flags: needinfo?(edgul)
Pushed by eguloien@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3a9c67c6d582 Added code and reason forwarding to necko WebTransport from neqo on server-initiated close. r=kershaw,necko-reviewers

Backed out for causing bustages on Logging.h

[task 2023-02-22T23:17:45.875Z] 23:17:45     INFO -  In file included from /builds/worker/workspace/obj-build/dist/include/mozilla/MozPromise.h:13:0,
[task 2023-02-22T23:17:45.876Z] 23:17:45     INFO -                   from /builds/worker/workspace/obj-build/ipc/ipdl/_ipdlheaders/mozilla/net/PNecko.h:15,
[task 2023-02-22T23:17:45.876Z] 23:17:45     INFO -                   from /builds/worker/workspace/obj-build/ipc/ipdl/_ipdlheaders/mozilla/net/PNeckoChild.h:9,
[task 2023-02-22T23:17:45.876Z] 23:17:45     INFO -                   from /builds/worker/workspace/obj-build/dist/include/mozilla/net/NeckoChild.h:11,
[task 2023-02-22T23:17:45.877Z] 23:17:45     INFO -                   from /builds/worker/checkouts/gecko/netwerk/protocol/http/HttpLog.h:20,
[task 2023-02-22T23:17:45.877Z] 23:17:45     INFO -                   from /builds/worker/checkouts/gecko/netwerk/protocol/http/ConnectionHandle.cpp:7,
[task 2023-02-22T23:17:45.877Z] 23:17:45     INFO -                   from Unified_cpp_protocol_http1.cpp:2:
[task 2023-02-22T23:17:45.878Z] 23:17:45     INFO -  /builds/worker/checkouts/gecko/netwerk/protocol/http/Http3Session.cpp: In member function 'nsresult mozilla::net::Http3Session::ProcessEvents()':
[task 2023-02-22T23:17:45.878Z] 23:17:45    ERROR -  /builds/worker/workspace/obj-build/dist/include/mozilla/Logging.h:290:61: error: format '%d' expects argument of type 'int', but argument 4 has type 'mozilla::net::SessionCloseReasonExternal::Tag' [-Werror=format=]
[task 2023-02-22T23:17:45.878Z] 23:17:45     INFO -                                      MOZ_LOG_EXPAND_ARGS _args); \
[task 2023-02-22T23:17:45.878Z] 23:17:45     INFO -                                                               ^
[task 2023-02-22T23:17:45.879Z] 23:17:45     INFO -  /builds/worker/checkouts/gecko/netwerk/protocol/http/HttpLog.h:56:3: note: in expansion of macro 'MOZ_LOG'
[task 2023-02-22T23:17:45.879Z] 23:17:45     INFO -     MOZ_LOG(mozilla::net::gHttpLog, mozilla::LogLevel::Verbose, args)
[task 2023-02-22T23:17:45.879Z] 23:17:45     INFO -     ^~~~~~~
[task 2023-02-22T23:17:45.880Z] 23:17:45     INFO -  /builds/worker/checkouts/gecko/netwerk/protocol/http/Http2StreamTunnel.cpp:12:19: note: in expansion of macro 'LOG5'
[task 2023-02-22T23:17:45.880Z] 23:17:45     INFO -   #define LOG(args) LOG5(args)
[task 2023-02-22T23:17:45.880Z] 23:17:45     INFO -                     ^~~~
[task 2023-02-22T23:17:45.880Z] 23:17:45     INFO -  /builds/worker/checkouts/gecko/netwerk/protocol/http/Http3Session.cpp:728:13: note: in expansion of macro 'LOG'
[task 2023-02-22T23:17:45.881Z] 23:17:45     INFO -               LOG(("reason.tag=%d err=%u data=%s\n", reasonExternal.tag, status,
[task 2023-02-22T23:17:45.881Z] 23:17:45     INFO -               ^
[task 2023-02-22T23:17:45.881Z] 23:17:45     INFO -  cc1plus: all warnings being treated as errors
[task 2023-02-22T23:17:45.882Z] 23:17:45    ERROR -  gmake[4]: *** [/builds/worker/checkouts/gecko/config/rules.mk:668: Unified_cpp_protocol_http1.o] Error 1
Flags: needinfo?(edgul)
Pushed by eguloien@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/fcd13a88d899 Added code and reason forwarding to necko WebTransport from neqo on server-initiated close. r=kershaw,necko-reviewers
Flags: needinfo?(edgul)
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 112 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: