Skip to content

c8d: http fallback nil dereference #48818

@vvoland

Description

@vvoland
2024-11-04T22:17:47.2249278Z panic: runtime error: invalid memory address or nil pointer dereference
2024-11-04T22:17:47.2249542Z [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x564f815be276]
2024-11-04T22:17:47.2249551Z 
2024-11-04T22:17:47.2249711Z goroutine 25382 [running]:
2024-11-04T22:17:47.2250109Z github.com/containerd/containerd/remotes/docker.(*httpFallback).RoundTrip(0xc001717600, 0xc0026352c0)
2024-11-04T22:17:47.2250597Z 	/go/src/github.com/docker/docker/vendor/github.com/containerd/containerd/remotes/docker/resolver.go:737 +0x1a5
2024-11-04T22:17:47.2251065Z go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp.(*Transport).RoundTrip(0xc000545080, 0xc002635180)
2024-11-04T22:17:47.2251607Z 	/go/src/github.com/docker/docker/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/transport.go:161 +0x706
2024-11-04T22:17:47.2251948Z net/http.send(0xc002635180, {0x564f841088a0, 0xc000545080}, {0x564f81630b01?, 0x7f4b12df05b8?, 0x0?})
2024-11-04T22:17:47.2252100Z 	/usr/local/go/src/net/http/client.go:259 +0x5e4
2024-11-04T22:17:47.2252360Z net/http.(*Client).send(0xc0008dede0, 0xc002635180, {0xc003b44ca0?, 0x0?, 0x0?})
2024-11-04T22:17:47.2252506Z 	/usr/local/go/src/net/http/client.go:180 +0x98
2024-11-04T22:17:47.2252652Z net/http.(*Client).do(0xc0008dede0, 0xc002635180)
2024-11-04T22:17:47.2252789Z 	/usr/local/go/src/net/http/client.go:725 +0x8bc
2024-11-04T22:17:47.2252894Z net/http.(*Client).Do(...)
2024-11-04T22:17:47.2253013Z 	/usr/local/go/src/net/http/client.go:590
2024-11-04T22:17:47.2253492Z github.com/containerd/containerd/remotes/docker.(*request).do(0xc001796630, {0x564f84135480, 0xc0008de720})
2024-11-04T22:17:47.2253951Z 	/go/src/github.com/docker/docker/vendor/github.com/containerd/containerd/remotes/docker/resolver.go:592 +0x4be
2024-11-04T22:17:47.2254488Z github.com/containerd/containerd/remotes/docker.(*request).doWithRetries(0xc001796630, {0x564f84135480, 0xc0008de720}, {0x0, 0x0, 0x0})
2024-11-04T22:17:47.2254939Z 	/go/src/github.com/docker/docker/vendor/github.com/containerd/containerd/remotes/docker/resolver.go:601 +0x47
2024-11-04T22:17:47.2255826Z github.com/containerd/containerd/remotes/docker.dockerPusher.push({0xc0034a28c0, {0xc002c4ee71, 0x6}, {0x7f4ab8e5b0f8, 0xc00196aac8}}, {0x564f84135480, 0xc002302f60}, {{0xc0065f64c0, 0x31}, {0xc004ad5090, ...}, ...}, ...)
2024-11-04T22:17:47.2256286Z 	/go/src/github.com/docker/docker/vendor/github.com/containerd/containerd/remotes/docker/pusher.go:121 +0xa49
2024-11-04T22:17:47.2257078Z github.com/containerd/containerd/remotes/docker.dockerPusher.Writer({0xc0034a28c0, {0xc002c4ee71, 0x6}, {0x7f4ab8e5b0f8, 0xc00196aac8}}, {0x564f84135480, 0xc002302f60}, {0xc003b44a10, 0x2, 0x2})
2024-11-04T22:17:47.2257533Z 	/go/src/github.com/docker/docker/vendor/github.com/containerd/containerd/remotes/docker/pusher.go:64 +0x196
2024-11-04T22:17:47.2258064Z github.com/containerd/containerd/content.OpenWriter({0x564f84135480, 0xc002302f60}, {0x7f4ab8d784e8, 0xc002431a70}, {0xc003b44a10, 0x2, 0x2})
2024-11-04T22:17:47.2258471Z 	/go/src/github.com/docker/docker/vendor/github.com/containerd/containerd/content/helpers.go:113 +0xc3
2024-11-04T22:17:47.2259175Z github.com/containerd/containerd/remotes.push({0x564f84135480, 0xc002302f60}, {0x7f4ab8d78488, 0xc00196acd8}, {0x564f8410bc60, 0xc002431a70}, {{0xc0065f64c0, 0x31}, {0xc004ad5090, 0x47}, ...})
2024-11-04T22:17:47.2259598Z 	/go/src/github.com/docker/docker/vendor/github.com/containerd/containerd/remotes/handlers.go:180 +0x2ae
2024-11-04T22:17:47.2260289Z github.com/containerd/containerd/remotes.PushContent.PushHandler.func2({0x564f841354b8, 0xc002502960}, {{0xc0065f64c0, 0x31}, {0xc004ad5090, 0x47}, 0xb9a87, {0x0, 0x0, 0x0}, ...})
2024-11-04T22:17:47.2260710Z 	/go/src/github.com/docker/docker/vendor/github.com/containerd/containerd/remotes/handlers.go:167 +0x2b8
2024-11-04T22:17:47.2261354Z github.com/containerd/containerd/images.HandlerFunc.Handle(0x47?, {0x564f841354b8?, 0xc002502960?}, {{0xc0065f64c0, 0x31}, {0xc004ad5090, 0x47}, 0xb9a87, {0x0, 0x0, ...}, ...})
2024-11-04T22:17:47.2261759Z 	/go/src/github.com/docker/docker/vendor/github.com/containerd/containerd/images/handlers.go:60 +0x63
2024-11-04T22:17:47.2262429Z github.com/containerd/containerd/remotes.PushContent.Handlers.func6({0x564f841354b8, 0xc002502960}, {{0xc0065f64c0, 0x31}, {0xc004ad5090, 0x47}, 0xb9a87, {0x0, 0x0, 0x0}, ...})
2024-11-04T22:17:47.2262882Z 	/go/src/github.com/docker/docker/vendor/github.com/containerd/containerd/images/handlers.go:70 +0x13e
2024-11-04T22:17:47.2263572Z github.com/containerd/containerd/images.HandlerFunc.Handle(0x564f8411c738?, {0x564f841354b8?, 0xc002502960?}, {{0xc0065f64c0, 0x31}, {0xc004ad5090, 0x47}, 0xb9a87, {0x0, 0x0, ...}, ...})
2024-11-04T22:17:47.2263972Z 	/go/src/github.com/docker/docker/vendor/github.com/containerd/containerd/images/handlers.go:60 +0x63
2024-11-04T22:17:47.2264713Z github.com/docker/docker/daemon/containerd.(*ImageService).pushRef.func4.Handlers.1({0x564f841354b8, 0xc002502960}, {{0xc0065f64c0, 0x31}, {0xc004ad5090, 0x47}, 0xb9a87, {0x0, 0x0, 0x0}, ...})
2024-11-04T22:17:47.2265115Z 	/go/src/github.com/docker/docker/vendor/github.com/containerd/containerd/images/handlers.go:70 +0x13e
2024-11-04T22:17:47.2265762Z github.com/containerd/containerd/images.HandlerFunc.Handle(0x0?, {0x564f841354b8?, 0xc002502960?}, {{0xc0065f64c0, 0x31}, {0xc004ad5090, 0x47}, 0xb9a87, {0x0, 0x0, ...}, ...})
2024-11-04T22:17:47.2266157Z 	/go/src/github.com/docker/docker/vendor/github.com/containerd/containerd/images/handlers.go:60 +0x63
2024-11-04T22:17:47.2266527Z github.com/containerd/containerd/images.Dispatch.func1()
2024-11-04T22:17:47.2266945Z 	/go/src/github.com/docker/docker/vendor/github.com/containerd/containerd/images/handlers.go:169 +0xd6
2024-11-04T22:17:47.2267101Z golang.org/x/sync/errgroup.(*Group).Go.func1()
2024-11-04T22:17:47.2267435Z 	/go/src/github.com/docker/docker/vendor/golang.org/x/sync/errgroup/errgroup.go:78 +0x50
2024-11-04T22:17:47.2267679Z created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 25349
2024-11-04T22:17:47.2268007Z 	/go/src/github.com/docker/docker/vendor/golang.org/x/sync/errgroup/errgroup.go:75 +0x96

Failure happens at this line:

But it's really strange - the only reasonable explanation for it would be that f.super.RoundTrip(r) sets the r.URL to nil?

func (f *httpFallback) RoundTrip(r *http.Request) (*http.Response, error) {
// only fall back if the same host had previously fell back
if f.host != r.URL.Host {
resp, err := f.super.RoundTrip(r)
if !isTLSError(err) {
return resp, err
}
}
plainHTTPUrl := *r.URL
plainHTTPUrl.Scheme = "http"
plainHTTPRequest := *r
plainHTTPRequest.URL = &plainHTTPUrl
if f.host != r.URL.Host {

Originally posted by @vvoland in #48812 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/testingcontainerd-integrationIssues and PRs related to containerd integrationkind/bugBugs are bugs. The cause may or may not be known at triage time so debugging may be needed.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions