-
Notifications
You must be signed in to change notification settings - Fork 22
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: unable to close, unable to unref last: unable to cleanup component version, while unref last: closing component version #1243
base: main
Are you sure you want to change the base?
Conversation
@@ -128,6 +128,10 @@ func (c *componentAccessImpl) HasVersion(vers string) (bool, error) { | |||
} | |||
|
|||
func (c *componentAccessImpl) LookupVersion(version string) (*repocpi.ComponentVersionAccessInfo, error) { | |||
// LookupVersion '0.0.1-20250108132333.build-af79499' would fail with: | |||
// unable to unref last: unable to cleanup component version [%v] while unref last: closing component version [%v]: check failed: component version [%v] is invalid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the actual error contain [%v]
instead of the version? Just curious. :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no - the actual error is:
closing session: unable to close: closing docker.io/recmo/docker-hello-tiny:0.0.1-20250108132333.build-af79499: unable to unref last: unable to cleanup component version docker.io/recmo/docker-hello-tiny/0.0.1-20250108132333.build-af79499 while unref last: closing component version docker.io/recmo/docker-hello-tiny:0.0.1-20250108132333.build-af79499: check failed: component version "0.0.1-20250108132333+af79499" is invalid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is, that a version with this .build-
is not a valid version anymore for CVs. So, the error is basically correct, but it comes far too late.
It must be assured that the version name given at the API matches the version name stored in the component descriptor, otherwise the complete structure would be corrupted.
So, such a version should be rejected at all. Accepting two versions, the CV version and a technical versions used at the backend, as valid CV versions would be problematic. But there is no reason why to accept the technical version, also. (The ListVersions
call correctly maps the technical versions found as OCI tag back to OCM versions).
So, there should be an error if the technical version is given, and it should be reported early.
May be you could add the following check to LookupVersion
in api/ocm/cpi/repocpi/bridge_c.go Line 102
func (b *componentAccessBridge) LookupVersion(version string) (cpi.ComponentVersionAccess, error) {
i, err := b.impl.LookupVersion(version)
if err != nil {
return nil, err
}
if i == nil || i.Impl == nil {
return nil, errors.ErrInvalid("component implementation behaviour", "LookupVersion")
}
if i.Impl.GetDescriptor().Version != version {
i.Impl.Close()
return nil, errors.ErrInvalid("component version mismatch")
}
return NewComponentVersionAccess(b.GetName(), version, i.Impl, i.Lazy, i.Persistent, !compositionmodeattr.Get(b.GetContext()))
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The technical version used at the backend should not be usable as OCM version (see my comment above). I would strongly recommend to provide an error instead of introducing this ambiguity.
which has been replaced by META_SEPARATOR to create OCI compliant tag
What this PR does / why we need it
When calling ocm-cli with oci-tag-version like
0.0.1-20250108132333.build-af79499
e.g.It fails during the finalize step, when doing an update, where another round of version comparison happens.
Which issue(s) this PR fixes
Fixes: #1235
Related: #355