Skip to content

Fix indefinite block when Config struct is initialized separately#1020

Merged
egibs merged 1 commit into
chainguard-dev:mainfrom
egibs:fix-default-concurrency-hang
Jun 27, 2025
Merged

Fix indefinite block when Config struct is initialized separately#1020
egibs merged 1 commit into
chainguard-dev:mainfrom
egibs:fix-default-concurrency-hang

Conversation

@egibs
Copy link
Copy Markdown
Member

@egibs egibs commented Jun 27, 2025

If we use something like:

_, err := action.Scan(ctx, malcontent.Config{
	IncludeDataFiles: true,
	ScanPaths:        []string{testFile},
	RuleFS:           []fs.FS{rules.FS, thirdparty.FS},
})

if err != nil {
	t.Fatalf("Scan(%q) error = %v, want nil", testFile, err)
}

The new channel-based scanner pool will block indefinitely because c.Concurrency will default to 0 so no scanners will be created. This ensures that we initialize the pool regardless of how the Config is initialized.

Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
@egibs egibs requested a review from antitree June 27, 2025 13:03
@egibs egibs enabled auto-merge (squash) June 27, 2025 13:19
@egibs egibs merged commit 855956f into chainguard-dev:main Jun 27, 2025
12 checks passed
@egibs egibs deleted the fix-default-concurrency-hang branch July 2, 2025 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants