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

Panic building staged multiplatform images #5745

Open
1 task done
jarojasm95 opened this issue Aug 1, 2023 · 1 comment
Open
1 task done

Panic building staged multiplatform images #5745

jarojasm95 opened this issue Aug 1, 2023 · 1 comment

Comments

@jarojasm95
Copy link

jarojasm95 commented Aug 1, 2023

Before proceeding

  • I didn't find a similar issue

Version

1.2.248

How to reproduce

Repro repository here: https://github.com/jarojasm95/werf-issue

  1. git clone git@github.com:jarojasm95/werf-issue.git
  2. export WERF_BUILDAH_MODE=auto
  3. werf build

Result

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x3115bdc]

goroutine 1 [running]:
github.com/werf/werf/pkg/build/image.NewMultiplatformImage.func1(0x7fa08c3b0dd8?)
        /git/pkg/build/image/multiplatform_image.go:35 +0x3c
github.com/werf/werf/pkg/util.MapFuncToSlice[...](...)
        /git/pkg/util/slice.go:5
github.com/werf/werf/pkg/build/image.NewMultiplatformImage({0xc000691270, 0xf}, {0xc000df5a40, 0x2, 0x2}, {0x1e19fbc?, 0xc0001bdcc0?}, {0x0, 0x1, 0x1})
        /git/pkg/build/image/multiplatform_image.go:33 +0x166
github.com/werf/werf/pkg/build.(*BuildPhase).AfterImages(0xc0016c3d60, {0x498ccc8?, 0xc0005bb8c0})
        /git/pkg/build/build_phase.go:265 +0x616
github.com/werf/werf/pkg/build.(*Conveyor).runPhases.func1()
        /git/pkg/build/conveyor.go:587 +0x36
github.com/werf/logboek/internal/stream.(*LogProcess).DoError(0xc000c5da40, 0xc0015ee580)
        /go/pkg/mod/github.com/werf/logboek@v0.5.5/internal/stream/process_types.go:195 +0xd5
github.com/werf/werf/pkg/build.(*Conveyor).runPhases(0xc000551600?, {0x498ccc8?, 0xc0005bb8c0}, {0xc000df4450, 0x1, 0x1}, 0x47?)
        /git/pkg/build/conveyor.go:586 +0x48f
github.com/werf/werf/pkg/build.(*Conveyor).Build(0xc000551600, {0x498ccc8, 0xc0005bb8c0}, {{{0x0, 0x0}, 0x0, 0x0}, {{0x0, 0x0, 0x0}}, ...})
        /git/pkg/build/conveyor.go:540 +0x273
github.com/werf/werf/cmd/werf/build.run.func1(0x49bad18?)
        /git/cmd/werf/build/main.go:261 +0x58
github.com/werf/werf/pkg/build.(*ConveyorWithRetryWrapper).WithRetryBlock.func1()
        /git/pkg/build/conveyor_with_retry.go:60 +0x1d8
github.com/werf/werf/pkg/storage/manager.RetryOnUnexpectedStagesStorageState({0x0?, 0x0?}, {0xc0005d5358?, 0x1e26826?}, 0xc0015b7348)
        /git/pkg/storage/manager/storage_manager.go:110 +0x28
github.com/werf/werf/pkg/build.(*ConveyorWithRetryWrapper).WithRetryBlock(0x0?, {0x498ccc8?, 0xc0005bb8c0?}, 0x0?)
        /git/pkg/build/conveyor_with_retry.go:45 +0x6b
github.com/werf/werf/cmd/werf/build.run({0x498ccc8, 0xc0005bb8c0}, {0x49bad18, 0xc000fbe640}, {0x499de60?, 0xc000fe37a0?}, {{0x0, 0x0, 0x0}, 0x0})
        /git/cmd/werf/build/main.go:260 +0xa68
github.com/werf/werf/cmd/werf/build.runMain({0x498ccc8, 0xc0005bb8c0}, {{0x0?, 0x0?, 0xc0005d5b40?}, 0x57?})
        /git/cmd/werf/build/main.go:192 +0x6b5
github.com/werf/werf/cmd/werf/build.NewCmd.func1.1()
        /git/cmd/werf/build/main.go:63 +0x46
github.com/werf/werf/cmd/werf/common.LogRunningTime(0xc0005d5c58)
        /git/cmd/werf/common/common.go:1349 +0x42
github.com/werf/werf/cmd/werf/build.NewCmd.func1(0xc00117e300, {0x6c0bcb8, 0x0, 0x0})
        /git/cmd/werf/build/main.go:62 +0x1be
main.setupTelemetryInit.func1(0xc00117e300?, {0x6c0bcb8, 0x0, 0x0})
        /git/cmd/werf/main.go:297 +0xd2
github.com/spf13/cobra.(*Command).execute(0xc00117e300, {0x6c0bcb8, 0x0, 0x0})
        /go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:940 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0xc0010a8300)
        /go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
        /go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992
main.main()
        /git/cmd/werf/main.go:84 +0x199

Expected result

Successful build

Additional information

No response

@distorhead
Copy link
Member

Firstly big thanks for reproducible sample!

Issue status: Bug confirmed. I've tried to catch the bug, no success so far, but will try to fix this asap.

Debug context for further investigation:

  • Building werf-issue-base image alone does not results in panic: werf build werf-issue-base. But building two images werf-issue and werf-issue-base results in panic.
  • If I alter werf-issue Containerfile so that there will be single stage, no panic occurs.
  • If no multiplatform mode used, then no panic occurs either.
  • Panic related to the empty StageID field of werf-issue-base last stage. This stage was somehow reset to empty baseStageImage object, which is incorrect.
  • => So the bug is related to the dependencies usage + multistage Containerfile + multiplatform building.

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

No branches or pull requests

2 participants