Skip to content

Commit 68ade0a

Browse files
Do not fail project on memory spikes (#1504)
We have an unresolved issued of multi-gigabyte memory spikes when scanning files for licenses in some rare cases, like it is reported at aboutcode-org/scancode-toolkit#3711 Currently we fail the project on encountering such memory spikes, but we don't get any scan info from the rest of the project because we raise the Exception. This adds a project error instead of raising an Exception, so we can continue scanning the rest of the resources. Reference: aboutcode-org/scancode-toolkit#3711 Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>
1 parent 0c6de4b commit 68ade0a

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

scanpipe/pipes/scancode.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,11 @@ def save_scan_package_results(codebase_resource, scan_results, scan_errors):
286286

287287

288288
def scan_resources(
289-
resource_qs, scan_func, save_func, scan_func_kwargs=None, progress_logger=None
289+
resource_qs,
290+
scan_func,
291+
save_func,
292+
scan_func_kwargs=None,
293+
progress_logger=None,
290294
):
291295
"""
292296
Run the `scan_func` on the codebase resources of the provided `resource_qs`.
@@ -346,7 +350,15 @@ def scan_resources(
346350
"Please ensure that there is at least 2 GB of available memory per "
347351
"CPU core for successful execution."
348352
)
349-
raise broken_pool_error from InsufficientResourcesError(message)
353+
354+
resource.project.add_error(
355+
exception=broken_pool_error,
356+
model="scan_resources",
357+
description=message,
358+
object_instance=resource,
359+
)
360+
continue
361+
350362
save_func(resource, scan_results, scan_errors)
351363

352364

0 commit comments

Comments
 (0)