-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Cleanup: refactor parsing and handling of Daemon config #7506
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
Conversation
|
Heads up I'm pushing an update with simplified |
|
@tianon @tibor @crosbymichael I'm not sure why, but this seems to break I bisected the problem to this commit: ca776d7b29f4922cfff6cf1b6234c3b2c3fc1715 Here's the error: |
|
cc @unclejack |
|
@shykes You've bringed daemon code to client side( in |
|
Also need rebase :) |
|
Rebased and fixed cross-compile issue. |
|
There are Travis gofmt issues with your last changes |
|
Fixed gofmt On Mon, Aug 11, 2014 at 3:55 PM, Michael Crosby notifications@github.com
|
|
panic in the runconfig unit tests + go test github.com/docker/docker/runconfig
--- FAIL: TestParseRunLinks (0.00 seconds)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x4d605d]
goroutine 21 [running]:
runtime.panic(0x7a9600, 0xbbf233)
/usr/local/go/src/pkg/runtime/panic.c:279 +0xf5
testing.func·006()
/usr/local/go/src/pkg/testing/testing.go:416 +0x176
runtime.panic(0x7a9600, 0xbbf233)
/usr/local/go/src/pkg/runtime/panic.c:248 +0x18d
github.com/docker/docker/opts.(*ListOpts).String(0xc208000b10, 0x0, 0x0)
/go/src/github.com/docker/docker/opts/opts.go:55 +0x11d
github.com/docker/docker/pkg/mflag.(*FlagSet).Var(0xc2080045a0, 0x7fb57db89c18, 0xc208000b10, 0xc208000cf0, 0x1, 0x1,
0x84ed70, 0x36)
/go/src/github.com/docker/docker/pkg/mflag/flag.go:724 +0x43
github.com/docker/docker/runconfig.parseRun(0xc2080045a0, 0xc2080406c0, 0x4, 0x4, 0x0, 0x4, 0x486e7a, 0xc20804c500, 0x
0, 0x0)
github.com/docker/docker/runconfig/_test/_obj_test/parse.go:84 +0x139f
github.com/docker/docker/runconfig.Parse(0xc2080406c0, 0x4, 0x4, 0x0, 0xc2080406c0, 0x4, 0x4, 0x0, 0x0)
github.com/docker/docker/runconfig/_test/_obj_test/parse.go:31 +0x10c
github.com/docker/docker/runconfig.parse(0xc20804a120, 0x7f5190, 0xa, 0x0, 0x0, 0x0, 0x0)
/go/src/github.com/docker/docker/runconfig/config_test.go:12 +0xcb
github.com/docker/docker/runconfig.mustParse(0xc20804a120, 0x7f5190, 0xa, 0x0, 0x0)
/go/src/github.com/docker/docker/runconfig/config_test.go:17 +0x4c
github.com/docker/docker/runconfig.TestParseRunLinks(0xc20804a120)
/go/src/github.com/docker/docker/runconfig/config_test.go:37 +0x46
testing.tRunner(0xc20804a120, 0xbbdb60)
/usr/local/go/src/pkg/testing/testing.go:422 +0x8b
created by testing.RunTests
/usr/local/go/src/pkg/testing/testing.go:504 +0x8db
|
|
Hum can't reproduce... On Mon, Aug 11, 2014 at 4:38 PM, Michael Crosby notifications@github.com
|
|
Ok, I can reproduce and found the problem, thanks. Fix incoming. |
|
After a slight incident on my dev environment... Finally rebased! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this became a pointer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look at how I implemented ListVar, IPListVar etc above. It's a much better API for parsing special types using flag, without needing to carry a special type in the resulting Config object. It also extends the existing flag API (actually we could probably add it to mflag).
I wanted to do this without disrupting the rest of the code which uses ListOpt. So I modified ListOpt so that it could support both the old usage (via NewListOpts) and the new usage (via newListOptsRef).
|
I have panic on server side with and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand why this was removed from the daemon but why is it not placed back in the request? People are depending on this information like @SvenDowideit with boot2docker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no easy way to access daemon.Sockets from api/server.Server. And I don't think it's worth making the effort, since I don't think a 3d-party tools should depend on this information in the first place. For one thing, it might cause security risks by leaking more information than the sysadmin expects to share with clients. For another, if boot2docker can connect to the daemon to make this query, doesn't it already know how to connect?
TLDR: I don't like how we expose too many internals in our public API and then are stuck having to maintain them. So I don't want to go out of my way to keep them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we remove this, it requires a API bump as it's a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Tue, Aug 12, 2014 at 3:05 PM, Victor Vieux notifications@github.com
wrote:
In daemon/info.go:
@@ -66,7 +66,6 @@ func (daemon *Daemon) CmdInfo(job *engine.Job) engine.Status {
v.Set("IndexServerAddress", registry.IndexServerAddress())
v.Set("InitSha1", dockerversion.INITSHA1)
v.Set("InitPath", initPath)
- v.SetList("Sockets", daemon.Sockets)
If we remove this, it requires a API bump as it's a breaking change.
I have a problem with the way we handle API versions currently. As soon as
we bump the version, new clients refuse to talk to old servers (even though
it would work just fine). How can we fix this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could fallback to the last version handled by the server instead of producing an error and hope it'll work. (it will most of the time, and in that case)
|
I get a lot of panics running the integration-cli tests with this PR. I'll post a couple: --- FAIL: TestCLIGetEventsUntag (0.05 seconds)
utils.go:125: 'images -q' failed with errors: exit status 2 (panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x53ae6d]
goroutine 16 [running]:
runtime.panic(0xb43da0, 0x116b573)
/usr/local/go/src/pkg/runtime/panic.c:279 +0xf5
github.com/docker/docker/opts.(*ListOpts).String(0xc2080e4330, 0x0, 0x0)
/go/src/github.com/docker/docker/opts/opts.go:55 +0x11d
github.com/docker/docker/pkg/mflag.(*FlagSet).Var(0xc208004780, 0x7f0de54a2188, 0xc2080e4330, 0xc208045f80, 0x2, 0x2, 0xc7f6d0, 0x2c)
/go/src/github.com/docker/docker/pkg/mflag/flag.go:724 +0x43
github.com/docker/docker/api/client.(*DockerCli).CmdImages(0xc20804a980, 0xc20800e020, 0x1, 0x1, 0x0, 0x0)
/go/src/github.com/docker/docker/api/client/commands.go:1255 +0x4e3
reflect.callMethod(0xc208094b70, 0x7f0de5302c20)
/usr/local/go/src/pkg/reflect/value.go:761 +0x18b
reflect.methodValueCall(0xc20800e020, 0x1, 0x1, 0xc208094b70, 0x42bb01)
/usr/local/go/src/pkg/reflect/asm_amd64.s:26 +0x24
github.com/docker/docker/api/client.(*DockerCli).Cmd(0xc20804a980, 0xc20800e010, 0x2, 0x2, 0x0, 0x0)
/go/src/github.com/docker/docker/api/client/cli.go:58 +0x25c
main.main()
/go/src/github.com/docker/docker/docker/docker.go:102 +0x827
--- FAIL: TestCLIGetEventsPause (0.06 seconds)
utils.go:125: 'images -q' failed with errors: exit status 2 (panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x53ae6d]
goroutine 16 [running]:
runtime.panic(0xb43da0, 0x116b573)
/usr/local/go/src/pkg/runtime/panic.c:279 +0xf5
github.com/docker/docker/opts.(*ListOpts).String(0xc208037a20, 0x0, 0x0)
/go/src/github.com/docker/docker/opts/opts.go:55 +0x11d
github.com/docker/docker/pkg/mflag.(*FlagSet).Var(0xc208004300, 0x7fb559707188, 0xc208037a20, 0xc208045720, 0x2, 0x2, 0xc7f6d0, 0x2c)
/go/src/github.com/docker/docker/pkg/mflag/flag.go:724 +0x43
github.com/docker/docker/api/client.(*DockerCli).CmdImages(0xc20804a680, 0xc20800e020, 0x1, 0x1, 0x0, 0x0)
/go/src/github.com/docker/docker/api/client/commands.go:1255 +0x4e3
reflect.callMethod(0xc208060930, 0x7fb559566c20)
/usr/local/go/src/pkg/reflect/value.go:761 +0x18b
reflect.methodValueCall(0xc20800e020, 0x1, 0x1, 0xc208060930, 0x42bb01)
/usr/local/go/src/pkg/reflect/asm_amd64.s:26 +0x24
github.com/docker/docker/api/client.(*DockerCli).Cmd(0xc20804a680, 0xc20800e010, 0x2, 0x2, 0x0, 0x0)
/go/src/github.com/docker/docker/api/client/cli.go:58 +0x25c
main.main()
/go/src/github.com/docker/docker/docker/docker.go:102 +0x827 |
|
Yeah I know I'm on it. Thanks. On Tue, Aug 12, 2014 at 1:38 PM, Michael Crosby notifications@github.com
|
|
Fixed panics and rebased. |
|
@shykes got |
|
@vieux thanks, fixed. |
|
LGTM |
|
There is different validation error messages for |
|
That seems like a correct message. Which test triggers it for you? |
|
@shykes Yeah, both messages are correct, but I think they should be same, because this is same validation error. and |
|
I see |
|
@LK4D4 fixed |
opts/ip.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've forgot , val I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks fixed
|
LGTM now |
Signed-off-by: Solomon Hykes <solomon@docker.com>
Signed-off-by: Solomon Hykes <solomon@docker.com>
|
Rebased |
|
Panic in the integration tests [PASSED]: build - ensure --force-rm doesn't leave containers behind
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x53b90d]
goroutine 16 [running]:
runtime.panic(0xb44ce0, 0x116d573)
/usr/local/go/src/pkg/runtime/panic.c:279 +0xf5
github.com/docker/docker/opts.(*ListOpts).String(0xc208039990, 0x0, 0x0)
/go/src/github.com/docker/docker/opts/opts.go:55 +0x11d
github.com/docker/docker/pkg/mflag.(*FlagSet).Var(0xc208004180, 0x7f30ff047188, 0xc208039990, 0xc208047620, 0x2, 0x2,
0xcb6850, 0x57)
/go/src/github.com/docker/docker/pkg/mflag/flag.go:724 +0x43
github.com/docker/docker/api/client.(*DockerCli).CmdPs(0xc20804c380, 0xc20800e020, 0x2, 0x2, 0x0, 0x0)
/go/src/github.com/docker/docker/api/client/commands.go:1488 +0x6e9
reflect.callMethod(0xc20804a060, 0x7f30feea6c20)
/usr/local/go/src/pkg/reflect/value.go:761 +0x18b
reflect.methodValueCall(0xc20800e020, 0x2, 0x2, 0xc20804a060, 0x42bb01)
/usr/local/go/src/pkg/reflect/asm_amd64.s:26 +0x24
github.com/docker/docker/api/client.(*DockerCli).Cmd(0xc20804c380, 0xc20800e010, 0x3, 0x3, 0x0, 0x0)
/go/src/github.com/docker/docker/api/client/cli.go:58 +0x25c
main.main()
/go/src/github.com/docker/docker/docker/docker.go:102 +0x827 |
Signed-off-by: Solomon Hykes <solomon@docker.com>
Signed-off-by: Solomon Hykes <solomon@docker.com>
Signed-off-by: Solomon Hykes <solomon@docker.com>
Signed-off-by: Solomon Hykes <solomon@docker.com>
Signed-off-by: Solomon Hykes <solomon@docker.com>
Signed-off-by: Solomon Hykes <solomon@docker.com>
|
Ah, that was introduced by new changes in master. Ok, fixed. Thanks |
|
To explain the panics: because of the changes to |
|
LGTM @vieux wanna review again, a lot has changed |
|
LGTM |
Cleanup: refactor parsing and handling of Daemon config
daemonconfigintodaemon/config.goNewDaemonfor DRYdaemon.Config.InstallFlagsinstead of inmainThis depends on #7497