nile.js icon indicating copy to clipboard operation
nile.js copied to clipboard

Browser crash upon consecutive seeds, possible memory leak?

Open kbbqiu opened this issue 8 years ago • 15 comments
trafficstars

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.

kbbqiu avatar May 23 '17 14:05 kbbqiu

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

imvetri avatar May 30 '17 01:05 imvetri

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?

paulm17 avatar May 30 '17 10:05 paulm17

@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 avatar May 30 '17 14:05 kbbqiu

@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.

kbbqiu avatar May 30 '17 14:05 kbbqiu

@kbbqiu many thanks for the follow up.

paulm17 avatar May 30 '17 14:05 paulm17

@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 avatar May 30 '17 16:05 imvetri

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

imvetri avatar May 30 '17 16:05 imvetri

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

derekmiranda avatar May 30 '17 17:05 derekmiranda

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. https://github.com/devtools-html/debugger.html/issues/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 avatar May 30 '17 17:05 imvetri

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

imvetri avatar Jun 02 '17 17:06 imvetri

@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.

imvetri avatar Jun 08 '17 05:06 imvetri

blockquote, div.yahoo_quoted { margin-left: 0 !important; border-left:1px #715FFA solid !important; padding-left:1ex !important; background-color:white !important; } Yes and I'm also having trouble with my battery changing and loading apps

Sent from Yahoo Mail for iPhone

On Thursday, June 8, 2017, 1:14 AM, Vetrivel [email protected] wrote:

@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 ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

Nastybastard avatar Jun 08 '17 05:06 Nastybastard

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

kbbqiu avatar Jun 08 '17 19:06 kbbqiu

I guess this isnt worked out yet? Any updates?

idkjs avatar Jul 07 '17 14:07 idkjs

Is this issue still present in the latest chrome?

ChrisChiasson avatar Apr 03 '18 00:04 ChrisChiasson