ggrossetie / asciidoctor-web-pdf

Convert AsciiDoc documents to PDF using web technologies
https://asciidoctor.org
MIT License
445 stars 92 forks source link

Windows binary appears to leak memory/hold onto Chrome instances #574

Open danyill opened 2 years ago

danyill commented 2 years ago

I use the latest binary build of asciidoctor-web-pdf on Windows typically using the --watch and often the --preview options. I think was the version: v1.0.0-alpha.12.

After some time (and occasionally restarting the process) I often find I have many browser instances visible when I press Ctrl+Alt+Del and look at the processes, even though there is no open window. I usually notice this because the system is starting to slow down and I realise these browser instances are consuming excessive memory.

I'm not sure how best to diagnose this -- I'm sorry this is not a more helpful bug description. I hope to look into this more in future. The Windows system I most commonly use I don't have administrative rights to but perhaps I can pull out a process tree somehow.

ggrossetie commented 2 years ago

After some time (and occasionally restarting the process)

Does it happen even if you don't restart (i.e., kill/restart) the process? In other words, do you think it leaves Chrome processes after a <CTRL> + <C>? When watch or preview is enabled we do not close/restart the instance:

https://github.com/Mogztter/asciidoctor-web-pdf/blob/3e1bb2ecf1b781f06bf555556b0935496283ac15/lib/converter.js#L134-L141

And we are using a single page (we only create a new page if there's no active page):

https://github.com/Mogztter/asciidoctor-web-pdf/blob/main/lib/browser.js

We could probably add logs in the browser.js to troubleshoot.

Also do you reproduce this issue when using Node.js directly (instead of the binary)?