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

bugfix: add default host config if not set #4155

Merged
merged 2 commits into from
Apr 6, 2020

Conversation

fuweid
Copy link
Member

@fuweid fuweid commented Apr 4, 2020

If there is not specific host config, like ctr does, the resolver will
fail to get host path. And this patch is to add default host config if
needs.

And default config host config should have all caps for pull and push.

Signed-off-by: Wei Fu fuweid89@gmail.com

@theopenlab-ci
Copy link

theopenlab-ci bot commented Apr 4, 2020

Build succeeded.

@fuweid fuweid force-pushed the bugfix-for-default-hostconfig branch from ddd67f0 to 231714a Compare April 4, 2020 09:58
@theopenlab-ci
Copy link

theopenlab-ci bot commented Apr 4, 2020

Build succeeded.

Copy link
Contributor

@Zyqsempai Zyqsempai left a comment

Choose a reason for hiding this comment

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

LGTM

@fuweid
Copy link
Member Author

fuweid commented Apr 4, 2020

oops #4154

fatal error: sweep increased allocation count
runtime stack:
runtime.throw(0x557208fdf9ca, 0x20)
	/home/travis/.gimme/versions/go1.13.9.linux.amd64/src/runtime/panic.go:774 +0x74
runtime.(*mspan).sweep(0x7fee9e7d0778, 0x7fee9e7d0700, 0x0)
	/home/travis/.gimme/versions/go1.13.9.linux.amd64/src/runtime/mgcsweep.go:328 +0x8cc
runtime.(*mcentral).uncacheSpan(0x55720a6caaf8, 0x7fee9e7d0778)
	/home/travis/.gimme/versions/go1.13.9.linux.amd64/src/runtime/mcentral.go:197 +0x7b
runtime.(*mcache).releaseAll(0x7fee9e86c008)
	/home/travis/.gimme/versions/go1.13.9.linux.amd64/src/runtime/mcache.go:158 +0x6d
runtime.(*mcache).prepareForSweep(0x7fee9e86c008)
	/home/travis/.gimme/versions/go1.13.9.linux.amd64/src/runtime/mcache.go:185 +0x48
runtime.procresize(0x557200000002, 0xc000319800)
	/home/travis/.gimme/versions/go1.13.9.linux.amd64/src/runtime/proc.go:4037 +0x45d
runtime.startTheWorldWithSema(0x557207f9e601, 0xc00006ed10)
	/home/travis/.gimme/versions/go1.13.9.linux.amd64/src/runtime/proc.go:1093 +0x86
runtime.gcMarkTermination.func3()
	/home/travis/.gimme/versions/go1.13.9.linux.amd64/src/runtime/mgc.go:1708 +0x28
runtime.systemstack(0x0)
	/home/travis/.gimme/versions/go1.13.9.linux.amd64/src/runtime/asm_amd64.s:370 +0x63
runtime.mstart()
	/home/travis/.gimme/versions/go1.13.9.linux.amd64/src/runtime/proc.go:1146

@fuweid
Copy link
Member Author

fuweid commented Apr 5, 2020

didn't reproduce the panic in my env. weird

}
}
hosts[len(hosts)-1].path = "/v2"
if len(hosts) == 0 {
Copy link
Member

Choose a reason for hiding this comment

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

The comment is not being addressed and I probably should have added a comment related to hosts[len(hosts)-1].host == "". A configuration may be intentionally blocking the namespace by returning 0, that is why I am differentiating between nil and 0. If there is a bug, then maybe we need to make sure it is nil or find a better way to handle that case. Additionally, the configuration may not be configuring the host, that is why it checks to see if the last element is not set. The configuration would only ever have the last host empty because using the Docker-compatible cert files only one entry is set (with no host), or using the config file with defaults but not setting a host override.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK. will change back with > 1 to >=1.

Copy link
Member Author

@fuweid fuweid Apr 5, 2020

Choose a reason for hiding this comment

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

before this commit, the empty host doesn't work because the make([]hostConfig, 1) has one element which never meet >1 condition. `

@fuweid fuweid force-pushed the bugfix-for-default-hostconfig branch from 231714a to 0f73216 Compare April 5, 2020 05:16
@theopenlab-ci
Copy link

theopenlab-ci bot commented Apr 5, 2020

Build succeeded.

@fuweid fuweid force-pushed the bugfix-for-default-hostconfig branch from 0f73216 to 452a954 Compare April 5, 2020 14:34
@theopenlab-ci
Copy link

theopenlab-ci bot commented Apr 5, 2020

Build succeeded.

fuweid and others added 2 commits April 6, 2020 14:38
If there is not specific host config, like ctr does, the resolver will
fail to get host path. And this patch is to add default host config if
needs.

And default config host config should have all caps for pull and push.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
@dmcgowan dmcgowan force-pushed the bugfix-for-default-hostconfig branch from 452a954 to 067aba7 Compare April 6, 2020 21:40
Copy link
Member

@dmcgowan dmcgowan left a comment

Choose a reason for hiding this comment

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

Unit test added, LGTM

@theopenlab-ci
Copy link

theopenlab-ci bot commented Apr 6, 2020

Build succeeded.

@dmcgowan dmcgowan merged commit 173cbc1 into containerd:master Apr 6, 2020
@fuweid fuweid deleted the bugfix-for-default-hostconfig branch April 22, 2020 11:34
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