-
-
Notifications
You must be signed in to change notification settings - Fork 340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leakage and high cpu usage for each peer #529
Comments
Okay. In the second case I forgot to close the connections, but in the first case there's still something wrong.
peer_connection.on_peer_connection_state_change({
let peer_connection = peer_connection.clone();
Box::new(move |s| {
info!("Peer Connection State has changed: {s}");
let peer_connection = peer_connection.clone();
Box::pin(async move {
use RTCPeerConnectionState::*;
if let Disconnected | Failed = s {
info!("Attempting to close ended connection");
if let Err(err) = peer_connection.close().await {
error!(%err);
} else {
info!("Connection closed");
}
}
})
})
}); |
Interestingly, we have an app seemingly the same as you've done. It employs HTTP served by Axum to do the signaling. Everything works fine but a similar scenario especially the high CPU usage was observed in our app as well, even if we made sure the peer connection had been closed explicitly. Did you get any progress further concerning this issue? @LIMPIX31 |
Thanks for your reply. Unfortunately I was not able to find out more. I was in a hurry, so I had to write a broadcast server in golang as a temporary solution. |
Some follow-ups to share with you @LIMPIX31 and to all users especially devs of this project. |
Thanks for the sharing. I will make a new release soon. |
webrtc v0.10.0 is released. |
I wrote a simple application to transmit H264 over webrtc. I only need to connect to the server, so the signaling server also handles the peers in the same rust app.
I have 4 tracks here
Arc<RwLock<HashMap<String, Arc<TrackLocalStaticSample>>>>
, although I'm really only using one trackI am using axum for the signaling server and making a single POST request (offer) and returning an answer to the client. That's all I need to establish a connection.
The problem is that each negotiation process takes 5-10 Mb of memory (25Mb at startup), sometimes there can be a sudden jump to 200Mb. Further connections are not possible because it also increases the load on the CPU. After disconnecting the peer, the load does not decrease.
For only one connection memory consumption increases by 2-3 Mb (for 10 minutes), then stays the same.
I think the problem is how I make the connection and hopefully I'm doing something wrong and it's not a webrtc-rs error.
Axum handler
Minimal reproduction
Report
Arc<Mutex<Vec<Arc<RTCRtpTransceiver>>>>
insidePeerConnectionInternal
is not deallocatedThe text was updated successfully, but these errors were encountered: