Open Bug 2079425 Opened 1 month ago Updated 1 month ago

WebTransport datagrams are silently dropped when outgoingMaxBufferedDatagrams is raised above about 200 full-size datagrams

Categories

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

defect

Tracking

()

People

(Reporter: jesup, Unassigned)

References

(Blocks 2 open bugs)

Details

(Whiteboard: [necko-triaged][necko-priority-next])

Attachments

(1 obsolete file)

When a page raises outgoingMaxBufferedDatagrams past what fits in neqo's per-session outgoing datagram byte budget (256KB, charged as payload plus 64 bytes per datagram: about 207 full-size datagrams, or about 2000 64-byte ones), datagrams are lost before they are sent, and nothing reports the loss.

Steps:

  1. Open a WebTransport session and set datagrams.outgoingMaxBufferedDatagrams = 1000.
  2. Write 10000 datagrams of datagrams.maxDatagramSize bytes, awaiting writer.ready before each write.

Result: on a loopback connection the server received 9601 of 10000. Every write promise resolved, and getStats().datagrams reported expiredOutgoing 0 and lostOutgoing 0. With the default of 5, all 10000 arrive.

Cause: DatagramQueue::enqueue returns Ok until a datagram no longer fits in the byte budget; that datagram is admitted by evicting the oldest queued one, returning Overflowed. The count limit Gecko sets from outgoingMaxBufferedDatagrams only produces MaxBufferedReached once the count is reached, so when the count limit is above what the byte budget holds, the first backpressure the DOM sees already cost a datagram, and the DOM keeps up to outgoingMaxBufferedDatagrams in flight, overrunning the queue repeatedly. The evictions also don't feed any WebTransportDatagramStats field.

Possible fixes: have neqo report backpressure (MaxBufferedReached) once the byte budget is nearly full rather than only after evicting; and/or clamp the count limit Gecko hands neqo to what the byte budget can hold for the session's max datagram size. Either way the evictions should be counted in the datagram stats.

The same thing affects any neqo user that relies on the byte budget alone without setting a count limit; the http3server flood path in the new WebTransport datagram perftest hit it first (avoided there by setting a count limit).

Blocks: 2079448

A write() resolved immediately whenever fewer than outgoingMaxBufferedDatagrams
were in flight, without checking the byte credit, so a large limit let content
send more than neqo's 256KB per-session queue holds; neqo then evicts the oldest
datagrams without reporting backpressure first. Resolve immediately only when
the datagram also fits in the byte credit.

The grant also mixed units: neqo's remaining_bytes charges each datagram its
allocation plus a fixed overhead, while both sides counted payload bytes.
Charge and retire with that overhead too, mirroring neqo's private
PER_DATAGRAM_OVERHEAD, and hold back one maximum-sized datagram from the byte
grant for the withheld write that has already sent its datagram, as the count
grant does. Send the first grant when the session becomes ready, so early
writes don't wait for one.

Blocks: WebTransport
Severity: -- → S3
Priority: -- → P2
Whiteboard: [necko-triaged][necko-priority-next]
Attachment #9655414 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: