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

Node.js memory leak #346

Closed
afshinm opened this issue Jun 4, 2015 · 9 comments
Closed

Node.js memory leak #346

afshinm opened this issue Jun 4, 2015 · 9 comments

Comments

@afshinm
Copy link
Contributor

@afshinm afshinm commented Jun 4, 2015

When I try to seed two or three files, more than 30 processes created and the server just stop working.

Here is a screenshot of my server and processes:
screen shot 2015-06-05 at 12 22 17 am

Also I got max EventListener error.

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Jun 6, 2015

Those are almost certainly threads, not processes. WebTorrent doesn't ever spawn processes but node.js will spawn new threads for IO tasks.

The problem where everything stops working is the real problem here. How large are the torrents you're seeding? How many are you seeding?

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Jun 6, 2015

Pro-tip: You can configure htop to show only processes, instead of the default of threads.

@afshinm

This comment has been minimized.

Copy link
Contributor Author

@afshinm afshinm commented Jun 6, 2015

Hey @feross

I'm seeding 4 html files, less than 1kb. I figured out that when I start seeding even a 1kb file, nodejs creates about 20 threads. I don't know which module is creating this threads btw.

@rom1504

This comment has been minimized.

Copy link
Member

@rom1504 rom1504 commented Jun 6, 2015

Why is it a problem that node create these threads ?

@afshinm

This comment has been minimized.

Copy link
Contributor Author

@afshinm afshinm commented Jun 6, 2015

@rom1504 after seeding 3 html files, you will have more than 100 threads and no memory left.

@rom1504

This comment has been minimized.

Copy link
Member

@rom1504 rom1504 commented Jun 6, 2015

How are you seeding these files ? I don't think starting several webtorrent instances is an efficient way to do it.
Are you using webtorrent or webtorrent-hybrid ? There are some performance problems with webtorrent-hybrid currently.

@afshinm

This comment has been minimized.

Copy link
Contributor Author

@afshinm afshinm commented Jun 6, 2015

@rom1504 I'm using webtorrent-hybrid. I don't create several WebTorrent instances but I call add function three times to seed three different files (which makes sense I think)

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Jun 6, 2015

Threads don't necessarily take a notable amount memory.

webtorrent-hybrid has memory issues because of the wrtc module. We should investigate using Electron instead of wrtc. Looking for a volunteer to work on this! webtorrent/webtorrent-hybrid#5

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Jul 1, 2015

Closing because the original issue was invalid (node.js creates lots of threads - not a WebTorrent issue).

webtorrent-hybrid does have memory issues due to wrtc, issue here: webtorrent/webtorrent-hybrid#5

@feross feross closed this Jul 1, 2015
@lock lock bot locked as resolved and limited conversation to collaborators May 6, 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.