kics analyzer crashes on runner with 2GiB memory

Summary

When running the kics analyzer on a t3.small instance (2GiB memory) the analyzer container is killed as soon as scanning starts.

Steps to reproduce

  1. Run kics in an instance with a runner that has 2GiB memory.

Example Project

Not available

What is the current bug behavior?

Container is killed (presumably for OOM reasons)

What is the expected correct behavior?

Container runs to completion

Relevant logs and/or screenshots

Zendesk Federal ticket 2754 (team members only; requires US citizenship and access to federal Zendesk), reported/summarized in #351711 (comment 904601482).

Output of checks

Not available

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

  • Available workaround: increase size of runner to t3.xlarge or another larger instance size.
  • Investigate if kics supports any memory-usage-related configurations
  • Profile memory consumption and reduce it (with potential for upstream contribution to fix large memory users)
  • Detect available memory/memory limit when analyzer starts and print a warning if it is below an expected amount (4GB?). Document this limit after testing, and ensure that it is at least satisfied by the default .com runners (currently GCP n1-standard-1).
Edited by Vishwa Bhat