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

Requesting non-existent devfile version from registry server causes uncaught panic #901

Closed
michael-valdron opened this issue Jul 28, 2022 · 0 comments · Fixed by devfile/registry-support#129
Assignees
Labels
area/registry Devfile registry for stacks and infrastructure kind/bug Something isn't working
Projects

Comments

@michael-valdron
Copy link
Member

michael-valdron commented Jul 28, 2022

/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

@michael-valdron michael-valdron added this to Under consideration in Sprint 222 via automation Jul 28, 2022
@michael-valdron michael-valdron self-assigned this Jul 28, 2022
@openshift-ci openshift-ci bot added the kind/bug Something isn't working label Jul 28, 2022
@michael-valdron michael-valdron moved this from Under consideration to In progress in Sprint 222 Jul 28, 2022
@michael-valdron michael-valdron added the area/registry Devfile registry for stacks and infrastructure label Jul 28, 2022
@michael-valdron michael-valdron moved this from In progress to Review in progress in Sprint 222 Jul 28, 2022
Sprint 222 automation moved this from Review in progress to Done Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/registry Devfile registry for stacks and infrastructure kind/bug Something isn't working
Projects
No open projects
1 participant