Headless module's browser on custom sources doesn't get closed on each chapter download #171
Description
Describe the bug
For each chapter download there is one browser that gets piled up and causes a lot of CPU and Memory usage overtime which leads to soft-lock of the system (stops responding and needs manual intervention).
Noticed this while downloading 180+ chapter mangas using the Mangasee custom source (which uses headless). I couldn't see any exposed close()
(or similar) exposed function for the browser
, as shown in the examples (not exactly the same, but I assume there is a way to manually close one).
Currently my solution is to let it download ~30 chapters then Ctrl + c
out of the command (either TUI or inline), then run again.
Reproduction steps
- Select any source that uses
headless
(Mangasee, for example). - Search for any manga with a lot of chapters (Solo Leveling, Overgeared, for example).
- Start downloading all chapters.
- Wait for a few minutes, then monitor the processes.
- There will be a lot of chrome processes piled up, and on each new chapter downloading more will pile up.
Ctrl + c
out of the download, all chrome processes gone.
Expected behavior
After each thread downloading a chapter, the headless
browser should be closed.
Additional context
Just showing a couple of screenshots for reference, I don't know how else to show this behavior. Showing 3 pairs of screenshots for mangal
output and chrome
processes (through gotop
), these are not taken at the exact same time, so there is a bit of discrepancy of amount of processes, but I think the effect can be shown.
Currently piled up chrome processes:
After a bit more chapters downloaded:
Operating System
Linux