Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Browser crash upon consecutive seeds, possible memory leak? #26

Open
kbbqiu opened this issue May 23, 2017 · 15 comments
Open

Browser crash upon consecutive seeds, possible memory leak? #26

kbbqiu opened this issue May 23, 2017 · 15 comments

Comments

@kbbqiu
Copy link
Collaborator

kbbqiu commented May 23, 2017

As we rack up the number WebTorrent seeds on the broadcaster side, there seems to be a client side memory leak which eventually causes the browser to crash. We’ve checked the CPU and memory usage but have found no error messages or anomalies.

Unsuccessful approaches that we have taken to solve the issue:

  • Server side seeding in place of client side seeding
  • Seeding in web workers
  • Seeding in iframes
  • Destroying WebTorrent client on each new seed
  • Destroying WebTorrent file on each new seed

One solution that we have found, is browser specific. If using Chrome Canary to test the library, it seems to run indefinitely. If anyone in the open source community is able to provide some insight, please make a pull request on our GitHub repo.

@imvetri
Copy link
Contributor

imvetri commented May 30, 2017

What are the steps to reproduce the issue in a local environment?

@paulm17
Copy link

paulm17 commented May 30, 2017

Not sure I have the wrong end of the stick or not.

But wouldn't it be better to have another torrent server for the creating and deleting of the torrent files?

Perhaps using something like webtorrent-hybrid ?

I'm sure this would off-load the requirement from the browser and better on a server?

@kbbqiu
Copy link
Collaborator Author

kbbqiu commented May 30, 2017

@imvetri we haven't updated the styling for the demo since we started the project so don't mind the css haha. Here's how to reproduce the problem. Using google chrome in this instance.

  1. npm start
  2. Go to localhost://8000/
  3. Open a broadcaster screen
  4. Open a viewer screen as well
  5. Start the broadcaster
  6. Viewer should begin in about 10 seconds or so
  7. After some time, your browser should freeze...

Actually, the current demo is set to batching and seeding the torrent at 30 sec intervals... Go to ./client/broadcaster/broadcaster.js to edit the time it takes to batch. Between 7-10 seconds is probably the best.

@kbbqiu
Copy link
Collaborator Author

kbbqiu commented May 30, 2017

@no1youknowz same issue persists. We've tried using webtorrent hybrid on the server end. We still get the same issue, after about 10 emits, there is the warning saying that event emitters exceeded 10 and possible memory leak. From webTorrent github closed issues, supposedly the event emitter error isn't a big deal.

The reason why we chose to go with client side seeding is so the server does less work. In Nile.js, the server only propogates the magnet URI to the rest of the network.

@paulm17
Copy link

paulm17 commented May 30, 2017

@kbbqiu many thanks for the follow up.

@imvetri
Copy link
Contributor

imvetri commented May 30, 2017

@kbbqiu can you share which node/ npm I should try this with. Currently tried npm install with following versions.
Node - 7.7.3
Npm - 4.1.2

Ended with following error in the log file. It would be great if you confirm if this is not from nile.js package, I suspect issue with node/ npm. based on your confirmation I will open a issue there.

npm-debug.log.txt

@imvetri
Copy link
Contributor

imvetri commented May 30, 2017

I tried with different version of node and npm. I got different error now.

FYI, I am running this in windows 7

node v6.10.1
npm v3.10.10

Attaching debu log
npm-debug.log.node6.txt

@derekmiranda
Copy link
Contributor

Hi, @imvetri, seems like there's an issue with the postinstall, which is there to fix this issue we had experienced with socket.io. we personally have not tested this on windows systems but we'll look into it

@imvetri
Copy link
Contributor

imvetri commented May 30, 2017

haha. Thanks for the update.

Moreover I tried npm install on debugger.html project as well. It isn't working for that project too. Raised an issue there as well. firefox-devtools/debugger#3045

I am suspecting its most likely issue with npm, if so I will add this in their bugs.
Update: This is not an issue with npm / node. I tried installing dependencies for express and it working good.
@derekmiranda
Update: npm install --ignore-script seems to solve the npm install error :)

@imvetri
Copy link
Contributor

imvetri commented Jun 2, 2017

Need some suggestions to mock the video stream. I do not have a camera on my desktop.

@imvetri
Copy link
Contributor

imvetri commented Jun 8, 2017

@kbbqiu I tried the steps. What I observed is that after a while, viewer gets hung up, like the video will be stuck. Can you confirm whether this is the reported bug ?

Steps I tried.

  1. Opened broadcaster in a new chrome window
  2. Opened viewer in a new chrome window
  3. Started streaming
  4. Viewer stops video after a while (2 mins)

But I am still able to use the browser without any hanging issue.

@Nastybastard
Copy link

Nastybastard commented Jun 8, 2017 via email

@kbbqiu
Copy link
Collaborator Author

kbbqiu commented Jun 8, 2017

@imvetri yep. That should be the issue. There are no errors, just suddenly gets hung up.

@idkjs
Copy link

idkjs commented Jul 7, 2017

I guess this isnt worked out yet? Any updates?

@ChrisChiasson
Copy link

Is this issue still present in the latest chrome?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants