Adding closing of Page for each render because some OS does not do automatic garbage collection and keeps the Chrome tabs open in the background causing heavy memory consumption and eventual failure.
Situation:
I am using this to render a little bit over 450 pages using GitHub action. With the current code, it takes 2.5 hours and crashes after rendering around 250 pages. (That means, in Github Action runner, all these 250 tabs are opening in parallel and causing this crash).
The error this runner throws is this.
The reason for this lost connection is basically the runner went out of memory and wasn't even able to update the status to Github about this job.
Fix:
Close the tab after rendering of html is completed. After this change, the runner is able to complete the job in less than 10 minutes to render the whole set of 450 pages without breaking a sweat.
The base build takes around 5-6 minutes, the spa-pre-render is a post build step. So, total job completes in 15 mintues, around 5-6 minutes to build, which means, this is able to complete the rendering in less than 10 minutes for 450+ pages.
Conclusion:
Adding the page.close will help in better memory management of chrome tabs and not depend on the host OS garbage collector.
Summary:
Adding closing of Page for each render because some OS does not do automatic garbage collection and keeps the Chrome tabs open in the background causing heavy memory consumption and eventual failure.
Situation:
I am using this to render a little bit over 450 pages using GitHub action. With the current code, it takes 2.5 hours and crashes after rendering around 250 pages. (That means, in Github Action runner, all these 250 tabs are opening in parallel and causing this crash).
The error this runner throws is this.
The reason for this lost connection is basically the runner went out of memory and wasn't even able to update the status to Github about this job.
Fix:
Close the tab after rendering of html is completed. After this change, the runner is able to complete the job in less than 10 minutes to render the whole set of 450 pages without breaking a sweat.
The base build takes around 5-6 minutes, the spa-pre-render is a post build step. So, total job completes in 15 mintues, around 5-6 minutes to build, which means, this is able to complete the rendering in less than 10 minutes for 450+ pages.
Conclusion:
Adding the page.close will help in better memory management of chrome tabs and not depend on the host OS garbage collector.