Skip to content

[ws-manager] gracefully shuts down workspace, leaving behind bound PVCs, avoiding backup of user data, after unknown event #14266

@kylos101

Description

@kylos101

Bug description

In other words, we don't experience data loss, but, the pod stops gracefully, and when the user starts the workspace again, they would not have their data...even though we have it in a PV.

I tried deleting us72, but could not because there were two dangling PVC:

gitpod /workspace/gitpod (main) $ kubectl get pvc
NAME                                      STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS             AGE
ws-ccd64f44-d3b6-49eb-9d1e-9275406745ef   Bound    pvc-35a16057-d21c-44e2-9a76-a36f44fb1866   30Gi       RWO            csi-gce-pd-g1-standard   47h
ws-eb6cb985-86f3-435b-9def-d820d2b9060a   Bound    pvc-50708c34-a721-4f3d-855e-f74c94e2c034   30Gi       RWO            csi-gce-pd-g1-standard   45h

For the first...given workspace logs and this workspace trace:

  1. Startworkspace is logged on workspace
  2. It cannot be scheduled (waiting for scale-up)
  3. Start workspace is logged again after 7 minutes (still not scheduled to a node)
    1. Which lines up with us seeing startWorkspace error at 7m in the traces
    2. We poll for seven minutes, to see if the pending pod should be recreated, and startWorkspace called again
    3. We force delete the original pod and try starting again using original context 🤯
  4. csi provisioner is started for this workspace
  5. Ring 0 stops, we must've landed on workspace-ws-us72-standard-pvc-pool-2dvw
  6. workspace cannot connect to ws-daemon
  7. workspace fails to start, the volume snapshot is empty
  8. workspace fails to start is logged again

Steps to reproduce

This could be because of:

  1. node scale-up that is too slow (given the logs, perhaps).
  2. Another possibility, is that we restarted ws-manager "during a key moment", and it the snapshot did not proceed. We restarted ws-manager a couple times this week.
  3. The 1h timeout, which is a byproduct from when we persisted using node storage and backed up using GCS

So, either:

  1. Create an ephemeral cluster
  2. Start many workspaces with loadgen, causing node scale-up, if it takes >7 minutes, you'll hit the code path that was involved for these two workspaces
  3. Stop the workspaces
  4. Check to see if they backed up, or, left behind PVCs.

or maybe

Stop a bunch of workspaces, and while they're stopping (before, during, and after snapshot) stop ws-manager.

or maybe

timeout after an hour

Workspace affected

gitpodio-templatetypesc-qxnleu3pzu4

Expected behavior

There are a few things:

  1. We should try to backup for longer than 1 h, this way we do not have to manually snapshot PVCs before we delete workspace clusters.
  2. We should have a metric track duration for when a PVC is bound but has no pod, and a trigger an alert when one or more exists for too long.

Questions:

  1. The workspace affected was gracefully Stopped (not Failed or Stopping), which indicates the user could have tried restarting their workspace and not restored their files. This would have been very confusing because they will not have their uncommitted files restored. Is this expected?

Example repository

No response

Anything else?

We currently stop trying to backup after a 1h timeout. This was a design decision for object storage based backups, and should be revisited as part of PVC.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions