Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cancel PDF rendering jobs #344

Open
lesydimitri opened this issue Oct 22, 2024 · 4 comments
Open

Cancel PDF rendering jobs #344

lesydimitri opened this issue Oct 22, 2024 · 4 comments

Comments

@lesydimitri
Copy link
Contributor

lesydimitri commented Oct 22, 2024

Hello!

We’ve been experiencing some issues with rendering in SysReptor recently. After investigating, we discovered that the chromium process is consuming all our CPU cores. Rendering a single PDF works fine, but when a second user attempts to render something, the system becomes overloaded, resulting in an infinite loading icon for users.

We’ve been using the same setup for SysReptor for over a year, with the following specifications:

  • 4GB RAM
  • 2 vCPUs

While searching for similar issues, we came across this closed issue: #231

We suspect that changes in Chromium’s behaviour are increasing the load, which our minimal system can no longer handle.
What are your thoughts on this?

Additionally, we’ve noticed that navigating through different reports/designs triggers rendering jobs, but these jobs don’t seem to terminate when leaving a page before rendering completes. Is this the intended behaviour?

@MWedl
Copy link
Contributor

MWedl commented Oct 24, 2024

PDF rendering is a very CPU intensive task, especially chromium but also weasyprint. Both rendering stages slow down drastically when the system is under heavy load.

We use playwright for instrumenting chromium, which already disables many unneeded features and applies performance improvements for headless rendering. Additionally, we tested to reduce the number of chromium processes (CLI args --disable-site-isolation-trials and --renderer-process-limit=1), but that did not affect rendering times and CPU usage during our tests.

Additionally, we’ve noticed that navigating through different reports/designs triggers rendering jobs, but these jobs don’t seem to terminate when leaving a page before rendering completes. Is this the intended behaviour?

We can check if we can detect cancelled HTTP requests to abort rendering.

@lesydimitri
Copy link
Contributor Author

Hi @MWedl

Thanks for getting back to us 🙂

We played around with it some more and came to the following conclusion:

  • Generating a single report works perfectly fine, even on this setup
  • Generating a second report while the first one is still generating also works fine

We came to the conclusion that most likely we have some impatient colleagues, who keep clicking "refresh pdf" or reloading the publish page. This in turn spawns too many rendering processes, hogging up all CPU resources, pretty much putting the system in a deadlock.

It would be great if you could have a look into cancelling rendering jobs in this scenario. Maybe it could also be helpful to add some progress indicators in the UI.

Wishing you a great weekend,
Dimi

@MWedl MWedl changed the title Chromium rendering processes: system overload Cancel PDF rendering jobs Oct 28, 2024
@Ayweth20
Copy link

Ayweth20 commented Nov 7, 2024

Hello,
Thanks for your work :)
I've deployed a SysReptor instance with Docker but for a few days I've noticed slowdowns on my VPS.
So I decided to take a look at what was going on and I did notice that the CPU was being used at 100% for long periods (view attachments).
CPU_Usage
Top_I

These high CPU utilizations follow the modification of the pentest report.
Is it possible to stop this process in background or at least limit it so that the VPS can still function correctly?
Thanks for your response.
Have a nice day
Ayweth20

@aronmolnar
Copy link
Contributor

Thank you for this report. SysReptor might indeed be the culprit of the CPU usage. So far, self-hosted SysReptor installations had no timeout for rendering job and (as this ticket states) were not cancelled, even when abandoned by the user.

The upcoming SysReptor release will introduce a default timeout of 5 minutes for rendering jobs and cancel abandoned jobs.
This should resolve your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants