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

fix: patch requests to artifact endpoint make mr panic #718

Conversation

Al-Pragliola
Copy link
Contributor

@Al-Pragliola Al-Pragliola commented Jan 20, 2025

Description

Trying to do a PATCH request to v1alpha3/artifacts/{artifactId} made mr panic:

http: panic serving 0.0.0.0:8080: runtime error: invalid memory address or nil pointer dereference
goroutine 25997 [running]:
net/http.(*conn).serve.func1()
	/usr/lib/golang/src/net/http/server.go:1873 +0xb9
panic({0xb13ba0?, 0x13a8810?})
	/usr/lib/golang/src/runtime/panic.go:920 +0x270
github.com/kubeflow/model-registry/internal/server/openapi.(*ModelRegistryServiceAPIService).UpdateArtifact(0xc0003c7c20, {0xb351a0?, 0xc000042190?}, {0xc00029e0ad, 0x1}, {0x0, 0x0})
	/workspace/internal/server/openapi/api_model_registry_service_service.go:496 +0x12f
github.com/kubeflow/model-registry/internal/server/openapi.(*ModelRegistryServiceAPIController).UpdateArtifact(0xc000013c98, {0x7fb4fa6124b8, 0xc0001665c0}, 0xc0001d8e00)
	/workspace/internal/server/openapi/api_model_registry_service.go:902 +0x1cd
net/http.HandlerFunc.ServeHTTP(0xb0e3c0?, {0x7fb4fa6124b8?, 0xc0001665c0?}, 0xc00029e086?)
	/usr/lib/golang/src/net/http/server.go:2141 +0x29
github.com/go-chi/chi/v5.(*Mux).routeHTTP(0xc0003b8de0, {0x7fb4fa6124b8, 0xc0001665c0}, 0xc0001d8e00)
	/cachi2/output/deps/gomod/pkg/mod/github.com/go-chi/chi/[email protected]/mux.go:459 +0x2b4
net/http.HandlerFunc.ServeHTTP(0xc0000cc960?, {0x7fb4fa6124b8?, 0xc0001665c0?}, 0xc0001d8e00?)
	/usr/lib/golang/src/net/http/server.go:2141 +0x29
github.com/go-chi/cors.(*Cors).Handler-fm.(*Cors).Handler.func1({0x7fb4fa6124b8, 0xc0001665c0}, 0xc0001d8e00)
	/cachi2/output/deps/gomod/pkg/mod/github.com/go-chi/[email protected]/cors.go:228 +0x17e
net/http.HandlerFunc.ServeHTTP(0xc0001d8d00?, {0x7fb4fa6124b8?, 0xc0001665c0?}, 0x30?)
	/usr/lib/golang/src/net/http/server.go:2141 +0x29
github.com/go-chi/chi/v5/middleware.init.0.RequestLogger.func1.1({0xd08058, 0xc00019a540}, 0xc0001d8d00)
	/cachi2/output/deps/gomod/pkg/mod/github.com/go-chi/chi/[email protected]/middleware/logger.go:55 +0x16d
net/http.HandlerFunc.ServeHTTP(0xd09790?, {0xd08058?, 0xc00019a540?}, 0x13a92c0?)
	/usr/lib/golang/src/net/http/server.go:2141 +0x29
github.com/go-chi/chi/v5.(*Mux).ServeHTTP(0xc0003b8de0, {0xd08058, 0xc00019a540}, 0xc0001d8c00)
	/cachi2/output/deps/gomod/pkg/mod/github.com/go-chi/chi/[email protected]/mux.go:90 +0x330
net/http.serverHandler.ServeHTTP({0xd05f10?}, {0xd08058?, 0xc00019a540?}, 0x6?)
	/usr/lib/golang/src/net/http/server.go:2943 +0x8e
net/http.(*conn).serve(0xc0001b7560, {0xd09758, 0xc0003d62d0})
	/usr/lib/golang/src/net/http/server.go:2014 +0x5f4
created by net/http.(*Server).Serve in goroutine 1
	/usr/lib/golang/src/net/http/server.go:3091 +0x5cb 

How Has This Been Tested?

curl -k -X 'POST' 'http://localhost:8080/api/model_registry/v1alpha3/artifacts' -d '{"description": "test","artifactType": "model-artifact"
curl -k -X 'PATCH' 'http://localhost:8080/api/model_registry/v1alpha3/artifacts/1' -d '{"description": "test-two","artifactType": "model-artifact"}'

plus

python client e2e tests

Merge criteria:

  • All the commits have been signed-off (To pass the DCO check)
  • The commits have meaningful messages; the author will squash them after approval or in case of manual merges will ask to merge with squash.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work.
  • Code changes follow the kubeflow contribution guidelines.

Signed-off-by: Alessio Pragliola <[email protected]>
Copy link
Member

@tarilabs tarilabs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you so much for the PR @Al-Pragliola but also especially for adding a py non-regression test!!

/lgtm
/approve

Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tarilabs

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow bot merged commit 8a39ad5 into kubeflow:main Jan 20, 2025
17 checks passed
@Al-Pragliola Al-Pragliola deleted the al-pragliola-fix-patch-artifact-panic branch January 20, 2025 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants