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

sentry: type_desc.go:701: type × (449): referencing × 557 was dropped without dependency unlinking (1) keys: [sql.schema.validation_errors.read.backward_references.type] Wraps: (2) keys: [sql.schema.validatio... #100465

Closed
cockroach-teamcity opened this issue Apr 3, 2023 · 1 comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-sentry Originated from an in-the-wild panic report.

Comments

@cockroach-teamcity
Copy link
Member

cockroach-teamcity commented Apr 3, 2023

This issue was autofiled by Sentry. It represents a crash or reported error on a live cluster with telemetry enabled.

Sentry link: https://cockroach-labs.sentry.io/issues/4058410140/?referrer=webhooks_plugin

Panic message:

type_desc.go:701: type × (449): referencing × 557 was dropped without dependency unlinking
(1) keys: [sql.schema.validation_errors.read.backward_references.type]
Wraps: (2) keys: [sql.schema.validation_errors.read.backward_references.type]
Wraps: (3) attached stack trace
-- stack trace:
| github.com/cockroachdb/cockroach/pkg/sql/catalog/internal/validate.(*validationErrorAccumulator).decorate
| github.com/cockroachdb/cockroach/pkg/sql/catalog/internal/validate/validate.go:244
| github.com/cockroachdb/cockroach/pkg/sql/catalog/internal/validate.(*validationErrorAccumulator).Report
| github.com/cockroachdb/cockroach/pkg/sql/catalog/internal/validate/validate.go:173
| github.com/cockroachdb/cockroach/pkg/sql/catalog/typedesc.(*immutable).ValidateBackReferences
| github.com/cockroachdb/cockroach/pkg/sql/catalog/typedesc/type_desc.go:701
| github.com/cockroachdb/cockroach/pkg/sql/catalog/internal/validate.Validate.func3
| github.com/cockroachdb/cockroach/pkg/sql/catalog/internal/validate/validate.go:101
| github.com/cockroachdb/cockroach/pkg/sql/catalog/internal/validate.(*validationErrorAccumulator).validateDescriptorsAtLevel
| github.com/cockroachdb/cockroach/pkg/sql/catalog/internal/validate/validate.go:189
| github.com/cockroachdb/cockroach/pkg/sql/catalog/internal/validate.Validate
| github.com/cockroachdb/cockroach/pkg/sql/catalog/internal/validate/validate.go:96
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.(*Collection).Validate
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs/validate.go:35
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.(*Collection).finalizeDescriptors
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs/descriptor.go:566
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.getDescriptorsByID
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs/descriptor.go:203
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.(*Collection).getDescriptorByID
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs/descriptor.go:88
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.makeMutableTypeLookupFunc.func1
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs/hydrate.go:125
| github.com/cockroachdb/cockroach/pkg/sql/catalog/hydrateddesc.MakeTypeLookupFuncForHydration.func1
| github.com/cockroachdb/cockroach/pkg/sql/catalog/hydrateddesc/hydrate.go:74
| github.com/cockroachdb/cockroach/pkg/sql/catalog/typedesc.TypeLookupFunc.GetTypeDescriptor
| github.com/cockroachdb/cockroach/pkg/sql/catalog/typedesc/type_desc.go:797
| github.com/cockroachdb/cockroach/pkg/sql/catalog/typedesc.EnsureTypeIsHydrated
| github.com/cockroachdb/cockroach/pkg/sql/catalog/typedesc/type_desc.go:840
| github.com/cockroachdb/cockroach/pkg/sql/catalog/typedesc.HydrateTypesInTableDescriptor
| github.com/cockroachdb/cockroach/pkg/sql/catalog/typedesc/type_desc.go:854
| github.com/cockroachdb/cockroach/pkg/sql/catalog/hydrateddesc.Hydrate
| github.com/cockroachdb/cockroach/pkg/sql/catalog/hydrateddesc/hydrate.go:53
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.(*Collection).hydrateDescriptors
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs/hydrate.go:73
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.getDescriptorsByID
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs/descriptor.go:207
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.(*Collection).getDescriptorByID
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs/descriptor.go:88
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.(*Collection).getDescriptorByName
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs/descriptor.go:336
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.(*Collection).GetObjectByName
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs/object.go:53
| github.com/cockroachdb/cockroach/pkg/sql.(*schemaResolver).LookupObject
| github.com/cockroachdb/cockroach/pkg/sql/schema_resolver.go:118
| github.com/cockroachdb/cockroach/pkg/sql/catalog/resolver.ResolveExisting
| github.com/cockroachdb/cockroach/pkg/sql/catalog/resolver/resolver.go:438
| github.com/cockroachdb/cockroach/pkg/sql/catalog/resolver.ResolveExistingObject
| github.com/cockroachdb/cockroach/pkg/sql/catalog/resolver/resolver.go:196
| github.com/cockroachdb/cockroach/pkg/sql/catalog/resolver.ResolveMutableExistingTableObject
| github.com/cockroachdb/cockroach/pkg/sql/catalog/resolver/resolver.go:155
| github.com/cockroachdb/cockroach/pkg/sql.(*planner).ResolveMutableTableDescriptorEx
| github.com/cockroachdb/cockroach/pkg/sql/resolver.go:1271
| github.com/cockroachdb/cockroach/pkg/sql.(*planner).AlterTable
| github.com/cockroachdb/cockroach/pkg/sql/alter_table.go:83
| github.com/cockroachdb/cockroach/pkg/sql.planOpaque
| github.com/cockroachdb/cockroach/pkg/sql/opaque.go:124
| github.com/cockroachdb/cockroach/pkg/sql.buildOpaque
| github.com/cockroachdb/cockroach/pkg/sql/opaque.go:63
| github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder.(*Builder).tryBuildOpaque
| github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/opaque.go:70
| github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder.(*Builder).buildStmt
| github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:404
Wraps: (4) type × (449)
Wraps: (5) assertion failure
Wraps: (6) attached stack trace
-- stack trace:
| github.com/cockroachdb/cockroach/pkg/sql/catalog/typedesc.(*immutable).ValidateBackReferences
| github.com/cockroachdb/cockroach/pkg/sql/catalog/typedesc/type_desc.go:701
| github.com/cockroachdb/cockroach/pkg/sql/catalog/internal/validate.Validate.func3
| github.com/cockroachdb/cockroach/pkg/sql/catalog/internal/validate/validate.go:101
| github.com/cockroachdb/cockroach/pkg/sql/catalog/internal/validate.(*validationErrorAccumulator).validateDescriptorsAtLevel
| github.com/cockroachdb/cockroach/pkg/sql/catalog/internal/validate/validate.go:189
| github.com/cockroachdb/cockroach/pkg/sql/catalog/internal/validate.Validate
| github.com/cockroachdb/cockroach/pkg/sql/catalog/internal/validate/validate.go:96
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.(*Collection).Validate
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs/validate.go:35
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.(*Collection).finalizeDescriptors
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs/descriptor.go:566
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.getDescriptorsByID
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs/descriptor.go:203
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.(*Collection).getDescriptorByID
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs/descriptor.go:88
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.makeMutableTypeLookupFunc.func1
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs/hydrate.go:125
| github.com/cockroachdb/cockroach/pkg/sql/catalog/hydrateddesc.MakeTypeLookupFuncForHydration.func1
| github.com/cockroachdb/cockroach/pkg/sql/catalog/hydrateddesc/hydrate.go:74
| github.com/cockroachdb/cockroach/pkg/sql/catalog/typedesc.TypeLookupFunc.GetTypeDescriptor
| github.com/cockroachdb/cockroach/pkg/sql/catalog/typedesc/type_desc.go:797
| github.com/cockroachdb/cockroach/pkg/sql/catalog/typedesc.EnsureTypeIsHydrated
| github.com/cockroachdb/cockroach/pkg/sql/catalog/typedesc/type_desc.go:840
| github.com/cockroachdb/cockroach/pkg/sql/catalog/typedesc.HydrateTypesInTableDescriptor
| github.com/cockroachdb/cockroach/pkg/sql/catalog/typedesc/type_desc.go:854
| github.com/cockroachdb/cockroach/pkg/sql/catalog/hydrateddesc.Hydrate
| github.com/cockroachdb/cockroach/pkg/sql/catalog/hydrateddesc/hydrate.go:53
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.(*Collection).hydrateDescriptors
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs/hydrate.go:73
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs.getDescriptorsByID
| github.com/cockroachdb/cockroach/pkg/sql/catalog/descs/...

Stacktrace (expand for inline code snippets):

case catalog.Type:
err = errors.Wrapf(err, string(catalog.Type)+" %q (%d)", name, id)
case catalog.Function:
in pkg/sql/catalog/internal/validate.(*validationErrorAccumulator).decorate
}
vea.errors = append(vea.errors, vea.decorate(err))
}
in pkg/sql/catalog/internal/validate.(*validationErrorAccumulator).Report
if depDesc.Dropped() {
vea.Report(errors.AssertionFailedf(
"referencing %s %d was dropped without dependency unlinking", depDesc.DescriptorType(), id))
in pkg/sql/catalog/typedesc.(*immutable).ValidateBackReferences
if !desc.Dropped() {
desc.ValidateBackReferences(&vea, vdg)
}
in pkg/sql/catalog/internal/validate.Validate.func3
vea.currentDescriptor = desc
validationFn(desc)
}
in pkg/sql/catalog/internal/validate.(*validationErrorAccumulator).validateDescriptorsAtLevel
// Descriptor backward-reference checks.
if !vea.validateDescriptorsAtLevel(
catalog.ValidationLevelBackReferences,
in pkg/sql/catalog/internal/validate.Validate
version := tc.settings.Version.ActiveVersion(ctx)
return validate.Validate(
ctx,
in pkg/sql/catalog/descs.(*Collection).Validate
if len(toValidate) > 0 {
if err := tc.Validate(ctx, txn, catalog.ValidationReadTelemetry, requiredLevel, toValidate...); err != nil {
return err
in pkg/sql/catalog/descs.(*Collection).finalizeDescriptors
// At this point, all descriptors are in the slice, finalize and hydrate them.
if err := tc.finalizeDescriptors(ctx, txn, flags, descs, vls); err != nil {
return err
in pkg/sql/catalog/descs.getDescriptorsByID
var arr [1]catalog.Descriptor
if err := getDescriptorsByID(
ctx, tc, txn, flags, arr[:], ids...,
in pkg/sql/catalog/descs.(*Collection).getDescriptorByID
mutableLookupFunc := func(ctx context.Context, id descpb.ID, skipHydration bool) (catalog.Descriptor, error) {
return tc.getDescriptorByID(ctx, txn, tree.CommonLookupFlags{
Required: true,
in pkg/sql/catalog/descs.makeMutableTypeLookupFunc.func1
if typDesc == nil {
typDesc, err = lookupFn(ctx, id, false /* skipHydration */)
if err != nil {
in pkg/sql/catalog/hydrateddesc.MakeTypeLookupFuncForHydration.func1
) (tree.TypeName, catalog.TypeDescriptor, error) {
return t(ctx, id)
}
in pkg/sql/catalog/typedesc.TypeLookupFunc.GetTypeDescriptor
}
elemTypName, elemTypDesc, err := res.GetTypeDescriptor(ctx, id)
if err != nil {
in pkg/sql/catalog/typedesc.EnsureTypeIsHydrated
for i := range desc.Columns {
if err := EnsureTypeIsHydrated(ctx, desc.Columns[i].Type, res); err != nil {
return err
in pkg/sql/catalog/typedesc.HydrateTypesInTableDescriptor
case catalog.TableDescriptor:
return typedesc.HydrateTypesInTableDescriptor(ctx, t.TableDesc(), typeLookupFunc)
case catalog.SchemaDescriptor:
in pkg/sql/catalog/hydrateddesc.Hydrate
for _, i := range hydratableMutableIndexes.Ordered() {
if err := hydrateddesc.Hydrate(ctx, descs[i], typeFn); err != nil {
return err
in pkg/sql/catalog/descs.(*Collection).hydrateDescriptors
// Hydration is skipped if "SkipHydration" flag is true.
if err := tc.hydrateDescriptors(ctx, txn, flags, descs); err != nil {
return err
in pkg/sql/catalog/descs.getDescriptorsByID
var arr [1]catalog.Descriptor
if err := getDescriptorsByID(
ctx, tc, txn, flags, arr[:], ids...,
in pkg/sql/catalog/descs.(*Collection).getDescriptorByID
desc, err := tc.getDescriptorByID(ctx, txn, flags, id)
if err != nil {
in pkg/sql/catalog/descs.(*Collection).getDescriptorByName
}
desc, err = tc.getDescriptorByName(
ctx, txn, prefix.Database, prefix.Schema, objectName, flags.CommonLookupFlags, requestedType,
in pkg/sql/catalog/descs.(*Collection).GetObjectByName
prefix, objMeta, err = sr.descCollection.GetObjectByName(ctx, sr.txn, dbName, scName, obName, flags)
return objMeta != nil, prefix, objMeta, err
in pkg/sql.(*schemaResolver).LookupObject
for next, ok := iter.Next(); ok; next, ok = iter.Next() {
if found, prefix, result, err = r.LookupObject(
ctx, lookupFlags, curDb, next, u.Object(),
in pkg/sql/catalog/resolver.ResolveExisting
) (res catalog.Descriptor, _ catalog.ResolvedObjectPrefix, err error) {
found, prefix, obj, err := ResolveExisting(ctx, un, sc, lookupFlags, sc.CurrentDatabase(), sc.CurrentSearchPath())
if err != nil {
in pkg/sql/catalog/resolver.ResolveExistingObject
var desc catalog.Descriptor
desc, prefix, err = ResolveExistingObject(ctx, sc, un, lookupFlags)
if err != nil || desc == nil {
in pkg/sql/catalog/resolver.ResolveMutableExistingTableObject

cockroach/pkg/sql/resolver.go

Lines 1270 to 1272 in cbe3397

tn := name.ToTableName()
prefix, table, err := resolver.ResolveMutableExistingTableObject(ctx, p, &tn, required, requiredType)
if err != nil {
in pkg/sql.(*planner).ResolveMutableTableDescriptorEx
prefix, tableDesc, err := p.ResolveMutableTableDescriptorEx(
ctx, n.Table, !n.IfExists, tree.ResolveRequireTableDesc,
in pkg/sql.(*planner).AlterTable

cockroach/pkg/sql/opaque.go

Lines 123 to 125 in cbe3397

case *tree.AlterTable:
return p.AlterTable(ctx, n)
case *tree.AlterTableLocality:
in pkg/sql.planOpaque
var err error
plan, err = planOpaque(ctx, p, stmt)
if err != nil {
in pkg/sql.buildOpaque
}
obj, err := info.buildFn(b.ctx, b.semaCtx, b.evalCtx, stmt)
if err != nil {
in pkg/sql/opt/optbuilder.(*Builder).tryBuildOpaque
// See if we have an opaque handler registered for this statement type.
if outScope := b.tryBuildOpaque(stmt, inScope); outScope != nil {
// The opaque handler may resolve objects; we don't care about caching
in pkg/sql/opt/optbuilder.(*Builder).buildStmt
b.ctes = nil
outScope = b.buildStmt(stmt, desiredTypes, inScope)
// Build With operators for any CTEs hoisted to the top level.
in pkg/sql/opt/optbuilder.(*Builder).buildStmtAtRoot

pkg/sql/catalog/internal/validate/validate.go in pkg/sql/catalog/internal/validate.(*validationErrorAccumulator).decorate at line 244
pkg/sql/catalog/internal/validate/validate.go in pkg/sql/catalog/internal/validate.(*validationErrorAccumulator).Report at line 173
pkg/sql/catalog/typedesc/type_desc.go in pkg/sql/catalog/typedesc.(*immutable).ValidateBackReferences at line 701
pkg/sql/catalog/internal/validate/validate.go in pkg/sql/catalog/internal/validate.Validate.func3 at line 101
pkg/sql/catalog/internal/validate/validate.go in pkg/sql/catalog/internal/validate.(*validationErrorAccumulator).validateDescriptorsAtLevel at line 189
pkg/sql/catalog/internal/validate/validate.go in pkg/sql/catalog/internal/validate.Validate at line 96
pkg/sql/catalog/descs/validate.go in pkg/sql/catalog/descs.(*Collection).Validate at line 35
pkg/sql/catalog/descs/descriptor.go in pkg/sql/catalog/descs.(*Collection).finalizeDescriptors at line 566
pkg/sql/catalog/descs/descriptor.go in pkg/sql/catalog/descs.getDescriptorsByID at line 203
pkg/sql/catalog/descs/descriptor.go in pkg/sql/catalog/descs.(*Collection).getDescriptorByID at line 88
pkg/sql/catalog/descs/hydrate.go in pkg/sql/catalog/descs.makeMutableTypeLookupFunc.func1 at line 125
pkg/sql/catalog/hydrateddesc/hydrate.go in pkg/sql/catalog/hydrateddesc.MakeTypeLookupFuncForHydration.func1 at line 74
pkg/sql/catalog/typedesc/type_desc.go in pkg/sql/catalog/typedesc.TypeLookupFunc.GetTypeDescriptor at line 797
pkg/sql/catalog/typedesc/type_desc.go in pkg/sql/catalog/typedesc.EnsureTypeIsHydrated at line 840
pkg/sql/catalog/typedesc/type_desc.go in pkg/sql/catalog/typedesc.HydrateTypesInTableDescriptor at line 854
pkg/sql/catalog/hydrateddesc/hydrate.go in pkg/sql/catalog/hydrateddesc.Hydrate at line 53
pkg/sql/catalog/descs/hydrate.go in pkg/sql/catalog/descs.(*Collection).hydrateDescriptors at line 73
pkg/sql/catalog/descs/descriptor.go in pkg/sql/catalog/descs.getDescriptorsByID at line 207
pkg/sql/catalog/descs/descriptor.go in pkg/sql/catalog/descs.(*Collection).getDescriptorByID at line 88
pkg/sql/catalog/descs/descriptor.go in pkg/sql/catalog/descs.(*Collection).getDescriptorByName at line 336
pkg/sql/catalog/descs/object.go in pkg/sql/catalog/descs.(*Collection).GetObjectByName at line 53
pkg/sql/schema_resolver.go in pkg/sql.(*schemaResolver).LookupObject at line 118
pkg/sql/catalog/resolver/resolver.go in pkg/sql/catalog/resolver.ResolveExisting at line 438
pkg/sql/catalog/resolver/resolver.go in pkg/sql/catalog/resolver.ResolveExistingObject at line 196
pkg/sql/catalog/resolver/resolver.go in pkg/sql/catalog/resolver.ResolveMutableExistingTableObject at line 155
pkg/sql/resolver.go in pkg/sql.(*planner).ResolveMutableTableDescriptorEx at line 1271
pkg/sql/alter_table.go in pkg/sql.(*planner).AlterTable at line 83
pkg/sql/opaque.go in pkg/sql.planOpaque at line 124
pkg/sql/opaque.go in pkg/sql.buildOpaque at line 63
pkg/sql/opt/optbuilder/opaque.go in pkg/sql/opt/optbuilder.(*Builder).tryBuildOpaque at line 70
pkg/sql/opt/optbuilder/builder.go in pkg/sql/opt/optbuilder.(*Builder).buildStmt at line 404
pkg/sql/opt/optbuilder/builder.go in pkg/sql/opt/optbuilder.(*Builder).buildStmtAtRoot at line 252
Tag Value
Cockroach Release v22.2.7
Cockroach SHA: cbe3397
Platform linux amd64
Distribution CCL
Environment v22.2.7
Command mt start-sql
Go Version ``
# of CPUs
# of Goroutines

Jira issue: CRDB-26451

@cockroach-teamcity cockroach-teamcity added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-sentry Originated from an in-the-wild panic report. labels Apr 3, 2023
@yuzefovich
Copy link
Member

dup of #91645

@exalate-issue-sync exalate-issue-sync bot changed the title sentry: type_desc.go:701: type × (449): referencing × 557 was dropped without dependency unlinking (1) keys: [sql.schema.validation_errors.read.backward_references.type] Wraps: (2) keys: [sql.schema.validatio... sentry: type_desc.go:701: type × (449): referencing × 557 was dropped without dependency unlinking (1) keys: [sql.schema.validation_errors.read.backward_references.type] Wraps: (2) keys: [sql.schema.validatio... Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-sentry Originated from an in-the-wild panic report.
Projects
None yet
Development

No branches or pull requests

2 participants