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

on certain Singularity images, syft scan crashes due to runaway memory use #3651

Open
SaurabhNair96 opened this issue Feb 10, 2025 · 5 comments · May be fixed by #3700
Open

on certain Singularity images, syft scan crashes due to runaway memory use #3651

SaurabhNair96 opened this issue Feb 10, 2025 · 5 comments · May be fixed by #3700
Assignees
Labels
bug Something isn't working

Comments

@SaurabhNair96
Copy link

Description: I'm attempting to generate a SBOM for a Singularity file using Syft, but I encounter a "Killed" error.
Below is my setup and the command I used. I'm also attaching the sif file for the purpose of being able to reproduce the error.

Environment:
OS: Windows 10 running a virtual Ubuntu 24.04.1
Syft version: 1.19.0

Steps to take:

  1. Running the tool directly on the sif file
    syft scan singularity:/mnt/shareee/siffiles/[FILE].sif -o cyclonedx-json > sbom-output.json -vv

Error:
Says "Killed".
Attaching an image that shows the error below
Image

The image file can be found here: https://1drv.ms/f/c/d595eda503cbaa82/Evd5EGi9yJFOu64giEKVgwgB7erf50e3fmM6KLUTIUq94A

I was wondering if you would have some insight how I can circumvent the issue. Thank you in advance.

@SaurabhNair96 SaurabhNair96 added the bug Something isn't working label Feb 10, 2025
@willmurphyscode
Copy link
Contributor

Hi @SaurabhNair96 - sorry to hear you're having this issue. Can you return the exit code of Syft? (In the Ubuntu terminal, run echo $? immediately after Syft exits). I suspect it's being killed by an out-of-memory error, but the exit code would help.

@SaurabhNair96
Copy link
Author

Hi @willmurphyscode exit code is 137

@SaurabhNair96
Copy link
Author

Hi @willmurphyscode just to follow up on that, we also tried it on a similar virtual machine with a lot more space and it still showed the same problem. Does the exit code confirm that it is a space issue? Thanks!

@wagoodman wagoodman self-assigned this Feb 27, 2025
@wagoodman wagoodman moved this to In Progress in OSS Feb 27, 2025
@willmurphyscode
Copy link
Contributor

Hi @SaurabhNair96, 137 looks like an out of memory killer - the operating system killed the process because the process was running the computer out of RAM. dmesg will tell you for sure.

Thanks for attaching the image! It does seem like this image uses an inordinate amount of RAM when being scanned. We'll take a look. Thanks.

@wagoodman
Copy link
Contributor

From an initial look it seems that the run frequently gets stuck in the package.json parser function. It's as if there is an infinity sized file (from a little bit of added logs to help out):

[0179] DEBUG parsing package.json file iteration=245397 pkgs=245396
[0179] DEBUG parsing package.json file iteration=245398 pkgs=245397
[0179] DEBUG parsing package.json file iteration=245399 pkgs=245398
[0179] DEBUG parsing package.json file iteration=245400 pkgs=245399

I saw that /usr/local/lib/python3.6/dist-packages/jupyterlab/staging/package.json from the image tended to hit this case.

Some debugging shows it's continually finding the same package again and again: jupyterlab/[email protected] (here is the innocent package.json file)

After a few breakpoints, it seems like there could be a bug in the squashfs lib reader... I believe I saw that the underlying reader after reading the file contents reset the internal file pointer (curOffset) back to 0 without returning EOF.

@willmurphyscode willmurphyscode changed the title syft scan gets Killed on certain Singularity images, syft scan crashes due to runaway memory use Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

4 participants