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
We expect containers to be spread across the workers.
Actual results
We get workers with an disproportionate amount of containers. Often resulting in our builds failing because they've hit the container limit even if there are other workers that have plenty of room.
So I have a guess as to why people run into issues like this still. I think it's because FindOrSelectWorker() can be called any number of times in parallel:
This function is how each step selects a worker and is the main entry point to container placement. We can see where it's getting called:
So if there's no limit on how many get/put/task steps are being run at any given time, I think it's highly likely that you can end up in a situation where there are a bunch of steps trying to find workers at the same time. They all look at the current data available to them and make the same choice which then goes over the limits set by operators and your worker falls over.
My current theory is that putting a rate limit on the number of calls to FindOrSelectWorker() would help with this general "workers failing" issue. It would likely mean steps take a bit longer to initialize, but I'd wager that situation is better than "my entire job failed because the worker fell over".
I actually have another theory now from when I was helping someone on discord.
Now as to why the container limit is not being respected... I think it has to do with the fact that the worker placement decision happens on the web nodes and the active_containers number comes directly from the worker (not 100% sure about this "fact"). That number is periodically updated by the worker. I forget the frequency but I'd guess it's something like every 30s. This means the active_containers number could end up being very stale from the web nodes perspective.
Reacted by Chris Burns, caseybraithwaite and Karen Huddleston
Looking at this again and I think I previously conflated this issue with some other behaviour I had seen related to container scheduling.
My previous comment was referring to an issue I've observed where users set the CONCOURSE_MAX_ACTIVE_CONTAINERS_PER_WORKER to some value, and then Concourse goes past that value. This is a different issue from what OP was posting. Let's ignore what I previously commented and focus on OP's issue.
OP was saying the strategies they passed in were not being used at all. Looking at the images posted, it looks like only the volume-locality strategy is being used based on how extremely skewed container placement is.
The only time I've seen this is in environments where multiple web nodes are being used, and one of the web nodes is not configured with the container placement strategies as other web nodes. Once all web nodes had the same configuration, container placement worked as expected.
I've locally tested this by running a Concourse cluster with 4 workers and running a job that generates multiple task containers. I saw a very even distribution of the containers across all four workers. The tasks did all have multiple input volumes, which would have skewed container placement if volume locality was being used.
Default using volume-locality, one worker gets most of the containers:
Setting all three container placement strategies to limit-active-containers,fewest-build-containers, with max containers set to 10:
A nearly even distribution of containers across all four workers.
I think OP has a configuration issue. From what I can tell, container placement works as expected. It looks like you're using the helm chart, so maybe there's a bug in there that's not correctly setting the placement strategies? I did a quick test rendering the helm chart with custom placement strategies and it appears to be rendered correctly. https://ci.concourse-ci.org/ is also deployed with the helm chart and is using a non-default container placement strategy. I can see our container distribution is pretty even:
I'm going to open a PR that adds an info log line to the web command that will print all strategies being used. That should help operators verify if there's a configuration issue with any of their web nodes. That PR will close this issue.
If you're still seeing this issue please comment here. Like I said, this may be a helm configuration issue. As far as I can tell, if configured, container placement strategies do work as expected.
Activity
xtremerui commentedon Oct 10, 2023
Just want to make sure if CONCOURSE_MAX_ACTIVE_CONTAINERS_PER_WORKER is set
ChrisJBurns commentedon Oct 11, 2023
This is on the

webdeployment:This is on the stateful set for the workers:

We are adding this value in the Helm Chart:
concourse.web.limitActiveContainers: 200So it doesn't seem to be honouring the max container limit since the screenshot in the original post had workers with over 200 containers
mhlic commentedon Oct 31, 2023
We are also seeing this behavior with the containers not being spread out, and the
limit-active-containersnot being respectedChrisJBurns commentedon Feb 28, 2024
@xtremerui Any updates on the above?
taylorsilva commentedon Apr 4, 2024
So I have a guess as to why people run into issues like this still. I think it's because
FindOrSelectWorker()can be called any number of times in parallel:concourse/atc/worker/pool.go
Line 45 in 86386eb
This function is how each step selects a worker and is the main entry point to container placement. We can see where it's getting called:

So if there's no limit on how many get/put/task steps are being run at any given time, I think it's highly likely that you can end up in a situation where there are a bunch of steps trying to find workers at the same time. They all look at the current data available to them and make the same choice which then goes over the limits set by operators and your worker falls over.
My current theory is that putting a rate limit on the number of calls to
FindOrSelectWorker()would help with this general "workers failing" issue. It would likely mean steps take a bit longer to initialize, but I'd wager that situation is better than "my entire job failed because the worker fell over".I actually have another theory now from when I was helping someone on discord.
analytically commentedon Mar 15, 2025
taylorsilva commentedon Apr 18, 2026
Looking at this again and I think I previously conflated this issue with some other behaviour I had seen related to container scheduling.
My previous comment was referring to an issue I've observed where users set the
CONCOURSE_MAX_ACTIVE_CONTAINERS_PER_WORKERto some value, and then Concourse goes past that value. This is a different issue from what OP was posting. Let's ignore what I previously commented and focus on OP's issue.OP was saying the strategies they passed in were not being used at all. Looking at the images posted, it looks like only the
volume-localitystrategy is being used based on how extremely skewed container placement is.The only time I've seen this is in environments where multiple web nodes are being used, and one of the web nodes is not configured with the container placement strategies as other web nodes. Once all web nodes had the same configuration, container placement worked as expected.
I've locally tested this by running a Concourse cluster with 4 workers and running a job that generates multiple task containers. I saw a very even distribution of the containers across all four workers. The tasks did all have multiple input volumes, which would have skewed container placement if volume locality was being used.
Default using
volume-locality, one worker gets most of the containers:Setting all three container placement strategies to
limit-active-containers,fewest-build-containers, with max containers set to10:A nearly even distribution of containers across all four workers.
I think OP has a configuration issue. From what I can tell, container placement works as expected. It looks like you're using the helm chart, so maybe there's a bug in there that's not correctly setting the placement strategies? I did a quick test rendering the helm chart with custom placement strategies and it appears to be rendered correctly. https://ci.concourse-ci.org/ is also deployed with the helm chart and is using a non-default container placement strategy. I can see our container distribution is pretty even:
I'm going to open a PR that adds an
infolog line to thewebcommand that will print all strategies being used. That should help operators verify if there's a configuration issue with any of their web nodes. That PR will close this issue.If you're still seeing this issue please comment here. Like I said, this may be a helm configuration issue. As far as I can tell, if configured, container placement strategies do work as expected.