Skip to content

Fission-CLI command pkg getdeploy returns error nil pointer dereference #2961

@soharab-ic

Description

@soharab-ic

Fission/Kubernetes version

$ fission version
client:
  fission/core:
    BuildDate: "2024-06-19T09:50:12Z"
    GitCommit: 9b978cf2
    Version: v1.20.2
server:
  fission/core:
    BuildDate: "2024-06-19T09:49:38Z"
    GitCommit: 9b978cf2
    Version: v1.20.2
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.1", GitCommit:"4c9411232e10168d7b050c49a1b59f6df9d7ea4b", GitTreeState:"clean", BuildDate:"2023-04-14T13:21:19Z", GoVersion:"go1.20.3", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v5.0.1
Server Version: version.Info{Major:"1", Minor:"28", GitVersion:"v1.28.5", GitCommit:"506050d61cf291218dfbd41ac93913945c9aa0da", GitTreeState:"archive", BuildDate:"2024-05-24T09:44:55Z", GoVersion:"go1.20.12", Compiler:"gc", Platform:"linux/amd64"}

Kubernetes platform (e.g. Google Kubernetes Engine)

  • Kind cluster

Describe the bug

When fission package is being built or in failed state and we try to run fission pkg getdeploy --name pkg-name command then we see nill pointer dereference issue because deployment archive is not available with package resource.

apiVersion: fission.io/v1
kind: Package
metadata:
  creationTimestamp: "2024-06-19T07:33:18Z"
  generation: 3
  name: hello-6492eb75-0f4e-4916-a47a-2b94a4deeb58
  namespace: default
  resourceVersion: "789319"
  uid: 3cabf95a-2af9-459f-8d0f-0c5463c02320
spec:
  deployment:
    checksum: {}
  environment:
    name: go-120
    namespace: default
  source:
    checksum: {}
    literal: UEsDBBQACAAIACY801gAAAAAAAAAAAAAAAAIAAkAaGVsbG8uZ29VVAUAAbiJcmY0zD1LxEAQh/E68yn+pkrkuPSCvbUggi/Fmp0kg5fZdWZCCH55Ubz2gedX0/iZZsaaRIlkrcUCHTWtcgxLRG2pJxoGPCTNFzaIIxYGa9iBWkQDUzHEIo5J3KUopk3HkKI0bTpez27Hr3d+ZK9FnZ9Ngu0Ew+1//9rYo8c3NavPuLtH+1RzCs54kVo5n7AXu+SbN22p2c9/QPf6/nEEd6vPfU8/AwBQSwcIuyKb76UAAADOAAAAUEsBAhQDFAAIAAgAJjzTWLsim++lAAAAzgAAAAgACQAAAAAAAAAAALSBAAAAAGhlbGxvLmdvVVQFAAG4iXJmUEsFBgAAAAABAAEAPwAAAOQAAAAAAA==
    type: literal
$ fission pkg getdeploy --name hello-6492eb75-0f4e-4916-a47a-2b94a4deeb58
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x4b097e]

goroutine 1 [running]:
io.copyBuffer({0x29d8180, 0xc000117488}, {0x0, 0x0}, {0x0, 0x0, 0x0})
	/usr/local/go/src/io/io.go:429 +0x17e
io.Copy(...)
	/usr/local/go/src/io/io.go:388
os.genericReadFrom(0xc000090028?, {0x0, 0x0})
	/usr/local/go/src/os/file.go:179 +0x58
os.(*File).ReadFrom(0xc000090028, {0x0, 0x0})
	/usr/local/go/src/os/file.go:155 +0x9c
io.copyBuffer({0x29d8200, 0xc000090028}, {0x0, 0x0}, {0x0, 0x0, 0x0})
	/usr/local/go/src/io/io.go:415 +0x151
io.Copy(...)
	/usr/local/go/src/io/io.go:388
github.com/fission/fission/pkg/fission-cli/cmd/package.(*GetSubCommand).run(0xc000557c08, {0x2a0faf0, 0xc000154660})
	pkg/fission-cli/cmd/package/get.go:102 +0x545
github.com/fission/fission/pkg/fission-cli/cmd/package.(*GetSubCommand).do(0xc000557c08, {0x2a0faf0, 0xc000154660})
	pkg/fission-cli/cmd/package/get.go:60 +0x45
github.com/fission/fission/pkg/fission-cli/cmd/package.GetDeploy({0x2a0faf0?, 0xc000154660?})
	pkg/fission-cli/cmd/package/get.go:52 +0x55
github.com/fission/fission/pkg/fission-cli/cmd/package.Commands.Wrapper.func3(0xc0003b4d00?, {0xc0003b0b80?, 0x4?, 0x24327e3?})
	pkg/fission-cli/cliwrapper/driver/cobra/cobra.go:51 +0x62
github.com/spf13/cobra.(*Command).execute(0xc000452608, {0xc0003b0b60, 0x2, 0x2})
	/home/soharab/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:983 +0xaca
github.com/spf13/cobra.(*Command).ExecuteC(0xc000600608)
	/home/soharab/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(0x0?)
	/home/soharab/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039 +0x13
main.main()
	cmd/fission-cli/main.go:31 +0x2b

To Reproduce

  • Create a package with a source file which has syntax errors. Fission package build will fail and then run below command.
$ fission pkg getdeploy --name <pkg-name>

Expected result

Actual result

Screenshots/Dump file

$ fission support dump

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions