Skip to content

QUIC/Webtransport: uncaught rejected promise when disconnect / timing out #28406

Open
@hironichu

Description

@hironichu

Version: Deno 2.2.X
Whenever we run a server and receive connections, the endpoint/listener will respect the time out amount and throw an exception: Error: timed out

This exception comes from the closed method (from my testing..)

Client code :

        const wt = new WebTransport("https://xxxxxx");
        await wt.ready;
        console.log(wt);
        wt.closed.then(() => console.log("Connection closed"));
        //wait 10 second and close the connection
        setTimeout(() => wt.close(), 10000);

Server code :

const cert = Deno.readTextFileSync("cert.pem");
const key = Deno.readTextFileSync("private.pem");

const server = new Deno.QuicEndpoint({
    hostname: "0.0.0.0",
    port: 443,
});
try {
    const listener = server.listen({
        cert,
        key,
        alpnProtocols: ["h3"],
    });
    try {
        console.log("waiting first connection");
        const nextCon = await listener.accept();
        const wt = await Deno.upgradeWebTransport(nextCon);
        await wt.ready;
        console.log("Client connected");
        wt.closed.then(() => {
            console.log("Client closed the connection");
            Deno.exit(0);
        });
    } catch {
        console.log("Something wrong happened");
    }
} catch {
    console.error("any catch error");
}

Image

The client auto disconnect after 10 seconds, tho the webtransport closed promise is never reached.

Image

Tried on 2.2.2 and 2.2.3

deno 2.2.2 (stable, release, x86_64-unknown-linux-gnu)
v8 13.4.114.9-rusty
typescript 5.7.3

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions