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

Window Crashes and Seeding Stops after a few Consecutive Seeds #1118

Closed
kbbqiu opened this issue Apr 29, 2017 · 2 comments
Closed

Window Crashes and Seeding Stops after a few Consecutive Seeds #1118

kbbqiu opened this issue Apr 29, 2017 · 2 comments

Comments

@kbbqiu
Copy link

@kbbqiu kbbqiu commented Apr 29, 2017

I've been testing this both in the browser as well as in node using the latest versions of webtorrent and running in chrome browser.

I am trying to create a "live stream" using webtorrents where every 10 seconds I save the webcam stream using RecordRTC along with MediaStreamRecorder. Once the webcam is saved as video/webm, I immediately seed the video. After a few consecutive seeds, the browser seems to crash and the seeding stops. If I try to restart webcam, it doesn't work. I have to restart the browser. This case happens every time when I create 4 or more consecutive seeds using:

let client = new WebTorrent();
// begin using the webcam
navigator.getUserMedia(mediaConstraints, onMediaSuccess, onMediaError);

function onMediaSuccess(stream) {
    let mediaRecorder = new MediaStreamRecorder(stream);
    // record a blob every _recordInterval amount of time
    mediaRecorder.start(_recordInterval);
    mediaRecorder.mimeType = 'video/webm';

    // every _recordInterval, make a new torrent file and start seeding it
    mediaRecorder.ondataavailable = function (blob) {
      let file = new File([blob], 'test.webm', {
        type: 'video/webm'
      });

    client.seed(file, function (torrent) {
      magnetURI = torrent.magnetURI;
      console.log('Client is seeding ' + torrent.magnetURI)
    });
  }
}

The problem may have something to do with event listeners? Sometimes, if I get past 10 seeds, i will get the event.emitter warning. Although, reading from previous closed issues, I don't think that this should be the issue...

I have tried to destroy the client each time I seed a new file using client.destroy. But the same error still occurs. I have also attempted to try seeding on the node server by first posting the video file to the server using forms and then parsing the form-video using formidable. Still no luck :(.

@disarticulate

This comment has been minimized.

Copy link

@disarticulate disarticulate commented Oct 26, 2017

If you're creating the torrents yourself, i've documented similar memory leak issues here:
#895 (comment)

The only work around I found was to increase pieceLength in the seed options.

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Apr 19, 2018

Duplicate #895

@feross feross closed this Apr 19, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jul 18, 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.