Skip to content
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

RTCPeerConnection instances leak CPU even when destroyed #551

Closed
thelordofthetimes opened this issue Dec 30, 2015 · 16 comments
Closed

RTCPeerConnection instances leak CPU even when destroyed #551

thelordofthetimes opened this issue Dec 30, 2015 · 16 comments

Comments

@thelordofthetimes
Copy link

@thelordofthetimes thelordofthetimes commented Dec 30, 2015

I check memory use by webtorrent when download on browser environment. Some issues below

  • use more memory when started
  • memory usage increase during download
  • make browser slow

This is check video on youtube

check-video

@feross feross added the question label Jan 5, 2016
@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Jan 10, 2016

Thanks for the informative video!

If you keep the tab open for longer, does the memory usage keep increasing? Or does it stay constant at 2GB?

@thelordofthetimes

This comment has been minimized.

Copy link
Author

@thelordofthetimes thelordofthetimes commented Jan 11, 2016

Yes, usage memory increase during play. And after few minutes, it make other tab slower, you can open youtube and play any HD video with full screen to see

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Jan 12, 2016

I think there's a leak in Chrome that happens when you open too many RTCPeerConnections, even if you destroy them later.

Let's use this as the tracking issue for that.

@feross feross changed the title download use more memory RTCPeerConnection instances leak CPU even when destroyed Jan 12, 2016
@thelordofthetimes

This comment has been minimized.

Copy link
Author

@thelordofthetimes thelordofthetimes commented Jan 13, 2016

I think it is leak memory, not leak CPU

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Apr 4, 2016

I opened an issue on the WebRTC tracker about the CPU leak: https://bugs.chromium.org/p/webrtc/issues/detail?id=5733

@thelordofthetimes

This comment has been minimized.

Copy link
Author

@thelordofthetimes thelordofthetimes commented Apr 5, 2016

hi feross,

i am webtorrent user. i see that problem and report for you, but i can not solve that problem

may be other people can do ?

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Apr 5, 2016

It appears that the WebRTC CPU leak issue only affected OS X/Linux users on Chrome.

And, GOOD NEWS, the issue is fixed in Chrome Canary! https://bugs.chromium.org/p/webrtc/issues/detail?id=5733#c3

We can finally put this issue behind us :)

@feross feross closed this Apr 5, 2016
@thelordofthetimes

This comment has been minimized.

Copy link
Author

@thelordofthetimes thelordofthetimes commented Apr 6, 2016

we are happy :)

@yciabaud

This comment has been minimized.

Copy link
Contributor

@yciabaud yciabaud commented Apr 22, 2016

It looks like this issue is fixed in Chrome 50 too which is the current stable version of the browser. It is very nice to be able to let a webtorrent tab open in chrome without crashing the whole app ;)

Nightmare is over.

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Apr 22, 2016

Nice, glad that we're putting these annoying webrtc bugs behind us and the implementation is getting stable.

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Apr 22, 2016

@yciabaud FWIW, I still see the issue in Chrome 50. But not in Chrome 51.

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Apr 22, 2016

You can test for the issue by opening a new tab and pasting this into the console. Then wait for a few minutes.

function createPeer () {
  var pc = new webkitRTCPeerConnection({
    iceServers: [
      {
        url: 'stun:23.21.150.121',
        urls: 'stun:23.21.150.121'
      }
    ]
  }, {})

  var channel = pc.createDataChannel(String(Math.floor(Math.random() * 1000000)), {})
  channel.binaryType = 'arraybuffer'
  channel.onmessage = function (event) {}
  channel.onopen = function () {}
  channel.onclose = function () {
    console.log('channel onclose')
  }

  pc.onnegotiationneeded = function () {
    pc.createOffer(function (offer) {
      pc.setLocalDescription(offer, function (offer) {
        console.log('set local description')
      }, onError)
    }, onError)
  }

  function onError (err) {
    console.error(err.message)
  }

  setTimeout(function () {
    pc.close()
    channel.close()
  }, 30000)
}

createPeer()
setInterval(createPeer, 3000)
@yciabaud

This comment has been minimized.

Copy link
Contributor

@yciabaud yciabaud commented Apr 23, 2016

I ran it for 2 hours without any trouble. Looks like Chrome 50 on Linux is fixed.

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Apr 24, 2016

Ah, okay. I'm using Chrome 51 on OS X where it's not fixed yet.

@thelordofthetimes

This comment has been minimized.

Copy link
Author

@thelordofthetimes thelordofthetimes commented Apr 24, 2016

yes, run chrome in almost unix-like operating system has occur bugs, that is crazy !!!

but i do not know what is problem, we are only wait for chrome developers to fix it

@lock

This comment has been minimized.

Copy link

@lock lock bot commented May 4, 2018

This thread has been automatically locked because it has not had recent activity. To discuss futher, please open a new issue.

@lock lock bot locked as resolved and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.