question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WebTorrent should not store torrent data in memory

See original GitHub issue

Description

WebTorrent seems to be keeping the entire torrent in memory as the file is downloaded. I can see the RAM usage of the “Brave Browser Helper” process increase along with the amount of the torrent that is downloaded, which should not happen. It appears that it is being initialized with the in-memory storage mode instead of the filesystem mode. This is because webpack is used to build the JS for the WebTorrent extension and that causes WebTorrent to substitute certain packages using the package.json “browser” field.

May be related to: https://github.com/brave/brave-browser/issues/5372

Steps to Reproduce

  1. Visit http://mirror.math.princeton.edu/pub/mageia/iso/7.1/torrents/Mageia-7.1-x86_64.torrent
  2. Start the torrent download
  3. Open Activity Monitor.app on Mac and observe memory usage climbing in proportion to the amount of torrent that is downloaded.

Actual result:

Torrent is stored in memory instead of on the disk.

Expected result:

Torrent should not consume RAM in proportion to the torrent size, since this means that users with e.g. 8GB RAM are going to have a sad time when they download an 8GB+ torrent.

Reproduces how often:

Easily reproduced

Brave version (brave://version info)

All Chromium versions.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:17
  • Comments:29 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
fallaciousreasoningcommented, Aug 10, 2022

Hopefully, in the next few weeks I might be able to take a look, no promise though. This is on my todo list 😄

6reactions
srirambvcommented, Jan 14, 2020

This should probably be prioritized and fixed soon. Torrent feature becomes useless if the browser starts to freeze up and download is lost.

cc: @rebron @bsclifton @feross

Read more comments on GitHub >

github_iconTop Results From Across the Web

WebTorrent FAQ
Frequently Asked Questions. What is WebTorrent? WebTorrent is the first torrent client that works in the browser. YEP, THAT'S RIGHT. THE BROWSER.
Read more >
Does WebTorrent download to memory until we hit save file?
So yes, it puts the strain of writing to disk into your main system drive by default and as far as I remember...
Read more >
Downloading Torent - Misc - Brave Community
Where does the torrent file appear after downloading from the Brave Browser. ... WebTorrent should not store torrent data in memory.
Read more >
Keeping the downloaded torrent in memory rather than file ...
You can do this by implementing your own storage class to use with libtorrent. Unfortunately this is not possible to do in python, ......
Read more >
US20170034020A1 - System and method for monitoring bittorrent ...
Data associated with the torrent file and the identification information may be stored at a database. Thereafter, a client may search the database...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found