docker / for-mac

Bug reports for Docker Desktop for Mac
https://www.docker.com/products/docker#/mac
2.43k stars 118 forks source link

"docker pull" panics under docker Version 17.04.0-ce-rc2-mac6 (16165) #1515

Closed evantorrie closed 7 years ago

evantorrie commented 7 years ago

Expected behavior

docker pull from private repository successfully pulls image

Actual behavior

[11:20] evant@localhost:~$ docker pull docker-registry.<..>.com:4443/sd_platform/platform-rhel6:5.0.37
5.0.37: Pulling from sd_platform/platform-rhel6

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

goroutine 1 [running]:
panic(0x461fa00, 0xc420014130)
    /usr/local/go/src/runtime/panic.go:500 +0x1a1
github.com/docker/docker/vendor/github.com/Nvveen/Gotty.(*TermInfo).GetAttribute(0x0, 0x46cd122, 0x3, 0x0, 0xc420440000, 0x10, 0x5064000)
    /go/src/github.com/docker/docker/vendor/github.com/Nvveen/Gotty/gotty.go:94 +0x140
github.com/docker/docker/vendor/github.com/Nvveen/Gotty.(*TermInfo).Parse(0x0, 0x46cd122, 0x3, 0xc420014a00, 0x1, 0x1, 0xc4201876d0, 0x4061055, 0xc4203d2000, 0xc420016280)
    /go/src/github.com/docker/docker/vendor/github.com/Nvveen/Gotty/parser.go:42 +0x5a
github.com/docker/docker/pkg/jsonmessage.cursorUp(0x49c2460, 0xc4202f0c90, 0x49c29e0, 0x0, 0x1)
    /go/src/github.com/docker/docker/pkg/jsonmessage/jsonmessage.go:144 +0xec
github.com/docker/docker/pkg/jsonmessage.DisplayJSONMessagesStream(0x49c3560, 0xc420016740, 0x49c2460, 0xc4202f0c90, 0x1, 0xc420187901, 0x0, 0x4627520, 0x4630bc0)
    /go/src/github.com/docker/docker/pkg/jsonmessage/jsonmessage.go:263 +0x3e8
github.com/docker/docker/pkg/jsonmessage.DisplayJSONMessagesToStream(0x49c3560, 0xc420016740, 0x49c8f20, 0xc4202f0c90, 0x0, 0x0, 0xc4203da8e4)
    /go/src/github.com/docker/docker/pkg/jsonmessage/jsonmessage.go:292 +0xd5
github.com/docker/docker/cli/command/image.imagePullPrivileged(0x54080f8, 0xc420072178, 0xc420334e70, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    /go/src/github.com/docker/docker/cli/command/image/trust.go:316 +0x1cb
github.com/docker/docker/cli/command/image.runPull(0xc420334e70, 0x7fff5fbff56c, 0x44, 0x0, 0x0, 0xc4203028a0)
    /go/src/github.com/docker/docker/cli/command/image/pull.go:76 +0x2bb
github.com/docker/docker/cli/command/image.NewPullCommand.func1(0xc4203a8d80, 0xc42036f6f0, 0x1, 0x1, 0x0, 0x0)
    /go/src/github.com/docker/docker/cli/command/image/pull.go:32 +0x7c
github.com/docker/docker/vendor/github.com/spf13/cobra.(*Command).execute(0xc4203a8d80, 0xc4200760e0, 0x1, 0x1, 0xc4203a8d80, 0xc4200760e0)
    /go/src/github.com/docker/docker/vendor/github.com/spf13/cobra/command.go:646 +0x26d
github.com/docker/docker/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc42009b440, 0xc42009b8c0, 0xc42030f4b0, 0xc42007e488)
    /go/src/github.com/docker/docker/vendor/github.com/spf13/cobra/command.go:742 +0x377
github.com/docker/docker/vendor/github.com/spf13/cobra.(*Command).Execute(0xc42009b440, 0xc42009b440, 0x49c3920)
    /go/src/github.com/docker/docker/vendor/github.com/spf13/cobra/command.go:695 +0x2b
main.main()
    /go/src/github.com/docker/docker/cmd/docker/docker.go:168 +0xcb

Information

Docker for Mac: version: 17.04.0-ce-rc2-mac6 (142462d3d)
macOS: version 10.12.5 (build: 16F43c)
logs: /tmp/0C29861F-A667-4600-8080-2FBAEA191D17/20170405-112044.tar.gz
[OK]     db.git
[OK]     vmnetd
[OK]     dns
[OK]     driver.amd64-linux
[OK]     virtualization VT-X
[OK]     app
[OK]     moby
[OK]     system
[OK]     moby-syslog
[OK]     db
[OK]     env
[OK]     virtualization kern.hv_support
[OK]     slirp
[OK]     osxfs
[OK]     moby-console
[OK]     logs
[OK]     docker-cli
[OK]     menubar
[OK]     disk

Steps to reproduce the behavior

  1. Start docker
  2. Run docker pull from the command line
thaJeztah commented 7 years ago

Seems to go from; pkg/jsonmessage/jsonmessage.go#L144 -> vendor/github.com/Nvveen/Gotty/parser.go#L42 -> vendor/github.com/Nvveen/Gotty/gotty.go#L94)

And bails out there.

This package was added in https://github.com/docker/docker/pull/28304, so let me ping @ijc25 to have a look :smile:

tonistiigi commented 7 years ago

To reproduce: TERMINFO=foo docker pull <new-image>

The panic happens because if this env is set https://github.com/docker/docker/pull/28304/files#diff-60de284af32e69485152dddbfad68ac3R28 will return an empty typed pointer from this function with nil error. When docker tests if that pointer is nil https://github.com/docker/docker/pull/28304/files#diff-e5b95dcf94c93219182533e487ce4857R262 that condition would be true as the interface is now typed.

Could fix it with some better handling in Docker but I don't really understand the return from OpenTermInfo. Seems like a github.com/Nvveen/Gotty issue to me.

ijc commented 7 years ago

Seems like the code at https://github.com/docker/docker/pull/28304/files#diff-60de284af32e69485152dddbfad68ac3R28 is missing the else case which searches $TERMINFO for termName and constructs the TermInfo.

I'll fix this function up today.

We are already vendoring from a PR https://github.com/Nvveen/Gotty/pull/1. I'll put these fixes into a new PR but I'll also merge both into https://github.com/ijc25/Gotty/tree/master so we have something to vendor.

jeanlaurent commented 7 years ago

I believe this should be reported in docker/docker issue tracker, as this is an upstream component in Docker for Mac

thaJeztah commented 7 years ago

@jeanlaurent opened https://github.com/docker/docker/issues/32400 for tracking

@evantorrie thanks so much for the report!

jeanlaurent commented 7 years ago

I'm going to close that issue, as this is going to be solved upstream.

Thanks a lot @evantorrie, @ijc25 and @thaJeztah

ijc commented 7 years ago

@evantorrie FYI this was fixed in docker engine master via https://github.com/docker/docker/pull/32401 and so should make its way through to docker for mac in the next release.

docker-robott commented 4 years ago

Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle locked