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

Add a nil check before accessing sandbox.osSbox #1556

Merged
merged 1 commit into from
Nov 16, 2016
Merged

Conversation

sanimej
Copy link

@sanimej sanimej commented Nov 15, 2016

Following panic was reported by one of the docker users..

Nov 14 18:43:17 docker-demo9-d dockerd[1732]: panic: runtime error: invalid memory address or nil pointer dereference
Nov 14 18:43:17 docker-demo9-d dockerd[1732]: [signal 0xb code=0x1 addr=0x58 pc=0x8c1b44]
Nov 14 18:43:17 docker-demo9-d dockerd[1732]: goroutine 52749 [running]:
Nov 14 18:43:17 docker-demo9-d dockerd[1732]: panic(0x1a9cb40, 0xc82000a080)
Nov 14 18:43:17 docker-demo9-d dockerd[1732]: /usr/local/go/src/runtime/panic.go:481 +0x3e6
Nov 14 18:43:17 docker-demo9-d dockerd[1732]: github.com/docker/libnetwork.(*sandbox).execFunc(0xc82026c000, 0xc820fae450)
Nov 14 18:43:17 docker-demo9-d dockerd[1732]: /root/rpmbuild/BUILD/docker-engine/vendor/src/github.com/docker/libnetwork/sandbox.go:440 +0x44
Nov 14 18:43:17 docker-demo9-d dockerd[1732]: github.com/docker/libnetwork.(*resolver).ServeDNS(0xc820427a70, 0x7fd91c0d5120, 0xc820e19810, 0xc820294120)
Nov 14 18:43:17 docker-demo9-d dockerd[1732]: /root/rpmbuild/BUILD/docker-engine/vendor/src/github.com/docker/libnetwork/resolver.go:357 +0x665
Nov 14 18:43:17 docker-demo9-d dockerd[1732]: github.com/miekg/dns.(*Server).serve(0xc821492820, 0x7fd9218f7a08, 0xc82158a120, 0x7fd91c0d4378, 0xc820427a70, 0xc8210d7200, 0x26, 0x200, 0xc82015e390, 0xc821b862a0, ...)

Its not clear in what can situation sb.osSbox can be nil for a running container. One possibility is the container going down while the query is still being processed. Added a error message which should help in identifying the specific case.

Signed-off-by: Santhosh Manohar [email protected]

osSbox := sb.osSbox
sb.Unlock()
if osSbox != nil {
return sb.osSbox.InvokeFunc(f)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are still accessing sb.osSbox outside lock.
That could have been set to nil before sb.osSbox.InvokeFunc(f) gets a chance to run

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that was a typo.. corrected it. thanks.

Signed-off-by: Santhosh Manohar <[email protected]>
@aboch
Copy link
Contributor

aboch commented Nov 15, 2016

LGTM

1 similar comment
@mavenugo
Copy link
Contributor

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants