cds icon indicating copy to clipboard operation
cds copied to clipboard

CDS API start with non initialized artiffact directory segfaults

Open gsalingu opened this issue 1 year ago • 0 comments

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/[email protected]/command.go:987 +0xa91
github.com/spf13/cobra.(*Command).ExecuteC(0x653ac00)
	/home/gsalingu/go/pkg/mod/github.com/spf13/[email protected]/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
	/home/gsalingu/go/pkg/mod/github.com/spf13/[email protected]/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

gsalingu avatar Oct 30 '24 03:10 gsalingu