scanoss / sbom-workbench

The SCANOSS SBOM Workbench graphical user interface to scan and audit your source code.
https://scanoss.com/
Other
47 stars 9 forks source link

UX : avoid freezing on decompressing files #554

Closed vhemery closed 1 year ago

vhemery commented 1 year ago

During the "Decompressing files" stage or scanning, the UI can easily freeze. (enhancement)

Steps to reproduce with SCANOSS Audit Workbench Setup 1.4.0 (no particular version of NPM installed) :

  1. Work on an already built workspace, which has lot of jar/zip files loaded.
  2. Check "Decompress archives and scan inner files".
  3. Launch the audit.
  4. The "Decompressing files" stage can take quite some time, and when we try and click anywhere the UI freezes.

There are two complementary ways to improve the situation.

francostramana commented 1 year ago

Hi @vhemery

Thank you for your contribution. We have analyzed this issue and have come to several conclusions. Indeed, the UI freezes when the workload in the decompression process is high. Unfortunately this is not a javascript promises issue. In a Electron App, the UI (renderer) runs in separate process from the Main Thread, where the pipeline of the new project is executed. However, to our surprise, it seems that these processes are not as independent as they claim to be. If the main thread gets blocked, it can freeze all the rendering threads initiated by it. This post discussing the issue is very interesting: https://medium.com/actualbudget/the-horror-of-blocking-electrons-main-process-351bf11a763c.

So what we have decided is to start migrating some computationally expensive processes that were running directly on the main process to secondary threads in order to avoid blocking the main process, regardless of whether we needed concurrency or not. The decompression stage is the first one we have moved, and it is already integrated. The official release with this improvement will be available in a few days.

Nevertheless, we have plans in our backlog to improve the progress reporting and provide users with estimated times for each stage.

Once again, we appreciate your contribution as it has helped us better understand the architecture of Electron in these cases