gitpod-io / gitpod-io/gitpod

Enabling 'Cancel Prebuilds on Outdated Commits' Causes Some Prebuilds to Be Marked as SYSTEM ERROR / Failed

Open
#13,874 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

aspect: error-handling feature: prebuilds meta: never-stale team: webapp type: bug
Dominant language
TypeScript
Stars
13.8k
Forks
1.4k
Avg merge
17h 58m
Merged PRs (30d)
5

Description

Bug description

When enabling the 'Cancel Prebuilds on Outdated Commits' functionality on a project it can cause some prebuilds to go into a SYSTEM ERROR state and the prebuilt workspace is marked as failed. It also logs as an ERROR in the cluster - "workspace failed". This appears to mostly happen when a prebuild is longer running and a new commit is pushed to the projects repository.

While there actually does seem to be an error because the prebuild is "prematurely" stopped I don't believe we should mark this as an error or as failed. The reason why there's an error is because it was cancelled which can causes processes (like init tasks) to just exit or not run to their completion.

Screen Shot 2022-10-14 at 10 09 47

You'll notice in that screenshot the top prebuild is okay because I didn't make any more quick commit and pushes so the prebuild was allowed to fully run.

I believe there should be two things done here:

  • Don't log this as an error in cluster logs.
  • Always ensure workspaces are marked as Cancelled by the 'Cancel Prebuilds on Outdated Commits' functionality.
Steps to reproduce
  1. You can fork my repository I used to reproduce this issue.
  2. Setup a new project in Gitpod using this repository.
  3. Within the projects Settings > General, ensure that 'Cancel Prebuilds on Outdated Commits' is checked off.
  4. Open a new workspace for this project.
  5. You can use the test.txt file to make modifications too. I just kept adding a couple characters, or whatever and then committed and pushed the change.
  6. Modify the file again, commit and push the changes again. I repeated this 2-3 more times.
  7. Observe on the prebuild tab of your project that you see a bunch of SYSTEM ERRORs.
Workspace affected

jimmybranca-gitpoddocke-0y4i1f054dq

Expected behavior

I would expect that workspaces that are cancelled when using the 'Cancel Prebuilds on Outdated Commits' are left marked as Cancelled in the UI.

Example repository

https://github.com/jimmybrancaccio/gitpod-docker-compose

Anything else?
SELECT * FROM d_b_prebuilt_workspace WHERE id = 'a669c48a-2c25-4a3b-84bc-bb3b35b5b10d';

Front logo Front conversations

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the linked gitpod-docker-compose repository and the documented sequence of rapid commits while prebuild cancellation is enabled. Trace the prebuild cancellation and workspace-state handling paths; done means cancelled prebuilds are shown as Cancelled rather than Failed and cancellation does not produce an error-level cluster log.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.