Repository navigation
Description
Bug Report
For the last couple of days we've been having a strange issue. Sporadically Concourse seems to be getting stuck at the "preparing build" step, all the pre-requisitives show a ✔️ next to them (so nothing is actually pending as far as we can see) however the job stays stuck forever in that state.
When this starts happening, it affects all jobs in all teams. Fly watch of the pending jobs also hangs and shows no output. I haven't been able to narrow down exactly what fixes it, one time it was retiring+reseting one of the workers. Another time that wasn't enough and I had to delete+recreate the pipeline with the stuck job.
The only error messages I could see in the logs were these (logged when one of the workers was reset):
{"timestamp":"1517591651.263898134","source":"atc","message":"atc.create-job-build.trigger-immediately.try-start-next-pending-build.scan.failed-to-create-container-in-db","log_level":2,"data":{"build-id":8663,"build-name":"70","error":"pq: insert or update on table \"worker_resource_config_check_sessions\" violates foreign key constraint \"worker_resource_config_check__resource_config_check_sessio_fkey\"","input":"npm-debian-image","job_name":"test-mailer-master","resource":"npm-debian-image","session":"48972.1.1.2"}}
{"timestamp":"1517591651.263942957","source":"atc","message":"atc.create-job-build.trigger-immediately.try-start-next-pending-build.scan.failed-to-initialize-new-container","log_level":2,"data":{"build-id":8663,"build-name":"70","error":"pq: insert or update on table \"worker_resource_config_check_sessions\" violates foreign key constraint \"worker_resource_config_check__resource_config_check_sessio_fkey\"","input":"npm-debian-image","job_name":"test-mailer-master","resource":"npm-debian-image","session":"48972.1.1.2"}}
{"timestamp":"1517591651.265183210","source":"atc","message":"atc.create-job-build.trigger-immediately.failed-to-start-next-pending-build-for-job","log_level":2,"data":{"error":"pq: insert or update on table \"worker_resource_config_check_sessions\" violates foreign key constraint \"worker_resource_config_check__resource_config_check_sessio_fkey\"","job-name":"test-mailer-master","job_name":"test-mailer-master","session":"48972.1"}}
(the above was printed for multiple jobs, above are just the logs for one of the jobs)
We also see the messages below quite frequently on a regular basis (but since they also show up when everything is running normally I'm not sure they are relevant):
{"timestamp":"1518004152.986703157","source":"atc","message":"atc.volume-collector.run.orphaned-volumes.mark-created-as-destroying.failed-to-transition","log_level":2,"data":{"error":"volume cannot be destroyed as children are present","session":"62.13706.1.43","volume":"69b59425-83cd-4511-4a7f-f0a011c0b697","worker":"ccn4"}}
The following can also be handy:
- Concourse version: 3.8.0
- Deployment type: binary
- Infrastructure/IaaS: Running on VMs (Debian 8.10 OS with 4.9.0-0.bpo.3-amd64 kernel)
Activity
brownjohnf commentedon Apr 13, 2018
I believe we're also experiencing this, but on concourse 3.10.0.
gojihotsauce commentedon Apr 24, 2018
I can confirm this is happening on 3.11.0 as well.
pn-santos commentedon Apr 30, 2018
We just had this happen again with 3.12 still... not sure if it can be a clue or it's just a fly issue but after aborting a pending build this is what fly showed when listing builds:
(this is the build that was stuck in pending state) the duration is very strange as it was pending for less than 10min until I aborted it...
dpb587 commentedon May 2, 2018
Also been seeing this for a while, including on 3.13.0. I'm only noticing it happen on resources which are shared across many pipelines (e.g. 15+ pipelines). I assume it's some sort of scheduling race, as I've noticed it when 1) concourse is restarted, and 2) occasionally when a new pipeline is created. It does seem to resolve itself eventually, but when the check interval is longer, that can take a while and this is more noticeable.
pn-santos commentedon May 9, 2018
I can confirm that the cause seems to be what @dpb587 suggested. We have several resources shared (i.e. with the exact same configs) across multiple pipelines, and whenever this happens, the jobs in question (stuck with pending) have at least one of those shared resources as input.
Also I tried doing a check-resource on those resources when the jobs get stuck and there is always at least one resource where the
check-resourcefly command just hangs, never returning a response (all other input resource return immediately with success).A restart of the ATC seems to fix the issue and all stuck jobs will resume their builds.
The resource where I've been able to confirm this behavior are git resource.
akamalov commentedon Jul 12, 2018
Concourse 3.14.0 and having the same issue
colmtuohy commentedon Jul 12, 2018
Can confirm we also see this on 3.13.0 also, making the system unusable. Downgrading again to 3.9.2 as a result, as it did not seem as bad then. 3 atcs, 18 workers, apx 1000 pipelines, 600unpaused,
romankartgh commentedon Jul 28, 2018
We ran into the same issue:
pq: insert or update on table "worker_resource_config_check_sessions" violates foreign key constraint "worker_resource_config_check__resource_config_check_sessio_fkey"We have 100+ pipelines. I strongly believe it started happening for us when git resource became unavailable because Gerrit went down. Concourse really fell on its face - not only it wasn't showing any meaningful error messages, there seems to be a possible race condition (see above)
akamalov commentedon Jul 28, 2018
I just had one yesterday. I immediately re-ran the job and it went through. I think it has something to do with job locking or some sort.
vito commentedon Aug 1, 2018
I found a theoretical cause for this. The radar creates a resource config check session but then goes in to a loop to acquire a checking lock, which could take some time if there's already an expensive check running concurrently. It then tries to create the worker resource config check session, and that can fail if the resource config check session expired in the time it took to acquire the lock.
That's a lot of words, but I think we could fix it by moving the find-or-create of the resource config into the lock acquisition loop: https://github.com/concourse/atc/blob/4b1839fd867a3cf306fde63894a4f9efaa33fbf1/radar/resource_scanner.go#L138-L158
This should only happen with manually-triggered builds, so there may be some other cases that trigger this error, too. It's a fundamental problem of creating the RCCS and WRCCS in separate transactions. I'm kind of hoping a lot of this just gets cleaned up as part of #2386.
bump etree tsa handlers mux clockwork goxmldsig genproto grpc
vito commentedon Aug 22, 2018
Next time someone runs into this could you take a stack dump?: https://github.com/concourse/concourse/wiki/Troubleshooting#taking-a-stack-dump
munju commentedon Aug 29, 2018
I happened again... here is the dump:
dump.txt
2 remaining items
clarafu commentedon Dec 17, 2018
This issue was fixed along with #1598, with the fix being to remove the worker resource config check sessions table and merge it with the resource config check sessions table. If you want to read more on the fix you can do so here commit. Another issue was found which was related is #2911 where the resource configs were being gced before they were used. This issue was fixed with a commit that creates and uses the resource configs within one transaction.
evanchaoli commentedon Jan 15, 2019
@clarafu When this fix will be released? We still see this issue in 4.2.2.
vito commentedon Jan 15, 2019
@evanchaoli 5.0
tanner-bruce commentedon Apr 23, 2019
@vito @clarafu I am still seeing this in 5.0.0, 5.0.1 and 5.1.0.
Here is my stackdump: https://gist.github.com/tanner-bruce/e410118ea9710bd9670f9e920221b27d
vlad-ro commentedon Apr 29, 2019
Seeing this as well:
{ "timestamp": "2019-04-29T12:56:17.482867576Z", "level": "error", "source": "atc", "message": "atc.collector.tick.volume-collector.mark-volumes.mark-created-as-destroying.failed-to-transition", "data": { "error": "volume cannot be destroyed as children are present", "session": "21.30613.10.2.2", "volume": "fec219c8-9380-4d34-67d9-55989151e322", "worker": "0b2dc3e69de8" } }vito commentedon May 13, 2019
@tanner-bruce @vlad-ro That log line is a red herring: #1780
DanielJonesEB commentedon May 18, 2019
I'm seeing this in 5.1.0, both BOSH-deployed with Control Tower and via the Helm chart with a customer.
I've had one build sat pending for 40 minutes now:

All bar 8 of the containers are check containers. Web node (AWS t2.large) seems happy:
load average: 0.53, 0.52, 0.55.concourseprocess is spiking up to about 61% CPU. 39 pipelines, a couple of teams, but only one with any pipelines.monit restart allon the web node didn't seem to help, so presumably it's being caused by something in persisted state. Cancelling the build and triggering another one (albeit after thewebprocess restart) got things flowing again.I can't see anything obviously wrong in the logs. Any suggestions of what to look for?
tanner-bruce commentedon May 21, 2019
@vito that log line may be a red herring for sure however I am having the same symptoms as this issue states.
The stack dump I provided is of a cluster stuck in this state. Should I open a new ticket describing what is happening?
DanielJonesEB commentedon May 21, 2019
Happening again on a different pipeline that I'm trying to iterate on. Build was pending for about seven hours. Aborting the build through the UI doesn't work, but
fly abort-buildseems to be reflected in the UI after some time.Something that did help:
vito commentedon May 28, 2019
@tanner-bruce Yeah, please open new issues with stack dumps - comments on closed issues (especially issues like this which are very broadly defined but had a specific resolution) are hard to keep track of and prioritise.
FWIW #3928 may help but I can't really confirm whether it's the root cause for the hanging in your case.
u2g-tg commentedon Jul 16, 2019
I just received these symptoms with 5.1.0, after a manual trigger, then resolving an absent lock for the pool resource. All build pre-steps were ticked, but it didn't transition out of pending.
A restart of the web node caused the job to start working without having to abort it.
yermulnik commentedon Aug 14, 2020
Unpausing unpuased stuck in pending state job helped me as per this post #2010 (comment)