Skip to content

Job stuck in pending even though all input checks have passed/ran (Global resources enabled) #9620

Closed

Description

@taylorsilva

I noticed a job was stuck in pending with all checks passed like this:

Image

All of the jobs inputs had recently been checked. I noticed one input hadn't been recently checked because it has a check_every interval of 6 hours. I had a hunch this was the resource the job was stuck waiting on to be checked more recently.

I looked in the database and found the resource had the following values set:

id       |last_check_start_time        |last_check_end_time          |last_check_succeeded|next_check_time              |
---------+-----------------------------+-----------------------------+--------------------+-----------------------------+
106439266|2026-06-24 13:08:18.368 -0400|2026-06-24 13:08:41.346 -0400|true                |2026-06-24 13:09:41.346 -0400|

The next_check_time should be last_check_end_time + 6 hours, but it's instead last_check_end_time + 1 minute, the default check interval on the cluster. This is what's messing the job up, because it only starts if all inputs have a next_check_time set after the build's create time.

So next_check_time is being updated, but it somehow incorrectly set next_check_time by just 1 minute instead of 6 hours.

We update the value here:

updated, err := checkIfRowsUpdated(tx, `
UPDATE resource_config_scopes
SET last_check_end_time = now(), last_check_succeeded = $1, next_check_time = now() + make_interval(secs => $2)
WHERE id = $3
`, succeeded, interval.Seconds(), r.id)

So we must have gotten an interval of 1min passed in instead of 6hrs.

Going up the stack, the all to this function effectively happens here:

if _, err := delegate.UpdateScopeLastCheckEndTime(scope, false, interval); err != nil {

And interval is determined here:

interval := step.plan.Interval.Interval
if interval == 0 {
if step.plan.IsResourceCheck() {
interval = atc.DefaultCheckInterval
} else {
interval = atc.DefaultResourceTypeInterval
}
}

So did the planner not pass in the interval and therefore we defaulted back to the system default?

I manually checked the resource and saw next_check_time correctly updated to last_check_end_time + 6 hours.

Ah figured it out. You need global resources enabled. The check_every is stored per resource, so if you have two instances of the resource but they have different check_every's, they'll occasionally clobber each other. The resource with the longer check_every will eventually block any of the jobs it's an input to.

More exact steps:

  1. Global resources enabled
  2. Two pipelines with the same resource config.
    • First pipeline/resource has check_every: 1h
    • Second pipeline/resource has no check_every set so it defaults to system default of 1m
    • For simplicity let's say both pipelines have one job with a second resource that triggers the job. The shared resource is non-triggering
  3. Second pipeline runs, checking both resources. Our resource now has a next_check_time of last_check_end_time + 1m
  4. First pipeline now runs and is stuck in pending because it sees next_check_time is in the past, therefore it waits for the resource to be checked.
    • All calls to check the resource are ignored though because we check last_check_end_time + interval in-memory based on the resource's configuration. This returns last_check_end_time + 1hr in this case, so the resource is not checked.

This will eventually get unstuck once interval is elapsed in the first pipeline.

Thinking to update the logic in TryCreateCheck() to check next_check_time to avoid this situation.

Global resources makes this whole situation confusing for end users trying to understand what's going on, but I think the most important thing is to make sure builds don't get stuck in a pending state.

Reproduction Steps

Set these two pipelines.

test.yml

resources:
  - name: i1
    type: mock

  - name: i2
    type: mock
    check_every: 1h
    source:
      initial_version: v2

jobs:
  - name: job
    plan:
      - get: i1
        trigger: true
      - get: i2

test2.yml

resources:
  - name: i2
    type: mock
    source:
      initial_version: v2

jobs:
  - name: job
    plan:
      - get: i2
  • Let test trigger and run the job
  • Once that job completes, manually trigger the job in test2
  • Wait 1min to elapse since i2 was checked
    Image
  • From your terminal, create a new version for the triggering resource i1:
    fly -t l cr -r test/i1 --from version:m1
    
  • The test pipeline should start a pending job that never starts
    Image

Activity

  1. aliculPix4D commented on Jun 25, 2026

    @aliculPix4D
    Contributor

    Hi @taylorsilva I think we are suffering from this issue a lot. After the upgrade to v8.2.4, we have a huge number of pending jobs like that.

    Our global configuration has:

    • global resources enabled
    • check interval for resource with webhooks is set to 24h

    In our pipelines, we have:

    • git resources with webhook_token configured (these are usually triggering resources, but not always)
    • registry-image resources set with check_every: 24h (almost 100% non-triggering resource). This is the resource that in most cases is blocking; as soon as I manually click to check the jobs start
    • other resources also often have some kind of larger check_every value
    • many resources used as put only, have check_every: never but those should not be relevant since they are alway output and never the input

    Most of the builds stuck in the pending state like this are blocked for hours, but on some builds, sometimes scheduling just seems slow.
    At first, it seems that the build is stuck in a pending state for tens of minutes, but then it just starts... This might just be a coincidence; e.g. developer triggering the check manually, or the check for the blocking resource was scheduled exactly when we looked at the build.

  2. aliculPix4D commented on Jun 25, 2026

    @aliculPix4D
    Contributor

    I went to inspect one of our stuck builds and the global resources can't be an explanation for this one. Here is the full report:

    Environment

    • Global resources: enabled (enable-global-resources)
    • Cluster flags:
      • resource-with-webhook-checking-interval = 24h
      • resource-checking-interval = 7m
    • Pipeline: developers / pipeline-master
    • Job: security (non-manually-triggered)
    • Stuck build: #72 (db id 1183561560, created 2026-06-25 07:23:09+02)

    Relevant job inputs

    Resource Trigger Check config
    daily.time yes check_every: 57m
    repo.git no webhook_token set, no check_every → 24h webhook fallback
    golang-pci.docker no check_every: 24h

    repo.git pipeline snippet:

    - name: repo.git
      type: git
      webhook_token: ((concourse_gh_webhook))
      source:
        uri: [email protected]:foobar/repo.git
        branch: master

    Symptom

    Build #72 stuck pending (but scheduled = true). UI shows input checks passed.

    Root cause (DB)

    NonTriggeringResourcesChecked() is false because repo.git has next_check_time at the column default while last_check_end_time shows a successful recent check:

    scope_id:           347064221
    resource:           repo.git (git)
    last_check_end_time: 2026-06-24 15:22:58+02
    last_check_succeeded: true
    next_check_time:     1970-01-01 00:00:00+01   ← never updated
    build.create_time:   2026-06-25 07:23:09+02
    blocking:            next_check_time < create_time → true
    

    golang-pci.docker and daily.time are not blocking (next_check_time correctly set).

    Difference from #9620 repro

    Not interval clobbering from a sibling pipeline:

    • Scope 347064221 (repo.git) has only one active resource — pipeline-master. No other pipeline shares this scope.
    • golang-pci.docker scope is shared across 11 pipelines; next_check_time is correct there (1 day interval).

    This looks like a check that updated last_check_end_time but left next_check_time at the migration default.

    UPDATE: This one is actually easily explained. We upgraded Concourse from v7.13.2 to v8.2.4. Database migration created new column next_check_time in the table, but given that our resources have a large check_every interval (e.g webhooks with 24h fallback, or check_every: 24h), we need to wait for at least 24h so that at least 1 check is performed for this to function properly.

  3. taylorsilva commented on Jun 26, 2026

    @taylorsilva
    MemberAuthor

    I've got a PR that fixes the issue I initially reported. Looking over your comment now @aliculPix4D to see if I can sus out what's different in that case.

  4. taylorsilva commented on Jun 26, 2026

    @taylorsilva
    MemberAuthor

    Just read your entire comment and sounds like you figured out why, as per your update, which makes sense to me. I'd be worried if the next_check_time WASN'T updated after 24hrs, but sounds like it's all good? Am I correct about that? Just want to be sure we don't need a second issue opened.

  5. aliculPix4D commented on Jun 26, 2026

    @aliculPix4D
    Contributor

    but sounds like it's all good? Am I correct about that? Just want to be sure we don't need a second issue opened.

    Hi,

    Yes, you are correct. I don't think we need another issue. I think this is now resolved for us.

    We were definitely hit by the bug you are describing here, but at the same time, we had many other stuck cases that just had to wait for 24h for the first check to be triggered (or be manually triggered), so the mix of both was a bit overwhelming. The symptoms were exactly as you were describing here, so I was originally 100% sure its the same issue. Sorry for the confussion.

    As a workaround for the issue you are describing, we just disabled the global resources as a temporary workaround. So far, we haven't seen any additional stuck builds due to this.🤞

    Thanks for the quick fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions