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

nil pointer exception when discarding llbBridgeForwarder #3134

Closed
sipsma opened this issue Sep 26, 2022 · 1 comment · Fixed by #3233
Closed

nil pointer exception when discarding llbBridgeForwarder #3134

sipsma opened this issue Sep 26, 2022 · 1 comment · Fixed by #3233
Labels

Comments

@sipsma
Copy link
Collaborator

sipsma commented Sep 26, 2022

Getting this exception:

time="2022-09-26T16:03:40Z" level=error msg="/moby.buildkit.v1.frontend.LLBBridge/Solve returned error: rpc error: code = Unknown desc = process \"/_shim uname -m\" did not complete successfully: exit code: 1\n"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0xb0 pc=0x93778c]

goroutine 249258 [running]:
github.com/moby/buildkit/frontend/gateway.(*llbBridgeForwarder).Discard(0x4000644f20)
        /src/frontend/gateway/gateway.go:356 +0x1ac
github.com/moby/buildkit/solver/llbsolver.(*Solver).Solve(0x400054c4e0, {0x112d028, 0x40019c4330}, {0x4001384000, 0x19}, {0x4001384040, 0x19}, {0x0, 0x0, {0x0, ...}, ...}, ...)
        /src/solver/llbsolver/solver.go:324 +0x1380
github.com/moby/buildkit/control.(*Controller).Solve(0x400055ec80, {0x112d028, 0x40019c4330}, 0x400101c120)
        /src/control/control.go:302 +0x910
github.com/moby/buildkit/api/services/control._Control_Solve_Handler.func1({0x112d028, 0x40019c4330}, {0xf22500, 0x400101c120})
        /src/api/services/control/control.pb.go:1611 +0x7c
github.com/moby/buildkit/util/grpcerrors.UnaryServerInterceptor({0x112d028, 0x40019c4330}, {0xf22500, 0x400101c120}, 0x4001180000, 0x4004a56048)
        /src/util/grpcerrors/intercept.go:14 +0x48
github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1({0x112d028, 0x40019c4330}, {0xf22500, 0x400101c120})
        /src/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go:25 +0x58
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc.UnaryServerInterceptor.func1({0x112cf80, 0x4003a60140}, {0xf22500, 0x400101c120}, 0x4001180000, 0x4001180020)
        /src/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go:325 +0x578
main.unaryInterceptor.func1({0x112d028, 0x40019c4120}, {0xf22500, 0x400101c120}, 0x4001180000, 0x4001180020)
        /src/cmd/buildkitd/main.go:566 +0x134
github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1({0x112d028, 0x40019c4120}, {0xf22500, 0x400101c120})
        /src/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go:25 +0x58
github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1({0x112d028, 0x40019c4120}, {0xf22500, 0x400101c120}, 0x4001180000, 0x4004a56048)
        /src/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go:34 +0xc4
github.com/moby/buildkit/api/services/control._Control_Solve_Handler({0xeb7a40, 0x400055ec80}, {0x112d028, 0x40019c4120}, 0x4000c5a000, 0x4000a00a20)
        /src/api/services/control/control.pb.go:1613 +0x14c
google.golang.org/grpc.(*Server).processUnaryRPC(0x400060c8c0, {0x11433b0, 0x400338e9c0}, 0x4000f78240, 0x400055b1a0, 0x1a2d078, 0x0)
        /src/vendor/google.golang.org/grpc/server.go:1282 +0xc38
google.golang.org/grpc.(*Server).handleStream(0x400060c8c0, {0x11433b0, 0x400338e9c0}, 0x4000f78240, 0x0)
        /src/vendor/google.golang.org/grpc/server.go:1619 +0xa54
google.golang.org/grpc.(*Server).serveStreams.func1.2(0x40028c04d0, 0x400060c8c0, {0x11433b0, 0x400338e9c0}, 0x4000f78240)
        /src/vendor/google.golang.org/grpc/server.go:921 +0x94
created by google.golang.org/grpc.(*Server).serveStreams.func1
        /src/vendor/google.golang.org/grpc/server.go:919 +0x1f0

When doing the following:

  1. Pull alpine image for a few platforms
  2. Run the same execop on each of the platform images
  3. Build and push a multiplatform image with the results of those execops
  4. Pull that new multiplatform image
  5. Run the same execops on each pulled platform image

I consistently get that nil pointer exception on step 5. This is all in the context of experimental Dagger code, so I don't have a pure LLB reproducer yet, but can update one when I have a a free min.

Not immediately sure what's happening, it seems like this result must be a typed nil: https://github.com/sipsma/buildkit/blob/61307b8f2e73d681721b51856c10cb8606e5ea70/frontend/gateway/gateway.go#L601-L601

But not sure if that's an expected but unhandled case or a totally unexpected case.

@tonistiigi
Copy link
Member

I think I fixed similar cases in #3025 and @jedevc did the same for refs.

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 a pull request may close this issue.

2 participants