Torrent PlugIn Memory Leak/Not writing to disk

Description of the issue:
When using the torrent plugin, downloads exhaust system memory followed by exhausting swap before Linux comes to a near halt

Steps to Reproduce (add as many as necessary):

  1. Launch Brave
  2. Go to Raspian OS downloads:
  3. Click on “Download Torrent”
  4. Click on “Start Torrent”

Actual Result: It appears that the file is not be written to disk during the download, but saving in heap waiting for entire file to finish before flushing to disk. On a standard desktop with lots of system memory it finishes and saves. But on a laptop (like a netbook)with a smaller RAM size, it never reaches the end of file before swap is full and Linux hangs.

Expected Result:
Download of file via torrent should complete as planned and prompt to save.

Reproduces how often:
Always (on a laptop with 2Gb of RAM)

Brave Version:
Brave release - v1.1.20

Reproducible on current live release (yes/no):

Additional information:
Linux Version: Zorin OS Core 15.1
System: Lenovo 110S
CPU: 2 Core (Haswell) Celeron N3060
Memory: 2Gb
Free Disk Space: 94%

This is because at this time, Webtorrent downloads directly to memory, rather than the disk, so that lingering data is cleared when the browser is closed. If you’re using a machine w/2GB ram, this would also explain why the OS comes to a halt (because all that memory is being used to hold the download). You can, however, click the Save file icon for any torrent and it will save the file contents to disk:

Got it. Click “Save File” prior to heap/swap getting consumed.

Thank you.

1 Like