mozilla / neqo

Neqo, the Mozilla Firefox implementation of QUIC in Rust
https://firefox-source-docs.mozilla.org/networking/http/http3.html
Apache License 2.0
1.84k stars 123 forks source link

Server crashes on the 32767th connection. #1449

Open QUICTester opened 1 year ago

QUICTester commented 1 year ago

There is a hardcoded value in an assertion statement ("target/debug/build/neqo-crypto-a4be3db97961b0ce/out/nspr/pr/src/io/prlayer.c:619") causing the Neqo server only able to accepts up to 32767 connections (including the closed connections). After the 36767th connection, the server will crash with an assertion error. We know that the PRIntn data type used for PRDescIdentity is guaranteed to be 16-bits long. However, the PRIntn data type on our architecture is 32 bits long. Therefore, instead of using a hardcoded value, the assertion statement should use a dynamic value that follows the architecture (reference: https://firefox-source-docs.mozilla.org/nspr/reference/printn.html).

larseggert commented 6 months ago

This is the crash https://github.com/nss-dev/nspr/blob/dead7133d4535bf4fade1814dd8c261c01b76635/pr/src/io/prlayer.c#L619

Called from https://github.com/mozilla/neqo/blob/36fae6282b2214e4fea425ee4a952c08acf1c445/neqo-crypto/src/agent.rs#L329

martinthomson commented 6 months ago

I'm surprised that we can handle that many connections, but maybe we can tweak NSPR. The 16 bit era is long gone.

larseggert commented 6 months ago

Patch to NSPR in https://bugzilla.mozilla.org/show_bug.cgi?id=1890927