Skip to content

fix: guard GetHealth against nil docker client in dry-run mode#6008

Open
veeceey wants to merge 1 commit intonektos:masterfrom
veeceey:fix/issue-5934-dryrun-nil-gethealth
Open

fix: guard GetHealth against nil docker client in dry-run mode#6008
veeceey wants to merge 1 commit intonektos:masterfrom
veeceey:fix/issue-5934-dryrun-nil-gethealth

Conversation

@veeceey
Copy link

@veeceey veeceey commented Feb 23, 2026

When running act -n (dry-run mode) with workflows that define service containers, the process panics with a SIGSEGV because GetHealth() tries to call ContainerInspect on a nil docker client.

In dry-run mode, connect() is skipped via .IfNot(common.Dryrun), so cr.cli is never set. But waitForServiceContainer still calls GetHealth() unconditionally, which dereferences the nil client.

The fix adds a nil check on cr.cli at the top of GetHealth() — if there's no client, we just return HealthHealthy and move on. This matches the pattern already used by Start() and Remove() which skip execution during dry-run.

Tested by verifying the build compiles cleanly. The existing container tests require a live Docker daemon so they can't run in CI-less environments, but the logic is straightforward — just a nil guard.

Fixes #5934

In dry-run mode, the docker client is never initialized because
connect() is skipped via .IfNot(common.Dryrun). However, GetHealth()
was called unconditionally by waitForServiceContainer, causing a nil
pointer dereference (SIGSEGV) when service containers are defined.

Return HealthHealthy early when cr.cli is nil, matching the pattern
used by other methods like Start() and Remove() that skip execution
during dry-run.

Fixes nektos#5934
@veeceey
Copy link
Author

veeceey commented Feb 28, 2026

Good suggestion about documenting the dry-run health check behavior. Happy to add a note to the README if the maintainers would like that as part of this PR.

@veeceey
Copy link
Author

veeceey commented Mar 12, 2026

gentle bump on this when you get a chance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dry mode "gh act -n" under WSL2 produce SIGSEGV nil pointer dereference

1 participant