You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
build post-commit container names are not unique #8266
users shouldn't have to clean up all their dead containers to be able to use this function. I think we need to append a unique suffix to the container name, if we're going to explicitly name them.
reducing to p3 because i think i hit this via a timing window (I killed my setup while the container was running, whereas normally the code would have removed the container after it finished). so it's less likely someone hits this under normal circumstances.
I suspect the "clean up" left some dirty state? It is possible that if you interrupt the server while a build hook is running, the hook container will not be cleaned up, leading to the situation described in the issue.
Perhaps now our clean up scripts should remove not only k8s_* prefixed containers, but also openshift_*...
And we should also fix openshift/source-to-image#433 to "namespace" containers created by S2I, and remove them in the clean up script.
Here's the original discussion where it was decided that we don't want the random suffix: #6715 (comment)
I suspect the "clean up" left some dirty state? It is possible that if you interrupt the server while a build hook is running, the hook container will not be cleaned up, leading to the situation described in the issue.
right, that's what i was implying in my follow up comment.
Perhaps now our clean up scripts should remove not only k8s_* prefixed containers, but also openshift_*...
perhaps, but i still think we should be using unique names. k8s/openshift do not have this problem for other containers they launch (you don't have to clean up dead containers to rerun something).
And we should also fix openshift/source-to-image#433 to "namespace" containers created by S2I, and remove them in the clean up script.
+1
Here's the original discussion where it was decided that we don't want the random suffix: #6715 (comment)
thanks, it's a fair point i suppose, but if you've got two concurrent builds running w/ the same name, running two instances of the post-commit image seems like the least of your worries (they are unlikely to intterfere with each other anyway). Not to mention it could happen if the two builds were running on distinct nodes anyway, so using the same name doesn't actually protect you from all that much. @smarterclayton ?
I would expect the post-commit container names to be correlated to the
build and build namespace effectively so that they are unique across all
builds, for sure. I don't think we have to protect against two builds
running with the same name (they'd have to have the same pod, which means
something in Kube is horribly broken that we would fix first).
On Tue, Mar 29, 2016 at 8:50 AM, Ben Parees [email protected]
wrote:
I suspect the "clean up" left some dirty state? It is possible that if you
interrupt the server while a build hook is running, the hook container will
not be cleaned up, leading to the situation described in the issue.
right, that's what i was implying in my follow up comment.
Perhaps now our clean up scripts should remove not only k8s_* prefixed
containers, but also openshift_*...
perhaps, but i still think we should be using unique names. k8s/openshift
do not have this problem for other containers they launch (you don't have
to clean up dead containers to rerun something).
Here's the original discussion where it was decided that we don't want the
random suffix: #6715#6715
(comment)
thanks, it's a fair point i suppose, but if you've got two concurrent
builds running w/ the same name, running two instances of the post-commit
image seems like the least of your worries (they are unlikely to intterfere
with each other anyway). Not to mention it could happen if the two builds
were running on distinct nodes anyway, so using the same name doesn't
actually protect you from all that much. @smarterclayton https://github.com/smarterclayton ?
—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub #8266 (comment)
(and we already have pruning to take care of old containers in case we accidentally leave one around...though i'm not sure if pruning applies to these containers?)
Most likely it does not apply, since nothing outside of the builder knows about it...
right, i'm not sure how pruning identifies containers for pruning. I actually think it may prune any stopped containers not associated w/ a pod, in which case these would qualify. If not, our assemble containers would also not be subject to pruning, which is a bigger problem.
@ncdc can you comment on how containers are identified for pruning?
ALL of our container names should be deterministic, period, full stop. Anything you guys create on the node in a build you have to take responsibility to clean up, or clean up on reentrance safely. Unique names is pretending that leaving containers around that aren't cleaned up isn't a huge problem.
these are orthogonal statements. If things are working correctly, then the reentrant "clean up when we detect a collision" logic would never get triggered anyway, so that's not a useful way to deal with the dead container cleanup problem.
Dead containers should be handled via pruning mechanisms, just like the rest of k8s does today. (whether that is actually true or not is something we're currently trying to determine...) Which means the names can be as unique as we want.
(I don't know how our assemble container is named today, i think it's always unique, it should be updated to match the naming convention used by the post-commit container, whatever we decide)
we should use a common convention for naming the assemble and post-commit containers (and any other containers we create).
that convention should, imo, include a unique suffix (subject to on-going debate).
we need to get those containers included in the system container pruning logic, which I do not believe they currently are.
Note that none of this is a huge problem today because we rm the container when we're done with it, so it only gets left around if the system gets killed in the middle of a build/post-commit operation.
Which can happen today pretty easily just by a) deleting a build or b)
deleting a pod
On Wed, Mar 30, 2016 at 10:54 AM, Ben Parees [email protected]
wrote:
So i feel like the summary here is:
we should use a common convention for naming the assemble and
post-commit containers (and any other containers we create).
that convention should, imo, include a unique suffix (subject to
on-going debate).
we need to get those containers included in the system container
pruning logic, which I do not believe they currently are.
Note that none of this is a huge problem today because we rm the container
when we're done with it, so it only gets left around if the system gets
killed in the middle of a build/post-commit operation.
—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub #8266 (comment)
Basically, if you're going to use a random suffix, you still need to define
a prefix and own the prefix going in. You probably also have to be
responsible for other things under that prefix and cleaning them up. In
fact, every build start on a node should probably be cleaning up other
leftovers based on the determistiic prefix.
On Wed, Mar 30, 2016 at 11:04 AM, Clayton Coleman [email protected]
wrote:
Which can happen today pretty easily just by a) deleting a build or b)
deleting a pod
On Wed, Mar 30, 2016 at 10:54 AM, Ben Parees [email protected]
wrote:
So i feel like the summary here is:
we should use a common convention for naming the assemble and
post-commit containers (and any other containers we create).
that convention should, imo, include a unique suffix (subject to
on-going debate).
we need to get those containers included in the system container
pruning logic, which I do not believe they currently are.
Note that none of this is a huge problem today because we rm the
container when we're done with it, so it only gets left around if the
system gets killed in the middle of a build/post-commit operation.
—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub #8266 (comment)
Basically, if you're going to use a random suffix, you still need to define a prefix and own the prefix going in. You probably also have to be responsible for other things under that prefix and cleaning them up. In fact, every build start on a node should probably be cleaning up other leftovers based on the determistiic prefix.
still an orthogonal issue. not using a random suffix solves very little of the cleanup problem. almost none of it. cleanup needs to be handled explicitly (as you say, either by us using a common prefix and adding logic, or by updating the k8s logic to include our containers).
Sure - the issues then are that a) we don't guarantee that we clean up
containers, and b) we don't prevent simultaneous execution. Can make a
case for simultaneous execution?
On Wed, Mar 30, 2016 at 11:29 AM, Ben Parees [email protected]
wrote:
Basically, if you're going to use a random suffix, you still need to
define a prefix and own the prefix going in. You probably also have to be
responsible for other things under that prefix and cleaning them up. In
fact, every build start on a node should probably be cleaning up other
leftovers based on the determistiic prefix.
still an orthogonal issue. not using a random suffix solves very little of
the cleanup problem. almost none of it. cleanup needs to be handled
explicitly (as you say, either by us using a common prefix and adding
logic, or by updating the k8s logic to include our containers).
—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub #8266 (comment)
Sure - the issues then are that a) we don't guarantee that we clean up containers, and b) we don't prevent simultaneous execution. Can make a case for simultaneous execution?
we do prevent simultaneous execution. you cannot create two build objects w/ the same name.
use unique suffixes, this protects end users from spurious failures if we do a bad job cleaning up containers. (this issue, but should fix the assemble container names too, though they are currently unique).
This makes code more complicated and doesn't always guarantee the container gets removed.
Under which circumstances does the build container receive SIGTERM (/ SIGQUIT / SIGINT)?
We really need a way to hook into the platform pruning mechanisms (2), or the long term goal of having better platform support so that builds don't start their own unmanaged containers.
This makes code more complicated and doesn't always guarantee the
container gets removed.
Under which circumstances does the build container receive SIGTERM (/
SIGQUIT / SIGINT)?
We really need a way to hook into the platform pruning mechanisms (2), or
the long term goal of having better platform support so that builds don't
start their own unmanaged containers.
—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub #8266 (comment)
Activity
bparees commentedon Mar 28, 2016
(by stopped my system, i mean cleaned out etcd/etc. hence the reason my build sequence id went back to "1" and caused the conflict)
bparees commentedon Mar 28, 2016
reducing to p3 because i think i hit this via a timing window (I killed my setup while the container was running, whereas normally the code would have removed the container after it finished). so it's less likely someone hits this under normal circumstances.
rhcarvalho commentedon Mar 29, 2016
I suspect the "clean up" left some dirty state? It is possible that if you interrupt the server while a build hook is running, the hook container will not be cleaned up, leading to the situation described in the issue.
Perhaps now our clean up scripts should remove not only
k8s_*prefixed containers, but alsoopenshift_*...And we should also fix openshift/source-to-image#433 to "namespace" containers created by S2I, and remove them in the clean up script.
Here's the original discussion where it was decided that we don't want the random suffix: #6715 (comment)
bparees commentedon Mar 29, 2016
right, that's what i was implying in my follow up comment.
perhaps, but i still think we should be using unique names. k8s/openshift do not have this problem for other containers they launch (you don't have to clean up dead containers to rerun something).
+1
thanks, it's a fair point i suppose, but if you've got two concurrent builds running w/ the same name, running two instances of the post-commit image seems like the least of your worries (they are unlikely to intterfere with each other anyway). Not to mention it could happen if the two builds were running on distinct nodes anyway, so using the same name doesn't actually protect you from all that much. @smarterclayton ?
smarterclayton commentedon Mar 29, 2016
I would expect the post-commit container names to be correlated to the
build and build namespace effectively so that they are unique across all
builds, for sure. I don't think we have to protect against two builds
running with the same name (they'd have to have the same pod, which means
something in Kube is horribly broken that we would fix first).
On Tue, Mar 29, 2016 at 8:50 AM, Ben Parees [email protected]
wrote:
rhcarvalho commentedon Mar 30, 2016
Looks like we have at least two ways out here:
bparees commentedon Mar 30, 2016
personally i like the random suffix
bparees commentedon Mar 30, 2016
(and we already have pruning to take care of old containers in case we accidentally leave one around...though i'm not sure if pruning applies to these containers?)
rhcarvalho commentedon Mar 30, 2016
Most likely it does not apply, since nothing outside of the builder knows about it...
bparees commentedon Mar 30, 2016
right, i'm not sure how pruning identifies containers for pruning. I actually think it may prune any stopped containers not associated w/ a pod, in which case these would qualify. If not, our assemble containers would also not be subject to pruning, which is a bigger problem.
@ncdc can you comment on how containers are identified for pruning?
8 remaining items
bparees commentedon Mar 30, 2016
these are orthogonal statements. If things are working correctly, then the reentrant "clean up when we detect a collision" logic would never get triggered anyway, so that's not a useful way to deal with the dead container cleanup problem.
Dead containers should be handled via pruning mechanisms, just like the rest of k8s does today. (whether that is actually true or not is something we're currently trying to determine...) Which means the names can be as unique as we want.
rhcarvalho commentedon Mar 30, 2016
It is always unique, but completely arbitrary, generated by Docker, see openshift/source-to-image#395
bparees commentedon Mar 30, 2016
So i feel like the summary here is:
Note that none of this is a huge problem today because we rm the container when we're done with it, so it only gets left around if the system gets killed in the middle of a build/post-commit operation.
smarterclayton commentedon Mar 30, 2016
Which can happen today pretty easily just by a) deleting a build or b)
deleting a pod
On Wed, Mar 30, 2016 at 10:54 AM, Ben Parees [email protected]
wrote:
smarterclayton commentedon Mar 30, 2016
Basically, if you're going to use a random suffix, you still need to define
a prefix and own the prefix going in. You probably also have to be
responsible for other things under that prefix and cleaning them up. In
fact, every build start on a node should probably be cleaning up other
leftovers based on the determistiic prefix.
On Wed, Mar 30, 2016 at 11:04 AM, Clayton Coleman [email protected]
wrote:
ncdc commentedon Mar 30, 2016
They are included
ncdc commentedon Mar 30, 2016
Oops, they aren't included. Misread the code.
bparees commentedon Mar 30, 2016
still an orthogonal issue. not using a random suffix solves very little of the cleanup problem. almost none of it. cleanup needs to be handled explicitly (as you say, either by us using a common prefix and adding logic, or by updating the k8s logic to include our containers).
bparees commentedon Mar 30, 2016
(or by rearchitecting the entire build system to use managed pods instead of manual container launches)
smarterclayton commentedon Mar 30, 2016
Sure - the issues then are that a) we don't guarantee that we clean up
containers, and b) we don't prevent simultaneous execution. Can make a
case for simultaneous execution?
On Wed, Mar 30, 2016 at 11:29 AM, Ben Parees [email protected]
wrote:
bparees commentedon Mar 30, 2016
we do prevent simultaneous execution. you cannot create two build objects w/ the same name.
bparees commentedon Mar 30, 2016
@smarterclayton and I chatted offline, path forward is:
rhcarvalho commentedon Mar 31, 2016
+1, #8316 and openshift/source-to-image#395 (working on a fix)
+1, kubernetes/kubernetes#23640
#8306 and openshift/source-to-image#452
This makes code more complicated and doesn't always guarantee the container gets removed.
Under which circumstances does the build container receive SIGTERM (/ SIGQUIT / SIGINT)?
We really need a way to hook into the platform pruning mechanisms (2), or the long term goal of having better platform support so that builds don't start their own unmanaged containers.
smarterclayton commentedon Mar 31, 2016
Every container on the system will ALWAYS receive SIGTERM, get at least 2
seconds to shut down, and then get SIGKILL.
On Thu, Mar 31, 2016 at 8:36 AM, Rodolfo Carvalho [email protected]
wrote: