Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PipelineRun volumeClaimTemplate creation can race with PVC deletion #3855

Closed
wlynch opened this issue Mar 25, 2021 · 1 comment · Fixed by #3856
Closed

PipelineRun volumeClaimTemplate creation can race with PVC deletion #3855

wlynch opened this issue Mar 25, 2021 · 1 comment · Fixed by #3856
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@wlynch
Copy link
Member

wlynch commented Mar 25, 2021

Expected Behavior

I should be able to run kubectl delete -f pipelinerun.yaml; kubectl apply -f pipelinerun.yaml repeatedly with a volumeClaimTemplate.

Actual Behavior

Talking with @sbwsg, we suspect that something along these lines is happening:

  1. apply a pipelinerun that uses volumeclaimtemplate
  2. delete that pipelinerun
  3. the pvc created for the volumeClaimTemplate starts terminating
  4. apply the pipelinerun again with the same name
  5. the new pipelinerun (with the same name) tries to utilize the terminating pvc, hanging forever

When in the stuck state, kubectl describe shows:

Events:
  Type    Reason   Age                From     Message
  ----    ------   ----               ----     -------
  Normal  Started  83s                TaskRun  
  Normal  Pending  83s                TaskRun  Pending
  Normal  Pending  83s (x2 over 83s)  TaskRun  pod status "PodScheduled":"False"; message: "persistentvolumeclaim \"pvc-120ad2aa01\" is being deleted"

We suspect that this is a race condition where the new PipelineRun is waiting for the PVC to be deleted since it's in the terminating state, but the PVC isn't being deleted because it thinks the the new PipelineRun has a claim on it.

Deleting the pipelinerun and waiting lets the PVC finish deleting, at which point the new pipelinerun can be applied.

Steps to Reproduce the Problem

  1. Use a volumeClaimTemplate in a PipelineRun (we discovered this with https://github.com/tektoncd/catalog/blob/54315c082b257ed2a27df3de51014aa75d135cad/task/kind/0.1/tests/run.yaml)
  2. Delete then recreate the PipelineRun before the PVC can be deleted (kubectl delete ; kubectl apply)
  3. New PipelineRun waits for PVC to be deleted

Additional Info

  • Kubernetes version:

    Output of kubectl version:

    Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.6", GitCommit:"dff82dc0de47299ab66c83c626e08b245ab19037", GitTreeState:"clean", BuildDate:"2020-07-15T16:58:53Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
    Server Version: version.Info{Major:"1", Minor:"18+", GitVersion:"v1.18.12-gke.1210", GitCommit:"199a41188dc0ca5d6d95b1cc7e8ba96e05f9dd0a", GitTreeState:"clean", BuildDate:"2021-02-05T18:03:16Z", GoVersion:"go1.13.15b4", Compiler:"gc", Platform:"linux/amd64"} 
    
  • Tekton Pipeline version:

    Client version: 0.15.0
    Pipeline version: v0.22.0
    
@wlynch wlynch added the kind/bug Categorizes issue or PR as related to a bug. label Mar 25, 2021
@wlynch
Copy link
Member Author

wlynch commented Mar 25, 2021

/assign wlynch

wlynch added a commit to wlynch/pipeline that referenced this issue Mar 25, 2021
We've noticed that using Owner names can lead to race conditions in
deleting a volumeClaimTemplate PVC in where a PipelineRun is quickly deleted
then recreated (see tektoncd#3855).

Using the UID allows us to uniquely identify independent runs with the
same name, avoiding this issue while keeping the same semantic.
wlynch added a commit to wlynch/pipeline that referenced this issue Mar 25, 2021
We've noticed that using Owner names can lead to race conditions in
deleting a volumeClaimTemplate PVC in where a PipelineRun is quickly deleted
then recreated (see tektoncd#3855).

Using the UID allows us to uniquely identify independent runs with the
same name, avoiding this issue while keeping the same semantic.
wlynch added a commit to wlynch/pipeline that referenced this issue Mar 25, 2021
We've noticed that using Owner names can lead to race conditions in
deleting a volumeClaimTemplate PVC in where a PipelineRun is quickly deleted
then recreated (see tektoncd#3855).

Using the UID allows us to uniquely identify independent runs with the
same name, avoiding this issue while keeping the same semantic.
wlynch added a commit to wlynch/pipeline that referenced this issue Mar 25, 2021
We've noticed that using Owner names can lead to race conditions in
deleting a volumeClaimTemplate PVC in where a PipelineRun is quickly deleted
then recreated (see tektoncd#3855).

Using the UID allows us to uniquely identify independent runs with the
same name, avoiding this issue while keeping the same semantic.
tekton-robot pushed a commit that referenced this issue Mar 25, 2021
We've noticed that using Owner names can lead to race conditions in
deleting a volumeClaimTemplate PVC in where a PipelineRun is quickly deleted
then recreated (see #3855).

Using the UID allows us to uniquely identify independent runs with the
same name, avoiding this issue while keeping the same semantic.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant