Skip to content

Scrubber Consumes 45+ MB Memory per Run with Large Credentials #4307

@midigofrank

Description

@midigofrank

Monitoring shows Lightning.Scrubber processes consuming 45-50 MB of memory per run when credentials contain many sensitive values (~500+).

Image

Claude says:

Root Cause
File: lib/lightning/scrubber.ex:136-140

The cartesian_pairs/1 function creates N² combinations of all sensitive values:

elixir
defp cartesian_pairs(items) do
Enum.flat_map(items, fn item ->
items |> Enum.map(&[item, &1])
end)
end
Example:

Credential with 549 sensitive values
Creates 549 × 549 = 301,401 pairs
Each pair gets base64 encoded
Result: ~47 MB memory per Scrubber process

Metadata

Metadata

Assignees

Labels

bugNewly identified bug

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions