Skip to content

CDS API start with non initialized artiffact directory segfaults #7199

@gsalingu

Description

@gsalingu

I am facing this issue while booting a new instance of cds

gsalingu@cds:~/cds$ ./cds-engine start api --config conf.toml
Reading configuration file @ conf.toml
Starting service api
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xe3c96d]

goroutine 1 [running]:
github.com/ovh/cds/sdk.DirectoryExists({0xc000ed6400?, 0x15?})
	/home/gsalingu/github/ovh/cds/sdk/common.go:199 +0x6d
github.com/ovh/cds/engine/api.(*API).CheckConfiguration(0x0?, {0x3bc1dc0?, 0xc0012adb08?})
	/home/gsalingu/github/ovh/cds/engine/api/api.go:408 +0x345
github.com/ovh/cds/engine/api.(*API).ApplyConfiguration(0xc0012b2008, {0x3bc1dc0, 0xc0012adb08})
	/home/gsalingu/github/ovh/cds/engine/api/api.go:349 +0x3a
main.init.func11(0xc000395a00?, {0xc000c61200?, 0x4?, 0x3c80366?})
	/home/gsalingu/github/ovh/cds/engine/cmd_start.go:279 +0x3be2
github.com/spf13/cobra.(*Command).execute(0x653a920, {0xc000c61170, 0x3, 0x3})
	/home/gsalingu/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:987 +0xa91
github.com/spf13/cobra.(*Command).ExecuteC(0x653ac00)
	/home/gsalingu/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
	/home/gsalingu/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039
main.main()
	/home/gsalingu/github/ovh/cds/engine/main.go:26 +0x1a

Here is the associated conf

        [cdn.storageUnits.storages.local.local]
          path = "/var/lib/cds-engine/cdn"

The directory does not exist but my current user does not have permission to create it

gsalingu@cds:~/github/ovh/cds$ ls -lai /var/lib/cds-engine/cdn
ls: cannot access '/var/lib/cds-engine/cdn': Permission denied

The binary should exit and prompt an intelligible error message

A PR to address this will be following this issue's creation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions