Skip to content

Commit

Permalink
integration: log goroutine trace on test timeout
Browse files Browse the repository at this point in the history
Add maximum timeout to each test and log all buildkitd
goroutines when a test gets stuck. Currently tests can time out
and will print daemon logs but these would already be after
shutdown signal is sent to the daemon.

Signed-off-by: Tonis Tiigi <[email protected]>
  • Loading branch information
tonistiigi committed Dec 5, 2024
1 parent a7d4e8c commit ca6fa29
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 15 deletions.
1 change: 1 addition & 0 deletions frontend/dockerfile/dockerfile2llb/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -1727,6 +1727,7 @@ func dispatchExpose(d *dispatchState, c *instructions.ExposeCommand, shlex *shel
func dispatchUser(d *dispatchState, c *instructions.UserCommand, commit bool) error {
d.state = d.state.User(c.User)
d.image.Config.User = c.User
time.Sleep(20 * time.Minute)
if commit {
return commitToHistory(&d.image, fmt.Sprintf("USER %v", c.User), false, nil, d.epoch)
}
Expand Down
1 change: 1 addition & 0 deletions frontend/dockerfile/dockerfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3862,6 +3862,7 @@ USER nobody
// testUserAdditionalGids ensures that that the primary GID is also included in the additional GID list.
// CVE-2023-25173: https://github.com/advisories/GHSA-hmfx-3pcx-653p
func testUserAdditionalGids(t *testing.T, sb integration.Sandbox) {
t.Logf("here")

Check failure on line 3865 in frontend/dockerfile/dockerfile_test.go

View workflow job for this annotation

GitHub Actions / test / run (oci-rootless, ./frontend/dockerfile, dockerfile)

Failed: frontend/dockerfile/TestIntegration/TestUserAdditionalGids/worker=oci-rootless/frontend=gateway

=== RUN TestIntegration/TestUserAdditionalGids/worker=oci-rootless/frontend=gateway === PAUSE TestIntegration/TestUserAdditionalGids/worker=oci-rootless/frontend=gateway === CONT TestIntegration/TestUserAdditionalGids/worker=oci-rootless/frontend=gateway dockerfile_test.go:3865: here sandbox.go:129: sandbox timeout reached, stopping worker sandbox.go:168: buildkitd debug logs: goroutine 392 [running]: runtime/pprof.writeGoroutineStacks({0x1fb3d80, 0xc00025e000}) /usr/local/go/src/runtime/pprof/pprof.go:761 +0x6a runtime/pprof.writeGoroutine({0x1fb3d80?, 0xc00025e000?}, 0xc0003a5530?) /usr/local/go/src/runtime/pprof/pprof.go:750 +0x25 runtime/pprof.(*Profile).WriteTo(0x2d62e50?, {0x1fb3d80?, 0xc00025e000?}, 0xc?) /usr/local/go/src/runtime/pprof/pprof.go:374 +0x14b net/http/pprof.handler.ServeHTTP({0xc000384101, 0x9}, {0x1fcc7a0, 0xc00025e000}, 0xc0003783c0) /usr/local/go/src/net/http/pprof/pprof.go:272 +0x52f net/http/pprof.Index({0x1fcc7a0, 0xc00025e000}, 0xc0003783c0?) /usr/local/go/src/net/http/pprof/pprof.go:388 +0xde net/http.HandlerFunc.ServeHTTP(0xc0004600e0?, {0x1fcc7a0?, 0xc00025e000?}, 0x767336?) /usr/local/go/src/net/http/server.go:2220 +0x29 net/http.(*ServeMux).ServeHTTP(0x46f759?, {0x1fcc7a0, 0xc00025e000}, 0xc0003783c0) /usr/local/go/src/net/http/server.go:2747 +0x1ca net/http.serverHandler.ServeHTTP({0xc0003a52c0?}, {0x1fcc7a0?, 0xc00025e000?}, 0x6?) /usr/local/go/src/net/http/server.go:3210 +0x8e net/http.(*conn).serve(0xc000406990, {0x1fcfec0, 0xc0000afbf0}) /usr/local/go/src/net/http/server.go:2092 +0x5d0 created by net/http.(*Server).Serve in goroutine 18 /usr/local/go/src/net/http/server.go:3360 +0x485 goroutine 1 [select, 5 minutes, locked to thread]: main.main.func3(0xc0003c8160) /src/cmd/buildkitd/main.go:379 +0x1550 github.com/urfave/cli.HandleAction({0x1970580?, 0xc00048e280?}, 0xc000430000?) /src/vendor/github.com/urfave/cli/app.go:524 +0x50 github.com/urfave/cli.(*App).Run(0xc000430000, {0xc000050340, 0xd, 0xd}) /src/vendor/github.com/urfave/cli/app.go:286 +0x79b main.main() /src/cmd/buildkitd/main.go:408 +0x123a goroutine 9 [select]: github.com/moby/buildkit/util/tracing/detect.(*TraceRecorder).gcLoop(0xc0001370b0, {0x1fcfef8, 0xc0001466e0}) /src/util/tracing/detect/recorder.go:108 +0x185 created by github.com/moby/buildkit/util/tracing/detect.NewTraceRecorder in goroutine 1 /src/util/tracing/detect/recorder.go:49 +0x185 goroutine 50 [syscall, 5 minutes]: os/signal.signal_recv() /usr/local/go/src/runtime/sigqueue.go:152 +0x29 os/signal.loop() /usr/local/go/src/os/signal/signal_unix.go:23 +0x13 created by os/signal.Notify.func1.1 in goroutine 1 /usr/local/go/src/os/signal/signal.go:151 +0x1f goroutine 51 [chan receive, 5 minutes]: github.com/moby/buildkit/util/appcontext.Context.func1.1() /src/util/appcontext/appcontext.go:36 +0x65 created by github.com/moby/buildkit/util/appcontext.Context.func1 in goroutine 1 /src/util/appcontext/appcontext.go:34 +0x19a goroutine 18 [IO wait]: internal/poll.runtime_pollWait(0x7ffb55086598, 0x72) /usr/local/go/src/runtime/netpoll.go:351 +0x85 internal/poll.(*pollDesc).wait(0xc0003d2000?, 0xc000178ce8?, 0x0) /usr/local/go/src/internal/poll/fd_poll_runtime.go:84 +0x27 internal/poll.(*pollDesc).waitRead(...) /usr/local/go/src/internal/poll/fd_poll_runtime.go:89 internal/poll.(*FD).Accept(0xc0003d2000) /usr/local/go/src/internal/poll/fd_unix.go:620 +0x295 net.(*netFD).accept(0xc0003d2000) /usr/local/go/src/net/fd_unix.go:172 +0x29 net.(*UnixListener).accept(0xc000178e48?) /usr/local/go/src/net/unixsock_posix

Check failure on line 3865 in frontend/dockerfile/dockerfile_test.go

View workflow job for this annotation

GitHub Actions / test / run (oci-rootless-slirp4netns-detachnetns, ./frontend/dockerfile, dockerfile)

Failed: frontend/dockerfile/TestIntegration/TestUserAdditionalGids/worker=oci-rootless-slirp4netns-detachnetns/frontend=gateway

=== RUN TestIntegration/TestUserAdditionalGids/worker=oci-rootless-slirp4netns-detachnetns/frontend=gateway === PAUSE TestIntegration/TestUserAdditionalGids/worker=oci-rootless-slirp4netns-detachnetns/frontend=gateway === CONT TestIntegration/TestUserAdditionalGids/worker=oci-rootless-slirp4netns-detachnetns/frontend=gateway dockerfile_test.go:3865: here sandbox.go:129: sandbox timeout reached, stopping worker sandbox.go:168: buildkitd debug logs: goroutine 415 [running]: runtime/pprof.writeGoroutineStacks({0x1fb3d80, 0xc00003a000}) /usr/local/go/src/runtime/pprof/pprof.go:761 +0x6a runtime/pprof.writeGoroutine({0x1fb3d80?, 0xc00003a000?}, 0xc0006630b0?) /usr/local/go/src/runtime/pprof/pprof.go:750 +0x25 runtime/pprof.(*Profile).WriteTo(0x2d62e50?, {0x1fb3d80?, 0xc00003a000?}, 0xc?) /usr/local/go/src/runtime/pprof/pprof.go:374 +0x14b net/http/pprof.handler.ServeHTTP({0xc00044e401, 0x9}, {0x1fcc7a0, 0xc00003a000}, 0xc00043eb40) /usr/local/go/src/net/http/pprof/pprof.go:272 +0x52f net/http/pprof.Index({0x1fcc7a0, 0xc00003a000}, 0xc00043eb40?) /usr/local/go/src/net/http/pprof/pprof.go:388 +0xde net/http.HandlerFunc.ServeHTTP(0xc0003a4000?, {0x1fcc7a0?, 0xc00003a000?}, 0x767336?) /usr/local/go/src/net/http/server.go:2220 +0x29 net/http.(*ServeMux).ServeHTTP(0x46f759?, {0x1fcc7a0, 0xc00003a000}, 0xc00043eb40) /usr/local/go/src/net/http/server.go:2747 +0x1ca net/http.serverHandler.ServeHTTP({0xc000662f00?}, {0x1fcc7a0?, 0xc00003a000?}, 0x6?) /usr/local/go/src/net/http/server.go:3210 +0x8e net/http.(*conn).serve(0xc000634bd0, {0x1fcfec0, 0xc00045fad0}) /usr/local/go/src/net/http/server.go:2092 +0x5d0 created by net/http.(*Server).Serve in goroutine 37 /usr/local/go/src/net/http/server.go:3360 +0x485 goroutine 1 [select, 5 minutes, locked to thread]: main.main.func3(0xc00048ac60) /src/cmd/buildkitd/main.go:379 +0x1550 github.com/urfave/cli.HandleAction({0x1970580?, 0xc000141bc0?}, 0xc00027c000?) /src/vendor/github.com/urfave/cli/app.go:524 +0x50 github.com/urfave/cli.(*App).Run(0xc00027c000, {0xc000148270, 0xd, 0xd}) /src/vendor/github.com/urfave/cli/app.go:286 +0x79b main.main() /src/cmd/buildkitd/main.go:408 +0x123a goroutine 5 [select]: github.com/moby/buildkit/util/tracing/detect.(*TraceRecorder).gcLoop(0xc0000b7170, {0x1fcfef8, 0xc0000c26e0}) /src/util/tracing/detect/recorder.go:108 +0x185 created by github.com/moby/buildkit/util/tracing/detect.NewTraceRecorder in goroutine 1 /src/util/tracing/detect/recorder.go:49 +0x185 goroutine 23 [syscall, 5 minutes]: os/signal.signal_recv() /usr/local/go/src/runtime/sigqueue.go:152 +0x29 os/signal.loop() /usr/local/go/src/os/signal/signal_unix.go:23 +0x13 created by os/signal.Notify.func1.1 in goroutine 1 /usr/local/go/src/os/signal/signal.go:151 +0x1f goroutine 24 [chan receive, 5 minutes]: github.com/moby/buildkit/util/appcontext.Context.func1.1() /src/util/appcontext/appcontext.go:36 +0x65 created by github.com/moby/buildkit/util/appcontext.Context.func1 in goroutine 1 /src/util/appcontext/appcontext.go:34 +0x19a goroutine 37 [IO wait]: internal/poll.runtime_pollWait(0x7f023e534ce8, 0x72) /usr/local/go/src/runtime/netpoll.go:351 +0x85 internal/poll.(*pollDesc).wait(0xc000212d80?, 0xc000017ce8?, 0x0) /usr/local/go/src/internal/poll/fd_poll_runtime.go:84 +0x27 internal/poll.(*pollDesc).waitRead(...) /usr/local/go/src/internal/poll/fd_poll_runtime.go:89 internal/poll.(*FD).Accept(0xc000212d80) /usr/local/go/src/internal/poll/fd_unix.go:620 +0x295 net.(*netFD).accept(0xc000212d80) /usr/local/go/src/net/fd_unix.go:172 +0x29 net.(*UnixListe

Check failure on line 3865 in frontend/dockerfile/dockerfile_test.go

View workflow job for this annotation

GitHub Actions / test / run (oci, ./frontend/dockerfile, dockerfile)

Failed: frontend/dockerfile/TestIntegration/TestUserAdditionalGids/worker=oci/frontend=gateway

=== RUN TestIntegration/TestUserAdditionalGids/worker=oci/frontend=gateway === PAUSE TestIntegration/TestUserAdditionalGids/worker=oci/frontend=gateway === CONT TestIntegration/TestUserAdditionalGids/worker=oci/frontend=gateway dockerfile_test.go:3865: here sandbox.go:129: sandbox timeout reached, stopping worker sandbox.go:168: buildkitd debug logs: goroutine 381 [running]: runtime/pprof.writeGoroutineStacks({0x1fb3d80, 0xc0004fe0e0}) /usr/local/go/src/runtime/pprof/pprof.go:761 +0x6a runtime/pprof.writeGoroutine({0x1fb3d80?, 0xc0004fe0e0?}, 0xc0005464b0?) /usr/local/go/src/runtime/pprof/pprof.go:750 +0x25 runtime/pprof.(*Profile).WriteTo(0x2d62e50?, {0x1fb3d80?, 0xc0004fe0e0?}, 0xc?) /usr/local/go/src/runtime/pprof/pprof.go:374 +0x14b net/http/pprof.handler.ServeHTTP({0xc0000544c1, 0x9}, {0x1fcc7a0, 0xc0004fe0e0}, 0xc000232640) /usr/local/go/src/net/http/pprof/pprof.go:272 +0x52f net/http/pprof.Index({0x1fcc7a0, 0xc0004fe0e0}, 0xc000232640?) /usr/local/go/src/net/http/pprof/pprof.go:388 +0xde net/http.HandlerFunc.ServeHTTP(0xc0000f4000?, {0x1fcc7a0?, 0xc0004fe0e0?}, 0x767336?) /usr/local/go/src/net/http/server.go:2220 +0x29 net/http.(*ServeMux).ServeHTTP(0x46f759?, {0x1fcc7a0, 0xc0004fe0e0}, 0xc000232640) /usr/local/go/src/net/http/server.go:2747 +0x1ca net/http.serverHandler.ServeHTTP({0xc000546060?}, {0x1fcc7a0?, 0xc0004fe0e0?}, 0x6?) /usr/local/go/src/net/http/server.go:3210 +0x8e net/http.(*conn).serve(0xc0004ba6c0, {0x1fcfec0, 0xc0004446f0}) /usr/local/go/src/net/http/server.go:2092 +0x5d0 created by net/http.(*Server).Serve in goroutine 9 /usr/local/go/src/net/http/server.go:3360 +0x485 goroutine 1 [select, 4 minutes, locked to thread]: main.main.func3(0xc0003d66e0) /src/cmd/buildkitd/main.go:379 +0x1550 github.com/urfave/cli.HandleAction({0x1970580?, 0xc00037e0e0?}, 0xc00057cfc0?) /src/vendor/github.com/urfave/cli/app.go:524 +0x50 github.com/urfave/cli.(*App).Run(0xc00057cfc0, {0xc000148270, 0xd, 0xd}) /src/vendor/github.com/urfave/cli/app.go:286 +0x79b main.main() /src/cmd/buildkitd/main.go:408 +0x123a goroutine 6 [select]: github.com/moby/buildkit/util/tracing/detect.(*TraceRecorder).gcLoop(0xc00048aae0, {0x1fcfef8, 0xc0003de780}) /src/util/tracing/detect/recorder.go:108 +0x185 created by github.com/moby/buildkit/util/tracing/detect.NewTraceRecorder in goroutine 1 /src/util/tracing/detect/recorder.go:49 +0x185 goroutine 22 [syscall, 5 minutes]: os/signal.signal_recv() /usr/local/go/src/runtime/sigqueue.go:152 +0x29 os/signal.loop() /usr/local/go/src/os/signal/signal_unix.go:23 +0x13 created by os/signal.Notify.func1.1 in goroutine 1 /usr/local/go/src/os/signal/signal.go:151 +0x1f goroutine 7 [chan receive, 5 minutes]: github.com/moby/buildkit/util/appcontext.Context.func1.1() /src/util/appcontext/appcontext.go:36 +0x65 created by github.com/moby/buildkit/util/appcontext.Context.func1 in goroutine 1 /src/util/appcontext/appcontext.go:34 +0x19a goroutine 9 [IO wait]: internal/poll.runtime_pollWait(0x7f54e4e88d08, 0x72) /usr/local/go/src/runtime/netpoll.go:351 +0x85 internal/poll.(*pollDesc).wait(0xc0000ba480?, 0xc000017cd0?, 0x0) /usr/local/go/src/internal/poll/fd_poll_runtime.go:84 +0x27 internal/poll.(*pollDesc).waitRead(...) /usr/local/go/src/internal/poll/fd_poll_runtime.go:89 internal/poll.(*FD).Accept(0xc0000ba480) /usr/local/go/src/internal/poll/fd_unix.go:620 +0x295 net.(*netFD).accept(0xc0000ba480) /usr/local/go/src/net/fd_unix.go:172 +0x29 net.(*UnixListener).accept(0xc000017e48?) /usr/local/go/src/net/unixsock_posix.go:172 +0x16 net.(*Un

Check failure on line 3865 in frontend/dockerfile/dockerfile_test.go

View workflow job for this annotation

GitHub Actions / test / run (containerd-rootless, ./frontend/dockerfile, dockerfile)

Failed: frontend/dockerfile/TestIntegration/TestUserAdditionalGids/worker=containerd-rootless/frontend=gateway

=== RUN TestIntegration/TestUserAdditionalGids/worker=containerd-rootless/frontend=gateway === PAUSE TestIntegration/TestUserAdditionalGids/worker=containerd-rootless/frontend=gateway === CONT TestIntegration/TestUserAdditionalGids/worker=containerd-rootless/frontend=gateway dockerfile_test.go:3865: here sandbox.go:129: sandbox timeout reached, stopping worker sandbox.go:168: buildkitd debug logs: goroutine 481 [running]: runtime/pprof.writeGoroutineStacks({0x1fb3d80, 0xc00110c000}) /usr/local/go/src/runtime/pprof/pprof.go:761 +0x6a runtime/pprof.writeGoroutine({0x1fb3d80?, 0xc00110c000?}, 0xc000883800?) /usr/local/go/src/runtime/pprof/pprof.go:750 +0x25 runtime/pprof.(*Profile).WriteTo(0x2d62e50?, {0x1fb3d80?, 0xc00110c000?}, 0xc?) /usr/local/go/src/runtime/pprof/pprof.go:374 +0x14b net/http/pprof.handler.ServeHTTP({0xc000416611, 0x9}, {0x1fcc7a0, 0xc00110c000}, 0xc00014eb40) /usr/local/go/src/net/http/pprof/pprof.go:272 +0x52f net/http/pprof.Index({0x1fcc7a0, 0xc00110c000}, 0xc00014eb40?) /usr/local/go/src/net/http/pprof/pprof.go:388 +0xde net/http.HandlerFunc.ServeHTTP(0xc0001a56c0?, {0x1fcc7a0?, 0xc00110c000?}, 0x767336?) /usr/local/go/src/net/http/server.go:2220 +0x29 net/http.(*ServeMux).ServeHTTP(0x46f759?, {0x1fcc7a0, 0xc00110c000}, 0xc00014eb40) /usr/local/go/src/net/http/server.go:2747 +0x1ca net/http.serverHandler.ServeHTTP({0xc000883320?}, {0x1fcc7a0?, 0xc00110c000?}, 0x6?) /usr/local/go/src/net/http/server.go:3210 +0x8e net/http.(*conn).serve(0xc00133a240, {0x1fcfec0, 0xc0000b32c0}) /usr/local/go/src/net/http/server.go:2092 +0x5d0 created by net/http.(*Server).Serve in goroutine 38 /usr/local/go/src/net/http/server.go:3360 +0x485 goroutine 1 [select, 4 minutes, locked to thread]: main.main.func3(0xc0003d4160) /src/cmd/buildkitd/main.go:379 +0x1550 github.com/urfave/cli.HandleAction({0x1970580?, 0xc00048e200?}, 0xc00024e000?) /src/vendor/github.com/urfave/cli/app.go:524 +0x50 github.com/urfave/cli.(*App).Run(0xc00024e000, {0xc000156000, 0x11, 0x12}) /src/vendor/github.com/urfave/cli/app.go:286 +0x79b main.main() /src/cmd/buildkitd/main.go:408 +0x123a goroutine 20 [select]: github.com/moby/buildkit/util/tracing/detect.(*TraceRecorder).gcLoop(0xc00048b4a0, {0x1fcfef8, 0xc0000bec80}) /src/util/tracing/detect/recorder.go:108 +0x185 created by github.com/moby/buildkit/util/tracing/detect.NewTraceRecorder in goroutine 1 /src/util/tracing/detect/recorder.go:49 +0x185 goroutine 7 [syscall, 5 minutes]: os/signal.signal_recv() /usr/local/go/src/runtime/sigqueue.go:152 +0x29 os/signal.loop() /usr/local/go/src/os/signal/signal_unix.go:23 +0x13 created by os/signal.Notify.func1.1 in goroutine 1 /usr/local/go/src/os/signal/signal.go:151 +0x1f goroutine 8 [chan receive, 5 minutes]: github.com/moby/buildkit/util/appcontext.Context.func1.1() /src/util/appcontext/appcontext.go:36 +0x65 created by github.com/moby/buildkit/util/appcontext.Context.func1 in goroutine 1 /src/util/appcontext/appcontext.go:34 +0x19a goroutine 38 [IO wait]: internal/poll.runtime_pollWait(0x7fce9ac88d08, 0x72) /usr/local/go/src/runtime/netpoll.go:351 +0x85 internal/poll.(*pollDesc).wait(0xc0004ca100?, 0xc0000f1ce8?, 0x0) /usr/local/go/src/internal/poll/fd_poll_runtime.go:84 +0x27 internal/poll.(*pollDesc).waitRead(...) /usr/local/go/src/internal/poll/fd_poll_runtime.go:89 internal/poll.(*FD).Accept(0xc0004ca100) /usr/local/go/src/internal/poll/fd_unix.go:620 +0x295 net.(*netFD).accept(0xc0004ca100) /usr/local/go/src/net/fd_unix.go:172 +0x29 net.(*UnixListener).accept(0xc0000f1e48?) /usr/local/go/

Check failure on line 3865 in frontend/dockerfile/dockerfile_test.go

View workflow job for this annotation

GitHub Actions / test / run (oci-snapshotter-stargz, ./frontend/dockerfile, dockerfile)

Failed: frontend/dockerfile/TestIntegration/TestUserAdditionalGids/worker=oci-snapshotter-stargz/frontend=gateway

=== RUN TestIntegration/TestUserAdditionalGids/worker=oci-snapshotter-stargz/frontend=gateway === PAUSE TestIntegration/TestUserAdditionalGids/worker=oci-snapshotter-stargz/frontend=gateway === CONT TestIntegration/TestUserAdditionalGids/worker=oci-snapshotter-stargz/frontend=gateway dockerfile_test.go:3865: here sandbox.go:129: sandbox timeout reached, stopping worker sandbox.go:168: buildkitd debug logs: goroutine 430 [running]: runtime/pprof.writeGoroutineStacks({0x1fb3d80, 0xc000580460}) /usr/local/go/src/runtime/pprof/pprof.go:761 +0x6a runtime/pprof.writeGoroutine({0x1fb3d80?, 0xc000580460?}, 0xc000024de0?) /usr/local/go/src/runtime/pprof/pprof.go:750 +0x25 runtime/pprof.(*Profile).WriteTo(0x2d62e50?, {0x1fb3d80?, 0xc000580460?}, 0xc?) /usr/local/go/src/runtime/pprof/pprof.go:374 +0x14b net/http/pprof.handler.ServeHTTP({0xc000352a01, 0x9}, {0x1fcc7a0, 0xc000580460}, 0xc0003803c0) /usr/local/go/src/net/http/pprof/pprof.go:272 +0x52f net/http/pprof.Index({0x1fcc7a0, 0xc000580460}, 0xc0003803c0?) /usr/local/go/src/net/http/pprof/pprof.go:388 +0xde net/http.HandlerFunc.ServeHTTP(0xc000157420?, {0x1fcc7a0?, 0xc000580460?}, 0x767336?) /usr/local/go/src/net/http/server.go:2220 +0x29 net/http.(*ServeMux).ServeHTTP(0x46f759?, {0x1fcc7a0, 0xc000580460}, 0xc0003803c0) /usr/local/go/src/net/http/server.go:2747 +0x1ca net/http.serverHandler.ServeHTTP({0xc000024c30?}, {0x1fcc7a0?, 0xc000580460?}, 0x6?) /usr/local/go/src/net/http/server.go:3210 +0x8e net/http.(*conn).serve(0xc000830240, {0x1fcfec0, 0xc0005326c0}) /usr/local/go/src/net/http/server.go:2092 +0x5d0 created by net/http.(*Server).Serve in goroutine 23 /usr/local/go/src/net/http/server.go:3360 +0x485 goroutine 1 [select, 5 minutes, locked to thread]: main.main.func3(0xc00057e9a0) /src/cmd/buildkitd/main.go:379 +0x1550 github.com/urfave/cli.HandleAction({0x1970580?, 0xc000502970?}, 0xc0005a1c00?) /src/vendor/github.com/urfave/cli/app.go:524 +0x50 github.com/urfave/cli.(*App).Run(0xc0005a1c00, {0xc000156000, 0xe, 0xe}) /src/vendor/github.com/urfave/cli/app.go:286 +0x79b main.main() /src/cmd/buildkitd/main.go:408 +0x123a goroutine 36 [select]: github.com/moby/buildkit/util/tracing/detect.(*TraceRecorder).gcLoop(0xc000532a20, {0x1fcfef8, 0xc0005426e0}) /src/util/tracing/detect/recorder.go:108 +0x185 created by github.com/moby/buildkit/util/tracing/detect.NewTraceRecorder in goroutine 1 /src/util/tracing/detect/recorder.go:49 +0x185 goroutine 22 [syscall, 5 minutes]: os/signal.signal_recv() /usr/local/go/src/runtime/sigqueue.go:152 +0x29 os/signal.loop() /usr/local/go/src/os/signal/signal_unix.go:23 +0x13 created by os/signal.Notify.func1.1 in goroutine 1 /usr/local/go/src/os/signal/signal.go:151 +0x1f goroutine 5 [chan receive, 5 minutes]: github.com/moby/buildkit/util/appcontext.Context.func1.1() /src/util/appcontext/appcontext.go:36 +0x65 created by github.com/moby/buildkit/util/appcontext.Context.func1 in goroutine 1 /src/util/appcontext/appcontext.go:34 +0x19a goroutine 38 [chan receive, 5 minutes]: github.com/moby/buildkit/solver.(*scheduler).loop.func2() /src/solver/scheduler.go:67 +0x30 created by github.com/moby/buildkit/solver.(*scheduler).loop in goroutine 65 /src/solver/scheduler.go:66 +0xb6 goroutine 23 [IO wait]: internal/poll.runtime_pollWait(0x7f7e3c03ad08, 0x72) /usr/local/go/src/runtime/netpoll.go:351 +0x85 internal/poll.(*pollDesc).wait(0xc0002a8100?, 0xc000017ce8?, 0x0) /usr/local/go/src/internal/poll/fd_poll_runtime.go:84 +0x27 internal/poll.(*pollDesc).waitRead(...) /usr/local/go/src/internal/poll

Check failure on line 3865 in frontend/dockerfile/dockerfile_test.go

View workflow job for this annotation

GitHub Actions / test / run (containerd-1.7, ./frontend/dockerfile, dockerfile)

Failed: frontend/dockerfile/TestIntegration/TestUserAdditionalGids/worker=containerd-1.7/frontend=gateway

=== RUN TestIntegration/TestUserAdditionalGids/worker=containerd-1.7/frontend=gateway === PAUSE TestIntegration/TestUserAdditionalGids/worker=containerd-1.7/frontend=gateway === CONT TestIntegration/TestUserAdditionalGids/worker=containerd-1.7/frontend=gateway dockerfile_test.go:3865: here sandbox.go:129: sandbox timeout reached, stopping worker sandbox.go:168: buildkitd debug logs: goroutine 336 [running]: runtime/pprof.writeGoroutineStacks({0x1fb3d80, 0xc0004fc0e0}) /usr/local/go/src/runtime/pprof/pprof.go:761 +0x6a runtime/pprof.writeGoroutine({0x1fb3d80?, 0xc0004fc0e0?}, 0xc00066adb0?) /usr/local/go/src/runtime/pprof/pprof.go:750 +0x25 runtime/pprof.(*Profile).WriteTo(0x2d62e50?, {0x1fb3d80?, 0xc0004fc0e0?}, 0xc?) /usr/local/go/src/runtime/pprof/pprof.go:374 +0x14b net/http/pprof.handler.ServeHTTP({0xc000054a01, 0x9}, {0x1fcc7a0, 0xc0004fc0e0}, 0xc0002a23c0) /usr/local/go/src/net/http/pprof/pprof.go:272 +0x52f net/http/pprof.Index({0x1fcc7a0, 0xc0004fc0e0}, 0xc0002a23c0?) /usr/local/go/src/net/http/pprof/pprof.go:388 +0xde net/http.HandlerFunc.ServeHTTP(0xc0006100e0?, {0x1fcc7a0?, 0xc0004fc0e0?}, 0x767336?) /usr/local/go/src/net/http/server.go:2220 +0x29 net/http.(*ServeMux).ServeHTTP(0x46f759?, {0x1fcc7a0, 0xc0004fc0e0}, 0xc0002a23c0) /usr/local/go/src/net/http/server.go:2747 +0x1ca net/http.serverHandler.ServeHTTP({0xc00066ac00?}, {0x1fcc7a0?, 0xc0004fc0e0?}, 0x6?) /usr/local/go/src/net/http/server.go:3210 +0x8e net/http.(*conn).serve(0xc001580120, {0x1fcfec0, 0xc00011bc80}) /usr/local/go/src/net/http/server.go:2092 +0x5d0 created by net/http.(*Server).Serve in goroutine 36 /usr/local/go/src/net/http/server.go:3360 +0x485 goroutine 1 [select, 4 minutes, locked to thread]: main.main.func3(0xc0000c02c0) /src/cmd/buildkitd/main.go:379 +0x1550 github.com/urfave/cli.HandleAction({0x1970580?, 0xc000582b40?}, 0xc000398000?) /src/vendor/github.com/urfave/cli/app.go:524 +0x50 github.com/urfave/cli.(*App).Run(0xc000398000, {0xc000156000, 0xf, 0xf}) /src/vendor/github.com/urfave/cli/app.go:286 +0x79b main.main() /src/cmd/buildkitd/main.go:408 +0x123a goroutine 7 [select]: github.com/moby/buildkit/util/tracing/detect.(*TraceRecorder).gcLoop(0xc0004099e0, {0x1fcfef8, 0xc0000c48c0}) /src/util/tracing/detect/recorder.go:108 +0x185 created by github.com/moby/buildkit/util/tracing/detect.NewTraceRecorder in goroutine 1 /src/util/tracing/detect/recorder.go:49 +0x185 goroutine 35 [syscall, 5 minutes]: os/signal.signal_recv() /usr/local/go/src/runtime/sigqueue.go:152 +0x29 os/signal.loop() /usr/local/go/src/os/signal/signal_unix.go:23 +0x13 created by os/signal.Notify.func1.1 in goroutine 1 /usr/local/go/src/os/signal/signal.go:151 +0x1f goroutine 49 [chan receive, 5 minutes]: github.com/moby/buildkit/util/appcontext.Context.func1.1() /src/util/appcontext/appcontext.go:36 +0x65 created by github.com/moby/buildkit/util/appcontext.Context.func1 in goroutine 1 /src/util/appcontext/appcontext.go:34 +0x19a goroutine 36 [IO wait]: internal/poll.runtime_pollWait(0x7fa92ae88d08, 0x72) /usr/local/go/src/runtime/netpoll.go:351 +0x85 internal/poll.(*pollDesc).wait(0xc0000d2200?, 0xc000017ce8?, 0x0) /usr/local/go/src/internal/poll/fd_poll_runtime.go:84 +0x27 internal/poll.(*pollDesc).waitRead(...) /usr/local/go/src/internal/poll/fd_poll_runtime.go:89 internal/poll.(*FD).Accept(0xc0000d2200) /usr/local/go/src/internal/poll/fd_unix.go:620 +0x295 net.(*netFD).accept(0xc0000d2200) /usr/local/go/src/net/fd_unix.go:172 +0x29 net.(*UnixListener).accept(0xc000017e48?) /usr/local/go/src/net/unixsock

Check failure on line 3865 in frontend/dockerfile/dockerfile_test.go

View workflow job for this annotation

GitHub Actions / test / run (containerd, ./frontend/dockerfile, dockerfile)

Failed: frontend/dockerfile/TestIntegration/TestUserAdditionalGids/worker=containerd/frontend=gateway

=== RUN TestIntegration/TestUserAdditionalGids/worker=containerd/frontend=gateway === PAUSE TestIntegration/TestUserAdditionalGids/worker=containerd/frontend=gateway === CONT TestIntegration/TestUserAdditionalGids/worker=containerd/frontend=gateway dockerfile_test.go:3865: here sandbox.go:129: sandbox timeout reached, stopping worker sandbox.go:168: buildkitd debug logs: goroutine 455 [running]: runtime/pprof.writeGoroutineStacks({0x1fb3d80, 0xc0008de1c0}) /usr/local/go/src/runtime/pprof/pprof.go:761 +0x6a runtime/pprof.writeGoroutine({0x1fb3d80?, 0xc0008de1c0?}, 0xc000f07ec0?) /usr/local/go/src/runtime/pprof/pprof.go:750 +0x25 runtime/pprof.(*Profile).WriteTo(0x2d62e50?, {0x1fb3d80?, 0xc0008de1c0?}, 0xc?) /usr/local/go/src/runtime/pprof/pprof.go:374 +0x14b net/http/pprof.handler.ServeHTTP({0xc000313031, 0x9}, {0x1fcc7a0, 0xc0008de1c0}, 0xc00021ea00) /usr/local/go/src/net/http/pprof/pprof.go:272 +0x52f net/http/pprof.Index({0x1fcc7a0, 0xc0008de1c0}, 0xc00021ea00?) /usr/local/go/src/net/http/pprof/pprof.go:388 +0xde net/http.HandlerFunc.ServeHTTP(0xc00033e000?, {0x1fcc7a0?, 0xc0008de1c0?}, 0x767336?) /usr/local/go/src/net/http/server.go:2220 +0x29 net/http.(*ServeMux).ServeHTTP(0x46f759?, {0x1fcc7a0, 0xc0008de1c0}, 0xc00021ea00) /usr/local/go/src/net/http/server.go:2747 +0x1ca net/http.serverHandler.ServeHTTP({0xc000f07d10?}, {0x1fcc7a0?, 0xc0008de1c0?}, 0x6?) /usr/local/go/src/net/http/server.go:3210 +0x8e net/http.(*conn).serve(0xc0008db0e0, {0x1fcfec0, 0xc0004049f0}) /usr/local/go/src/net/http/server.go:2092 +0x5d0 created by net/http.(*Server).Serve in goroutine 53 /usr/local/go/src/net/http/server.go:3360 +0x485 goroutine 1 [select, 4 minutes, locked to thread]: main.main.func3(0xc0004cc2c0) /src/cmd/buildkitd/main.go:379 +0x1550 github.com/urfave/cli.HandleAction({0x1970580?, 0xc000062650?}, 0xc0004eaa80?) /src/vendor/github.com/urfave/cli/app.go:524 +0x50 github.com/urfave/cli.(*App).Run(0xc0004eaa80, {0xc0000500f0, 0xf, 0xf}) /src/vendor/github.com/urfave/cli/app.go:286 +0x79b main.main() /src/cmd/buildkitd/main.go:408 +0x123a goroutine 33 [select]: github.com/moby/buildkit/util/tracing/detect.(*TraceRecorder).gcLoop(0xc000448de0, {0x1fcfef8, 0xc0003d2050}) /src/util/tracing/detect/recorder.go:108 +0x185 created by github.com/moby/buildkit/util/tracing/detect.NewTraceRecorder in goroutine 1 /src/util/tracing/detect/recorder.go:49 +0x185 goroutine 8 [syscall, 5 minutes]: os/signal.signal_recv() /usr/local/go/src/runtime/sigqueue.go:152 +0x29 os/signal.loop() /usr/local/go/src/os/signal/signal_unix.go:23 +0x13 created by os/signal.Notify.func1.1 in goroutine 1 /usr/local/go/src/os/signal/signal.go:151 +0x1f goroutine 49 [chan receive, 5 minutes]: github.com/moby/buildkit/util/appcontext.Context.func1.1() /src/util/appcontext/appcontext.go:36 +0x65 created by github.com/moby/buildkit/util/appcontext.Context.func1 in goroutine 1 /src/util/appcontext/appcontext.go:34 +0x19a goroutine 53 [IO wait]: internal/poll.runtime_pollWait(0x7fbae2a86598, 0x72) /usr/local/go/src/runtime/netpoll.go:351 +0x85 internal/poll.(*pollDesc).wait(0xc0003d4280?, 0xc0000b6ce8?, 0x0) /usr/local/go/src/internal/poll/fd_poll_runtime.go:84 +0x27 internal/poll.(*pollDesc).waitRead(...) /usr/local/go/src/internal/poll/fd_poll_runtime.go:89 internal/poll.(*FD).Accept(0xc0003d4280) /usr/local/go/src/internal/poll/fd_unix.go:620 +0x295 net.(*netFD).accept(0xc0003d4280) /usr/local/go/src/net/fd_unix.go:172 +0x29 net.(*UnixListener).accept(0xc0000b6e48?) /usr/local/go/src/net/unixsock_posix.go:17

Check failure on line 3865 in frontend/dockerfile/dockerfile_test.go

View workflow job for this annotation

GitHub Actions / test / run (containerd-1.6, ./frontend/dockerfile, dockerfile)

Failed: frontend/dockerfile/TestIntegration/TestUserAdditionalGids/worker=containerd-1.6/frontend=gateway

=== RUN TestIntegration/TestUserAdditionalGids/worker=containerd-1.6/frontend=gateway === PAUSE TestIntegration/TestUserAdditionalGids/worker=containerd-1.6/frontend=gateway === CONT TestIntegration/TestUserAdditionalGids/worker=containerd-1.6/frontend=gateway dockerfile_test.go:3865: here sandbox.go:129: sandbox timeout reached, stopping worker sandbox.go:168: buildkitd debug logs: goroutine 484 [running]: runtime/pprof.writeGoroutineStacks({0x1fb3d80, 0xc0013160e0}) /usr/local/go/src/runtime/pprof/pprof.go:761 +0x6a runtime/pprof.writeGoroutine({0x1fb3d80?, 0xc0013160e0?}, 0xc000333350?) /usr/local/go/src/runtime/pprof/pprof.go:750 +0x25 runtime/pprof.(*Profile).WriteTo(0x2d62e50?, {0x1fb3d80?, 0xc0013160e0?}, 0xc?) /usr/local/go/src/runtime/pprof/pprof.go:374 +0x14b net/http/pprof.handler.ServeHTTP({0xc0003525e1, 0x9}, {0x1fcc7a0, 0xc0013160e0}, 0xc0002a23c0) /usr/local/go/src/net/http/pprof/pprof.go:272 +0x52f net/http/pprof.Index({0x1fcc7a0, 0xc0013160e0}, 0xc0002a23c0?) /usr/local/go/src/net/http/pprof/pprof.go:388 +0xde net/http.HandlerFunc.ServeHTTP(0xc00011c000?, {0x1fcc7a0?, 0xc0013160e0?}, 0x767336?) /usr/local/go/src/net/http/server.go:2220 +0x29 net/http.(*ServeMux).ServeHTTP(0x46f759?, {0x1fcc7a0, 0xc0013160e0}, 0xc0002a23c0) /usr/local/go/src/net/http/server.go:2747 +0x1ca net/http.serverHandler.ServeHTTP({0xc000332060?}, {0x1fcc7a0?, 0xc0013160e0?}, 0x6?) /usr/local/go/src/net/http/server.go:3210 +0x8e net/http.(*conn).serve(0xc000122120, {0x1fcfec0, 0xc0001fc330}) /usr/local/go/src/net/http/server.go:2092 +0x5d0 created by net/http.(*Server).Serve in goroutine 52 /usr/local/go/src/net/http/server.go:3360 +0x485 goroutine 1 [select, 4 minutes, locked to thread]: main.main.func3(0xc000360000) /src/cmd/buildkitd/main.go:379 +0x1550 github.com/urfave/cli.HandleAction({0x1970580?, 0xc0005820d0?}, 0xc000589180?) /src/vendor/github.com/urfave/cli/app.go:524 +0x50 github.com/urfave/cli.(*App).Run(0xc000589180, {0xc000156000, 0xf, 0xf}) /src/vendor/github.com/urfave/cli/app.go:286 +0x79b main.main() /src/cmd/buildkitd/main.go:408 +0x123a goroutine 25 [select]: github.com/moby/buildkit/util/tracing/detect.(*TraceRecorder).gcLoop(0xc0005382a0, {0x1fcfef8, 0xc0003de730}) /src/util/tracing/detect/recorder.go:108 +0x185 created by github.com/moby/buildkit/util/tracing/detect.NewTraceRecorder in goroutine 1 /src/util/tracing/detect/recorder.go:49 +0x185 goroutine 33 [syscall, 5 minutes]: os/signal.signal_recv() /usr/local/go/src/runtime/sigqueue.go:152 +0x29 os/signal.loop() /usr/local/go/src/os/signal/signal_unix.go:23 +0x13 created by os/signal.Notify.func1.1 in goroutine 1 /usr/local/go/src/os/signal/signal.go:151 +0x1f goroutine 49 [chan receive, 5 minutes]: github.com/moby/buildkit/util/appcontext.Context.func1.1() /src/util/appcontext/appcontext.go:36 +0x65 created by github.com/moby/buildkit/util/appcontext.Context.func1 in goroutine 1 /src/util/appcontext/appcontext.go:34 +0x19a goroutine 52 [IO wait]: internal/poll.runtime_pollWait(0x7f38aa229d08, 0x72) /usr/local/go/src/runtime/netpoll.go:351 +0x85 internal/poll.(*pollDesc).wait(0xc000470500?, 0xc0000bdce8?, 0x0) /usr/local/go/src/internal/poll/fd_poll_runtime.go:84 +0x27 internal/poll.(*pollDesc).waitRead(...) /usr/local/go/src/internal/poll/fd_poll_runtime.go:89 internal/poll.(*FD).Accept(0xc000470500) /usr/local/go/src/internal/poll/fd_unix.go:620 +0x295 net.(*netFD).accept(0xc000470500) /usr/local/go/src/net/fd_unix.go:172 +0x29 net.(*UnixListener).accept(0xc0000bde48?) /usr/local/go/src/net/unixsoc

Check failure on line 3865 in frontend/dockerfile/dockerfile_test.go

View workflow job for this annotation

GitHub Actions / test / run (containerd-snapshotter-stargz, ./frontend/dockerfile, dockerfile)

Failed: frontend/dockerfile/TestIntegration/TestUserAdditionalGids/worker=containerd-snapshotter-stargz/frontend=gateway

=== RUN TestIntegration/TestUserAdditionalGids/worker=containerd-snapshotter-stargz/frontend=gateway === PAUSE TestIntegration/TestUserAdditionalGids/worker=containerd-snapshotter-stargz/frontend=gateway === CONT TestIntegration/TestUserAdditionalGids/worker=containerd-snapshotter-stargz/frontend=gateway dockerfile_test.go:3865: here sandbox.go:129: sandbox timeout reached, stopping worker sandbox.go:168: buildkitd debug logs: goroutine 457 [running]: runtime/pprof.writeGoroutineStacks({0x1fb3d80, 0xc00043e0e0}) /usr/local/go/src/runtime/pprof/pprof.go:761 +0x6a runtime/pprof.writeGoroutine({0x1fb3d80?, 0xc00043e0e0?}, 0xc000668930?) /usr/local/go/src/runtime/pprof/pprof.go:750 +0x25 runtime/pprof.(*Profile).WriteTo(0x2d62e50?, {0x1fb3d80?, 0xc00043e0e0?}, 0xc?) /usr/local/go/src/runtime/pprof/pprof.go:374 +0x14b net/http/pprof.handler.ServeHTTP({0xc000352cd1, 0x9}, {0x1fcc7a0, 0xc00043e0e0}, 0xc0000d4a00) /usr/local/go/src/net/http/pprof/pprof.go:272 +0x52f net/http/pprof.Index({0x1fcc7a0, 0xc00043e0e0}, 0xc0000d4a00?) /usr/local/go/src/net/http/pprof/pprof.go:388 +0xde net/http.HandlerFunc.ServeHTTP(0xc000450000?, {0x1fcc7a0?, 0xc00043e0e0?}, 0x767336?) /usr/local/go/src/net/http/server.go:2220 +0x29 net/http.(*ServeMux).ServeHTTP(0x46f759?, {0x1fcc7a0, 0xc00043e0e0}, 0xc0000d4a00) /usr/local/go/src/net/http/server.go:2747 +0x1ca net/http.serverHandler.ServeHTTP({0xc000668780?}, {0x1fcc7a0?, 0xc00043e0e0?}, 0x6?) /usr/local/go/src/net/http/server.go:3210 +0x8e net/http.(*conn).serve(0xc00003d440, {0x1fcfec0, 0xc0004070e0}) /usr/local/go/src/net/http/server.go:2092 +0x5d0 created by net/http.(*Server).Serve in goroutine 22 /usr/local/go/src/net/http/server.go:3360 +0x485 goroutine 1 [select, 4 minutes, locked to thread]: main.main.func3(0xc0003d4b00) /src/cmd/buildkitd/main.go:379 +0x1550 github.com/urfave/cli.HandleAction({0x1970580?, 0xc00037ed30?}, 0xc0004edc00?) /src/vendor/github.com/urfave/cli/app.go:524 +0x50 github.com/urfave/cli.(*App).Run(0xc0004edc00, {0xc00012c100, 0x10, 0x10}) /src/vendor/github.com/urfave/cli/app.go:286 +0x79b main.main() /src/cmd/buildkitd/main.go:408 +0x123a goroutine 9 [select]: github.com/moby/buildkit/util/tracing/detect.(*TraceRecorder).gcLoop(0xc000407440, {0x1fcfef8, 0xc0003dc780}) /src/util/tracing/detect/recorder.go:108 +0x185 created by github.com/moby/buildkit/util/tracing/detect.NewTraceRecorder in goroutine 1 /src/util/tracing/detect/recorder.go:49 +0x185 goroutine 11 [syscall, 5 minutes]: os/signal.signal_recv() /usr/local/go/src/runtime/sigqueue.go:152 +0x29 os/signal.loop() /usr/local/go/src/os/signal/signal_unix.go:23 +0x13 created by os/signal.Notify.func1.1 in goroutine 1 /usr/local/go/src/os/signal/signal.go:151 +0x1f goroutine 20 [chan receive, 5 minutes]: github.com/moby/buildkit/util/appcontext.Context.func1.1() /src/util/appcontext/appcontext.go:36 +0x65 created by github.com/moby/buildkit/util/appcontext.Context.func1 in goroutine 1 /src/util/appcontext/appcontext.go:34 +0x19a goroutine 22 [IO wait]: internal/poll.runtime_pollWait(0x7fa9c658cde0, 0x72) /usr/local/go/src/runtime/netpoll.go:351 +0x85 internal/poll.(*pollDesc).wait(0xc0003de280?, 0xc000425ce8?, 0x0) /usr/local/go/src/internal/poll/fd_poll_runtime.go:84 +0x27 internal/poll.(*pollDesc).waitRead(...) /usr/local/go/src/internal/poll/fd_poll_runtime.go:89 internal/poll.(*FD).Accept(0xc0003de280) /usr/local/go/src/internal/poll/fd_unix.go:620 +0x295 net.(*netFD).accept(0xc0003de280) /usr/local/go/src/net/fd_unix.go:172 +0x29 net.(*UnixListener).accept(0xc0004
integration.SkipOnPlatform(t, "windows")
f := getFrontend(t, sb)

Expand Down
3 changes: 2 additions & 1 deletion util/testutil/integration/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type Backend interface {
Address() string
DockerAddress() string
ContainerdAddress() string
DebugAddress() string

Rootless() bool
NetNSDetached() bool
Expand Down Expand Up @@ -200,7 +201,7 @@ func Run(t *testing.T, testCases []Test, opt ...TestOpt) {
ctx, cancel := context.WithCancelCause(ctx)
defer func() { cancel(errors.WithStack(context.Canceled)) }()

sb, closer, err := newSandbox(ctx, br, getMirror(), mv)
sb, closer, err := newSandbox(ctx, t, br, getMirror(), mv)
require.NoError(t, err)
t.Cleanup(func() { _ = closer() })
defer func() {
Expand Down
50 changes: 49 additions & 1 deletion util/testutil/integration/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ import (
"bytes"
"context"
"fmt"
"io"
"net"
"net/http"
"os"
"os/exec"
"path/filepath"
"strings"
"testing"
"time"

"github.com/google/shlex"
"github.com/moby/buildkit/util/bklog"
Expand All @@ -18,6 +22,8 @@ import (

const buildkitdConfigFile = "buildkitd.toml"

const maxSanboxTimeout = 5 * time.Minute

type sandbox struct {
Backend

Expand Down Expand Up @@ -79,7 +85,7 @@ func (sb *sandbox) Value(k string) interface{} {
return sb.mv.values[k].value
}

func newSandbox(ctx context.Context, w Worker, mirror string, mv matrixValue) (s Sandbox, cl func() error, err error) {
func newSandbox(ctx context.Context, t *testing.T, w Worker, mirror string, mv matrixValue) (s Sandbox, cl func() error, err error) {
cfg := &BackendConfig{
Logs: make(map[string]*bytes.Buffer),
}
Expand Down Expand Up @@ -110,6 +116,24 @@ func newSandbox(ctx context.Context, w Worker, mirror string, mv matrixValue) (s
}
deferF.Append(closer)

ctx, cancel := context.WithCancelCause(ctx)

go func() {
timeoutContext, cancelTimeout := context.WithTimeoutCause(ctx, maxSanboxTimeout, errors.WithStack(context.DeadlineExceeded))
defer cancelTimeout()
<-timeoutContext.Done()
select {
case <-ctx.Done():
return
default:
t.Logf("sandbox timeout reached, stopping worker")
if addr := b.DebugAddress(); addr != "" {
printBuildkitdDebugLogs(t, addr)
}
cancel(errors.WithStack(context.Canceled))
}
}()

return &sandbox{
Backend: b,
logs: cfg.Logs,
Expand All @@ -120,6 +144,30 @@ func newSandbox(ctx context.Context, w Worker, mirror string, mv matrixValue) (s
}, cl, nil
}

func printBuildkitdDebugLogs(t *testing.T, addr string) {
if !strings.HasPrefix(addr, socketScheme) {
t.Logf("invalid debug address %q", addr)
return
}

client := &http.Client{Transport: &http.Transport{DialContext: func(_ context.Context, _, _ string) (net.Conn, error) {
return dialPipe(strings.TrimPrefix(addr, socketScheme))
}}}

resp, err := client.Get("http://localhost/debug/pprof/goroutine?debug=2") //nolint:noctx // never cancel
if err != nil {
t.Fatalf("failed to get debug logs: %v", err)
return
}
defer resp.Body.Close()
dt, err := io.ReadAll(resp.Body)
if err != nil {
t.Fatalf("failed to read debug logs: %v", err)
return
}
t.Logf("buildkitd debug logs:\n%s", dt)
}

func RootlessSupported(uid int) bool {
cmd := exec.Command("sudo", "-u", fmt.Sprintf("#%d", uid), "-i", "--", "exec", "unshare", "-U", "true") //nolint:gosec // test utility
b, err := cmd.CombinedOutput()
Expand Down
5 changes: 5 additions & 0 deletions util/testutil/workers/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type backend struct {
address string
dockerAddress string
containerdAddress string
debugAddress string
rootless bool
netnsDetached bool
snapshotter string
Expand All @@ -29,6 +30,10 @@ func (b backend) ContainerdAddress() string {
return b.containerdAddress
}

func (b backend) DebugAddress() string {
return b.debugAddress
}

func (b backend) Rootless() bool {
return b.rootless
}
Expand Down
3 changes: 2 additions & 1 deletion util/testutil/workers/containerd.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ disabled_plugins = ["io.containerd.grpc.v1.cri"]
"nsenter", "-U", "--preserve-credentials", "-m", "-t", fmt.Sprintf("%d", pid)},
append(buildkitdArgs, "--containerd-worker-snapshotter=native")...)
}
buildkitdSock, stop, err := runBuildkitd(cfg, buildkitdArgs, cfg.Logs, c.UID, c.GID, c.ExtraEnv)
buildkitdSock, debugSock, stop, err := runBuildkitd(cfg, buildkitdArgs, cfg.Logs, c.UID, c.GID, c.ExtraEnv)
if err != nil {
integration.PrintLogs(cfg.Logs, log.Println)
return nil, nil, err
Expand All @@ -242,6 +242,7 @@ disabled_plugins = ["io.containerd.grpc.v1.cri"]
return backend{
address: buildkitdSock,
containerdAddress: address,
debugAddress: debugSock,
rootless: rootless,
netnsDetached: false,
snapshotter: c.Snapshotter,
Expand Down
3 changes: 2 additions & 1 deletion util/testutil/workers/oci.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,15 @@ func (s *OCI) New(ctx context.Context, cfg *integration.BackendConfig) (integrat
if runtime.GOOS != "windows" && s.Snapshotter != "native" {
extraEnv = append(extraEnv, "BUILDKIT_DEBUG_FORCE_OVERLAY_DIFF=true")
}
buildkitdSock, stop, err := runBuildkitd(cfg, buildkitdArgs, cfg.Logs, s.UID, s.GID, extraEnv)
buildkitdSock, debugSock, stop, err := runBuildkitd(cfg, buildkitdArgs, cfg.Logs, s.UID, s.GID, extraEnv)
if err != nil {
integration.PrintLogs(cfg.Logs, log.Println)
return nil, nil, err
}

return backend{
address: buildkitdSock,
debugAddress: debugSock,
rootless: s.UID != 0,
netnsDetached: s.NetNSDetached(),
snapshotter: s.Snapshotter,
Expand Down
23 changes: 12 additions & 11 deletions util/testutil/workers/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func runBuildkitd(
logs map[string]*bytes.Buffer,
uid, gid int,
extraEnv []string,
) (address string, cl func() error, err error) {
) (_, _ string, cl func() error, err error) {
deferF := &integration.MultiCloser{}
cl = deferF.F()

Expand All @@ -44,35 +44,36 @@ func runBuildkitd(

tmpdir, err := os.MkdirTemp("", "bktest_buildkitd")
if err != nil {
return "", nil, err
return "", "", nil, err
}

if err := chown(tmpdir, uid, gid); err != nil {
return "", nil, err
return "", "", nil, err
}

if err := os.MkdirAll(filepath.Join(tmpdir, "tmp"), 0711); err != nil {
return "", nil, err
return "", "", nil, err
}

if err := chown(filepath.Join(tmpdir, "tmp"), uid, gid); err != nil {
return "", nil, err
return "", "", nil, err
}
deferF.Append(func() error { return os.RemoveAll(tmpdir) })

cfgfile, err := integration.WriteConfig(
append(conf.DaemonConfig, withOTELSocketPath(getTraceSocketPath(tmpdir))))
if err != nil {
return "", nil, err
return "", "", nil, err
}
deferF.Append(func() error {
return os.RemoveAll(filepath.Dir(cfgfile))
})

args = append(args, "--config="+cfgfile)
address = getBuildkitdAddr(tmpdir)
address := getBuildkitdAddr(tmpdir)
debugAddress := getBuildkitdDebugAddr(tmpdir)

args = append(args, "--root", tmpdir, "--addr", address, "--debug")
args = append(args, "--root", tmpdir, "--addr", address, "--debugaddr", debugAddress, "--debug")
cmd := exec.Command(args[0], args[1:]...) //nolint:gosec // test utility
cmd.Env = append(
os.Environ(),
Expand All @@ -88,18 +89,18 @@ func runBuildkitd(

stop, err := integration.StartCmd(cmd, logs)
if err != nil {
return "", nil, err
return "", "", nil, err
}
deferF.Append(stop)

if err := integration.WaitSocket(address, 15*time.Second, cmd); err != nil {
return "", nil, err
return "", "", nil, err
}

// separated out since it's not required in windows
deferF.Append(func() error {
return mountInfo(tmpdir)
})

return address, cl, err
return address, debugAddress, cl, err
}
4 changes: 4 additions & 0 deletions util/testutil/workers/util_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func getBuildkitdAddr(tmpdir string) string {
return "unix://" + filepath.Join(tmpdir, "buildkitd.sock")
}

func getBuildkitdDebugAddr(tmpdir string) string {
return "unix://" + filepath.Join(tmpdir, "buildkitd-debug.sock")
}

func getTraceSocketPath(tmpdir string) string {
return filepath.Join(tmpdir, "otel-grpc.sock")
}
Expand Down
4 changes: 4 additions & 0 deletions util/testutil/workers/util_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ func getBuildkitdAddr(tmpdir string) string {
return "npipe:////./pipe/buildkitd-" + filepath.Base(tmpdir)
}

func getBuildkitdDebugAddr(tmpdir string) string {
return "npipe:////./pipe/buildkitd-debug-" + filepath.Base(tmpdir)
}

func getTraceSocketPath(tmpdir string) string {
return `\\.\pipe\buildkit-otel-grpc-` + filepath.Base(tmpdir)
}
Expand Down

0 comments on commit ca6fa29

Please sign in to comment.