Woodpecker services appear to be running on UI & API after pipeline completes Component…
- User
Woodpecker services appear to be running on UI & API after pipeline completes
Component
server
Describe the bug
Some regression with newer releases (3.14.x) With kubernetes backend and pipelines defining services, the services are not cleaned properly. The pods from kubernetes backend are destroyed properly, but the woodpecker API still show these steps as state=running.
These are only cleaned after the pipeline times out. This prevents timely deploys as pipeline executions are not getting green status (although, as a mitigation, the pipeline waiting services can be cancelled, after which the deploy can be made).
Steps to reproduce
- Install woodpecker next-d05c597374
- Use kubernetes backend
- Define pipeline with services running infinitely, like running postgres
services: - name: postgres image: public.ecr.aws/docker/library/postgres:16-alpine3.21 ports: - 5432 environment: POSTGRES_PASSWORD: somepass POSTGRES_USER: someuser POSTGRES_DB: somedb steps: - name: wait-for-postgres image: public.ecr.aws/docker/library/postgres:16-alpine3.21 environment: DB_HOST: postgres DB_PORT: 5432 MAX_WAIT: 60 commands: - ./scripts/wait-for-postgres.sh- Run the pipeline, observe pods start for the service and the step
- once wait-for-postgres step completes, the pods are destroyed, but API still shows the service as running, also visible on Web UI.
pr-build > clone (#2): Step: clone Started: 1779195580 Stopped: 1779195594 Type: clone State: success pr-build > postgres (#3): Step: postgres Started: 1779195594 Stopped: 0 Type: service State: running pr-build > wait-for-postgres (#4): Step: wait-for-postgres Started: 1779195596 Stopped: 1779195602 Type: commands State: successExpected behavior
Pipeline services are stopped once the pipeline steps complete, the pipeline completes.
System Info
next-d05c597374 kubernetes backend, bitbucket datacenter forgeAdditional context
No response
Validations
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Assistant
I’ll trace the server’s pipeline/service finalization path, identify the regression, patch production code, and run focused tests plus the repository’s diff checks.
- Assistant
rgisn’t installed in this checkout, so I’m switching tofind/grepand keeping the inspection read-only until the ownership and lifecycle paths are clear. - Assistant
The relevant server cleanup is already centralized in
RPC.Done, but its correctness depends on both persisting and mutating the loaded child objects before workflow status aggregation. I’m testing that path and the runtime teardown path now to see which layer still violates the contract. - Assistant
The first test run hit the container’s process limit during compilation, not a code failure. I’ll rerun serially (
-p 1) and inspect the focused tests’ build constraints; this avoids changing the environment or masking failures. - Assistant
The backend-specific failure is now concrete: Kubernetes
WaitSteplistens only for pod updates. During normal service teardown the pod is deleted, and the waiter can start after deletion (because it first drains logs), so it never completes and the agent never reaches the server’sDonecall. I’m fixing that watcher to handle initial, terminal, and deleted pod states, with deleted detached pods treated as successful cleanup. - Assistant
The patch is compiled and the focused suite is still building the Kubernetes dependency graph serially; no test failure has appeared. The key behavior now covers both deletion events and the “pod was already gone before the watcher started” race.
- Assistant
The normal focused tests pass. I’m doing one race-enabled Kubernetes run as the final verification because informer callbacks and the completion signal are concurrent; this specifically checks that the deletion-state handoff is safe.
- Assistant
The race build is slower than the ordinary suite but remains active without errors. The implementation and ordinary tests are complete; I’m letting this higher-cost check finish before handing off.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.