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

nil pointer from pipelinerun describe #584

Closed
Conky5 opened this issue Jan 9, 2020 · 6 comments · Fixed by #586
Closed

nil pointer from pipelinerun describe #584

Conky5 opened this issue Jan 9, 2020 · 6 comments · Fixed by #586
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@Conky5
Copy link
Contributor

Conky5 commented Jan 9, 2020

Version and Operating System

tkn Version: 0.6.0

Operating System: alpine linux

Expected Behavior

tkn pipelinerun describe <name> should show not panic.

Actual Behavior

This error message is thrown:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x10de379]

goroutine 1 [running]:
k8s.io/apimachinery/pkg/apis/meta/v1.(*Time).Before(...)
        /workspace/pkg/mod/k8s.io/[email protected]/pkg/apis/meta/v1/time.go:75
github.com/tektoncd/cli/pkg/cmd/pipelinerun.taskrunList.Less(...)
        /workspace/src/github.com/tektoncd/cli/pkg/cmd/pipelinerun/describe.go:222
sort.insertionSort(0x15d5e80, 0xc000569360, 0x0, 0x4)
        /usr/local/go/src/sort/sort.go:27 +0xc4
sort.quickSort(0x15d5e80, 0xc000569360, 0x0, 0x4, 0x6)
        /usr/local/go/src/sort/sort.go:209 +0x201
sort.Sort(0x15d5e80, 0xc000569360)
        /usr/local/go/src/sort/sort.go:218 +0x79
github.com/tektoncd/cli/pkg/cmd/pipelinerun.printPipelineRunDescription(0xc00040bd40, 0x7ffd93d66577, 0xe, 0x15ebf80, 0xc000395600, 0x8, 0x7ffd93d66500)
        /workspace/src/github.com/tektoncd/cli/pkg/cmd/pipelinerun/describe.go:146 +0x91a
github.com/tektoncd/cli/pkg/cmd/pipelinerun.describeCommand.func1(0xc0003d1080, 0xc0003fca50, 0x1, 0x3, 0x0, 0x0)
        /workspace/src/github.com/tektoncd/cli/pkg/cmd/pipelinerun/describe.go:121 +0x18a
github.com/spf13/cobra.(*Command).execute(0xc0003d1080, 0xc0003f06c0, 0x3, 0x4, 0xc0003d1080, 0xc0003f06c0)
        /workspace/pkg/mod/github.com/chmouel/[email protected]/command.go:832 +0x460
github.com/spf13/cobra.(*Command).ExecuteC(0xc000391340, 0xc000395600, 0xc000391340, 0xc00009a058)
        /workspace/pkg/mod/github.com/chmouel/[email protected]/command.go:920 +0x2fb
github.com/spf13/cobra.(*Command).Execute(...)
        /workspace/pkg/mod/github.com/chmouel/[email protected]/command.go:870
main.main()
        /workspace/src/github.com/tektoncd/cli/cmd/tkn/main.go:31 +0x4b

Steps to Reproduce the Problem

  1. Start a pipeline with multiple tasks in it
  2. Immediately run a describe on it
@chmouel
Copy link
Member

chmouel commented Jan 9, 2020

/kind bug

@tekton-robot tekton-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jan 9, 2020
@danielhelfand
Copy link
Member

@Conky5 Thanks for reporting/sorry for the issue. Could you possibly share your pipeline definition or something similar to it?

@danielhelfand
Copy link
Member

I think the issue is actually here:

func (s taskrunList) Less(i, j int) bool {

There is no nil check like we traditionally do for sorting taskruns:

if trs[j].Status.StartTime == nil {

@Conky5
Copy link
Contributor Author

Conky5 commented Jan 9, 2020

Hi @danielhelfand, here is the pipeline and task definition I am seeing this with:

---
apiVersion: tekton.dev/v1alpha1
kind: Task
metadata:
  name: test
spec:
  inputs:
    params:
      - name: exitCode
        description: The exit code the task should exit with.
        default: "0"
  steps:
    - name: test
      image: busybox
      args:
        - "-c"
        - |
          echo "Hello, world!"
          exit $(inputs.params.exitCode)
---
apiVersion: tekton.dev/v1alpha1
kind: Pipeline
metadata:
  name: test
spec:
  params:
    - name: exitCode
      description: Exit code the task should exit with.
      default: "0"
  tasks:
    - name: test-1
      taskRef:
        name: test
      params:
      - name: exitCode
        value: "$(params.exitCode)"
    - name: test-2
      taskRef:
        name: test
      params:
      - name: exitCode
        value: "$(params.exitCode)"
    - name: test-3
      taskRef:
        name: test
      params:
      - name: exitCode
        value: "$(params.exitCode)"
    - name: test-4
      taskRef:
        name: test
      params:
      - name: exitCode
        value: "$(params.exitCode)"

The pipeline is being started with:

tkn pipeline start --showlog=false "test" --param exitCode=0

@danielhelfand
Copy link
Member

@Conky5 Thanks! I think I have found the problem, but I'll test out with something similar to your definition.

@danielhelfand
Copy link
Member

Seems like we missed updating this, but adding the nil check for sorting the TaskRuns by start time resolves this.

I'll open a pr here in a little.

Name:           test-run-89pt7
Namespace:      default
Pipeline Ref:   test

Status
STARTED          DURATION    STATUS
33 seconds ago   9 seconds   Succeeded

Resources
No resources

Params
NAME       VALUE
exitCode   0

Taskruns
NAME                          TASK NAME   STARTED          DURATION    STATUS
test-run-89pt7-test-3-4wkxk   test-3      32 seconds ago   8 seconds   Succeeded
test-run-89pt7-test-4-tz7fs   test-4      32 seconds ago   5 seconds   Succeeded
test-run-89pt7-test-1-59ls9   test-1      33 seconds ago   7 seconds   Succeeded
test-run-89pt7-test-2-sn2zd   test-2      33 seconds ago   7 seconds   Succeeded

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.

4 participants