Description
/kind bug
Which area this bug is related to?
/area registry
What versions of software are you using?
Operating System: Linux
Go Pkg Version: 1.17
Bug Summary
Describe the bug:
When requesting a non-existent version on a stack, such as GET /devfiles/java-maven/not-exist
, will cause an uncaught panic error due to accessing error entity which is set to nil
when responding with 404 Not Found
. This is believed to be a mistake in writing the response.
To Reproduce:
Replace $REGISTRY_HOST
with hostname and port which the registry server is listening on, NOT RECOMMENDED to try on production deployments.
curl -L https://$REGISTRY_HOST/devfiles/java-maven/non-exist
Expected behavior
Any logs, error output, screenshots etc? Provide the devfile that sees this bug, if applicable.
From testing:
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x1447435]
goroutine 100 [running]:
testing.tRunner.func1.2({0x157b3c0, 0x2600f90})
/home/mvaldron/sdk/go1.17.6/src/testing/testing.go:1209 +0x24e
testing.tRunner.func1()
/home/mvaldron/sdk/go1.17.6/src/testing/testing.go:1212 +0x218
panic({0x157b3c0, 0x2600f90})
/home/mvaldron/sdk/go1.17.6/src/runtime/panic.go:1038 +0x215
github.com/devfile/registry-support/index/server/pkg/server.fetchDevfile(_, {_, _}, {_, _})
/home/mvaldron/source/repos/michael-valdron/registry-support/index/server/pkg/server/endpoint.go:537 +0x1515
github.com/devfile/registry-support/index/server/pkg/server.serveDevfileWithVersion(0xc0003f4a00)
/home/mvaldron/source/repos/michael-valdron/registry-support/index/server/pkg/server/endpoint.go:87 +0xd6
github.com/devfile/registry-support/index/server/pkg/server.serveDevfile(...)
/home/mvaldron/source/repos/michael-valdron/registry-support/index/server/pkg/server/endpoint.go:118
github.com/devfile/registry-support/index/server/pkg/server.TestServeDevfileWithVersion.func1(0x14251e7)
Additional context
Any workaround?
N/A
Suggestion on how to fix the bug
Remove /index/server/pkg/server/endpoint.go#L536
Target Date: 07-29-2022