Re: [webrtc-pc] Should garbage collecting RTCPeerConnection be observable? (#3090)

You might be seeing the long-standing https://issues.chromium.org/issues/41378764 in Chrome.

> clarify pc should NOT be GC'ed if connected and pc close through document unload is remotely observable through a data channel, or

DTLS sends a close alert - if it can which is tricky for unload. It isn't reliable and might get lost but at least an effort was made. Sadly with DTLS 1.3 I am not sure if this is as easy to see in Wireshark as it used to be.
(now why this is done by DTLS and not ICE... historical reasons, it just worked)

This leads to the receivers dtlsTransports going to a "closed state" and is correctly bubbled up to datachannel close - try `pc1.close()` in [the sample](https://webrtc.github.io/samples/src/content/datachannel/basic/) or add this to your fiddle:
```
    pc1.sctp.onstatechange = () => console.log(`PC1 SCTP ${pc1.sctp.state}`);
    pc1.sctp.transport.onstatechange = () => console.log(`PC1 DTLS ${pc1.sctp.transport.state}`);
```
I don't see a test in https://wpt.live/webrtc/protocol/ which is where I'd expect this to be tested.


-- 
GitHub Notification of comment by fippo
Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/3090#issuecomment-3964428310 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 26 February 2026 06:35:21 UTC