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

sql: v23.1.1: index out of bounds in tree.(*Annotations).Get #103541

Closed
cockroach-teamcity opened this issue May 17, 2023 · 0 comments · Fixed by #103643
Closed

sql: v23.1.1: index out of bounds in tree.(*Annotations).Get #103541

cockroach-teamcity opened this issue May 17, 2023 · 0 comments · Fixed by #103643
Assignees
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 May 17, 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/4190316917/?referrer=webhooks_plugin

Panic message:

conn_executor.go:865: runtime error: index out of range [1] with length 0
(1) attached stack trace
-- stack trace:
| github.com/cockroachdb/cockroach/pkg/sql.(*Server).ServeConn.func1
| github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:865
| [...repeated from below...]
Wraps: (2) attached stack trace
-- stack trace:
| github.com/cockroachdb/cockroach/pkg/sql.(*Server).ServeConn.func1
| github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:865
| runtime.gopanic
| GOROOT/src/runtime/panic.go:884
| runtime.goPanicIndex
| GOROOT/src/runtime/panic.go:113
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree.(*Annotations).Get
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree/annotation.go:53
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree.AnnotatedNode.GetAnnotation
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree/annotation.go:30
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree.(*UnresolvedObjectName).Resolved
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree/object_name.go:180
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree.(*UnresolvedObjectName).Format
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree/object_name.go:201
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree.(*FmtCtx).formatNodeMaybeMarkRedaction
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree/format.go:692
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree.(*FmtCtx).FormatNode
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree/format.go:466
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree.(*FmtCtx).FormatTypeReference
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree/type_name.go:213
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree.(*CastExpr).Format
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree/expr.go:1505
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree.(*FmtCtx).formatNodeMaybeMarkRedaction
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree/format.go:692
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree.(*FmtCtx).FormatNode
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree/format.go:466
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree.exprFmtWithParen
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree/expr.go:135
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree.binExprFmtWithParen
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree/expr.go:168
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree.(*RangeCond).Format
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree/expr.go:537
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree.(*FmtCtx).formatNodeMaybeMarkRedaction
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree/format.go:692
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree.(*FmtCtx).FormatNode
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree/format.go:466
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree.(*Where).Format
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree/select.go:745
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree.(*FmtCtx).formatNodeMaybeMarkRedaction
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree/format.go:692
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree.(*FmtCtx).FormatNode
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree/format.go:466
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree.(*SelectClause).Format
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree/select.go:125
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree.(*FmtCtx).formatNodeMaybeMarkRedaction
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree/format.go:692
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree.(*FmtCtx).FormatNode
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree/format.go:466
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree.(*Select).Format
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree/select.go:57
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree.(*FmtCtx).formatNodeMaybeMarkRedaction
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree/format.go:692
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree.(*FmtCtx).FormatNode
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree/format.go:466
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree.(*CopyTo).Format
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree/copy.go:39
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree.(*FmtCtx).formatNodeMaybeMarkRedaction
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree/format.go:692
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree.(*FmtCtx).FormatNode
| github.com/cockroachdb/cockroach/pkg/sql/sem/tree/format.go:466
| github.com/cockroachdb/cockroach/pkg/sql.formatStmtKeyAsRedactableString
| github.com/cockroachdb/cockroach/pkg/sql/exec_util.go:3600
| github.com/cockroachdb/cockroach/pkg/sql.(*planner).getCommonSQLEventDetails
| github.com/cockroachdb/cockroach/pkg/sql/event_log.go:193
Wraps: (3) runtime error: index out of range [1] with length 0
Error types: (1) *withstack.withStack (2) *withstack.withStack (3) runtime.boundsError
-- report composition:
runtime.boundsError
conn_executor.go:865: *withstack.withStack (top exception)
conn_executor.go:865: *withstack.withStack (1)
(check the extra data payloads)

Stacktrace (expand for inline code snippets):

r := recover()
h.ex.closeWrapper(ctx, r)
}(ctx, h)
in pkg/sql.(*Server).ServeConn.func1
GOROOT/src/runtime/panic.go#L883-L885 in runtime.gopanic
GOROOT/src/runtime/panic.go#L112-L114 in runtime.goPanicIndex
func (a *Annotations) Get(idx AnnotationIdx) interface{} {
return (*a)[idx-1]
}
in pkg/sql/sem/tree.(*Annotations).Get
}
return ann.Get(n.AnnIdx)
}
in pkg/sql/sem/tree.AnnotatedNode.GetAnnotation
func (u *UnresolvedObjectName) Resolved(ann *Annotations) ObjectName {
r := u.GetAnnotation(ann)
if r == nil {
in pkg/sql/sem/tree.(*UnresolvedObjectName).Resolved
if n := u.Resolved(ctx.ann); n != nil {
n.Format(ctx)
in pkg/sql/sem/tree.(*UnresolvedObjectName).Format
}
n.Format(ctx)
}
in pkg/sql/sem/tree.(*FmtCtx).formatNodeMaybeMarkRedaction
if f.HasFlags(FmtMarkRedactionNode) {
ctx.formatNodeMaybeMarkRedaction(n)
} else {
in pkg/sql/sem/tree.(*FmtCtx).FormatNode
case NodeFormatter:
ctx.FormatNode(t)
in pkg/sql/sem/tree.(*FmtCtx).FormatTypeReference
ctx.WriteString("::")
ctx.FormatTypeReference(node.Type)
default:
in pkg/sql/sem/tree.(*CastExpr).Format
}
n.Format(ctx)
}
in pkg/sql/sem/tree.(*FmtCtx).formatNodeMaybeMarkRedaction
if f.HasFlags(FmtMarkRedactionNode) {
ctx.formatNodeMaybeMarkRedaction(n)
} else {
in pkg/sql/sem/tree.(*FmtCtx).FormatNode
} else {
ctx.FormatNode(e)
}
in pkg/sql/sem/tree.exprFmtWithParen
func binExprFmtWithParen(ctx *FmtCtx, e1 Expr, op string, e2 Expr, pad bool) {
exprFmtWithParen(ctx, e1)
if pad {
in pkg/sql/sem/tree.binExprFmtWithParen
}
binExprFmtWithParen(ctx, node.From, "AND", node.To, true)
}
in pkg/sql/sem/tree.(*RangeCond).Format
}
n.Format(ctx)
}
in pkg/sql/sem/tree.(*FmtCtx).formatNodeMaybeMarkRedaction
if f.HasFlags(FmtMarkRedactionNode) {
ctx.formatNodeMaybeMarkRedaction(n)
} else {
in pkg/sql/sem/tree.(*FmtCtx).FormatNode
ctx.WriteByte(' ')
ctx.FormatNode(node.Expr)
}
in pkg/sql/sem/tree.(*Where).Format
}
n.Format(ctx)
}
in pkg/sql/sem/tree.(*FmtCtx).formatNodeMaybeMarkRedaction
if f.HasFlags(FmtMarkRedactionNode) {
ctx.formatNodeMaybeMarkRedaction(n)
} else {
in pkg/sql/sem/tree.(*FmtCtx).FormatNode
ctx.WriteByte(' ')
ctx.FormatNode(node.Where)
}
in pkg/sql/sem/tree.(*SelectClause).Format
}
n.Format(ctx)
}
in pkg/sql/sem/tree.(*FmtCtx).formatNodeMaybeMarkRedaction
if f.HasFlags(FmtMarkRedactionNode) {
ctx.formatNodeMaybeMarkRedaction(n)
} else {
in pkg/sql/sem/tree.(*FmtCtx).FormatNode
ctx.FormatNode(node.With)
ctx.FormatNode(node.Select)
if len(node.OrderBy) > 0 {
in pkg/sql/sem/tree.(*Select).Format
}
n.Format(ctx)
}
in pkg/sql/sem/tree.(*FmtCtx).formatNodeMaybeMarkRedaction
if f.HasFlags(FmtMarkRedactionNode) {
ctx.formatNodeMaybeMarkRedaction(n)
} else {
in pkg/sql/sem/tree.(*FmtCtx).FormatNode
ctx.WriteString("(")
ctx.FormatNode(node.Statement)
ctx.WriteString(")")
in pkg/sql/sem/tree.(*CopyTo).Format
}
n.Format(ctx)
}
in pkg/sql/sem/tree.(*FmtCtx).formatNodeMaybeMarkRedaction
if f.HasFlags(FmtMarkRedactionNode) {
ctx.formatNodeMaybeMarkRedaction(n)
} else {
in pkg/sql/sem/tree.(*FmtCtx).FormatNode

cockroach/pkg/sql/exec_util.go

Lines 3599 to 3601 in 00f65ea

tree.FmtReformatTableNames(hideNonVirtualTableNameFunc(vt, ns)))
f.FormatNode(rootAST)
formattedRedactableStatementString := f.CloseAndGetString()
in pkg/sql.formatStmtKeyAsRedactableString
func (p *planner) getCommonSQLEventDetails(opt redactionOptions) eventpb.CommonSQLEventDetails {
redactableStmt := formatStmtKeyAsRedactableString(
p.extendedEvalCtx.VirtualSchemas, p.stmt.AST,
in pkg/sql.(*planner).getCommonSQLEventDetails

pkg/sql/conn_executor.go in pkg/sql.(*Server).ServeConn.func1 at line 865
GOROOT/src/runtime/panic.go in runtime.gopanic at line 884
GOROOT/src/runtime/panic.go in runtime.goPanicIndex at line 113
pkg/sql/sem/tree/annotation.go in pkg/sql/sem/tree.(*Annotations).Get at line 53
pkg/sql/sem/tree/annotation.go in pkg/sql/sem/tree.AnnotatedNode.GetAnnotation at line 30
pkg/sql/sem/tree/object_name.go in pkg/sql/sem/tree.(*UnresolvedObjectName).Resolved at line 180
pkg/sql/sem/tree/object_name.go in pkg/sql/sem/tree.(*UnresolvedObjectName).Format at line 201
pkg/sql/sem/tree/format.go in pkg/sql/sem/tree.(*FmtCtx).formatNodeMaybeMarkRedaction at line 692
pkg/sql/sem/tree/format.go in pkg/sql/sem/tree.(*FmtCtx).FormatNode at line 466
pkg/sql/sem/tree/type_name.go in pkg/sql/sem/tree.(*FmtCtx).FormatTypeReference at line 213
pkg/sql/sem/tree/expr.go in pkg/sql/sem/tree.(*CastExpr).Format at line 1505
pkg/sql/sem/tree/format.go in pkg/sql/sem/tree.(*FmtCtx).formatNodeMaybeMarkRedaction at line 692
pkg/sql/sem/tree/format.go in pkg/sql/sem/tree.(*FmtCtx).FormatNode at line 466
pkg/sql/sem/tree/expr.go in pkg/sql/sem/tree.exprFmtWithParen at line 135
pkg/sql/sem/tree/expr.go in pkg/sql/sem/tree.binExprFmtWithParen at line 168
pkg/sql/sem/tree/expr.go in pkg/sql/sem/tree.(*RangeCond).Format at line 537
pkg/sql/sem/tree/format.go in pkg/sql/sem/tree.(*FmtCtx).formatNodeMaybeMarkRedaction at line 692
pkg/sql/sem/tree/format.go in pkg/sql/sem/tree.(*FmtCtx).FormatNode at line 466
pkg/sql/sem/tree/select.go in pkg/sql/sem/tree.(*Where).Format at line 745
pkg/sql/sem/tree/format.go in pkg/sql/sem/tree.(*FmtCtx).formatNodeMaybeMarkRedaction at line 692
pkg/sql/sem/tree/format.go in pkg/sql/sem/tree.(*FmtCtx).FormatNode at line 466
pkg/sql/sem/tree/select.go in pkg/sql/sem/tree.(*SelectClause).Format at line 125
pkg/sql/sem/tree/format.go in pkg/sql/sem/tree.(*FmtCtx).formatNodeMaybeMarkRedaction at line 692
pkg/sql/sem/tree/format.go in pkg/sql/sem/tree.(*FmtCtx).FormatNode at line 466
pkg/sql/sem/tree/select.go in pkg/sql/sem/tree.(*Select).Format at line 57
pkg/sql/sem/tree/format.go in pkg/sql/sem/tree.(*FmtCtx).formatNodeMaybeMarkRedaction at line 692
pkg/sql/sem/tree/format.go in pkg/sql/sem/tree.(*FmtCtx).FormatNode at line 466
pkg/sql/sem/tree/copy.go in pkg/sql/sem/tree.(*CopyTo).Format at line 39
pkg/sql/sem/tree/format.go in pkg/sql/sem/tree.(*FmtCtx).formatNodeMaybeMarkRedaction at line 692
pkg/sql/sem/tree/format.go in pkg/sql/sem/tree.(*FmtCtx).FormatNode at line 466
pkg/sql/exec_util.go in pkg/sql.formatStmtKeyAsRedactableString at line 3600
pkg/sql/event_log.go in pkg/sql.(*planner).getCommonSQLEventDetails at line 193
Tag Value
Cockroach Release v23.1.1
Cockroach SHA: 00f65ea
Platform linux amd64
Distribution CCL
Environment v23.1.1
Command server
Go Version ``
# of CPUs
# of Goroutines

Jira issue: CRDB-28068

@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 May 17, 2023
@rafiss rafiss self-assigned this May 18, 2023
@yuzefovich yuzefovich changed the title sentry: conn_executor.go:865: runtime error: index out of range [1] with length 0 (1) attached stack trace -- stack trace: | github.com/cockroachdb/cockroach/pkg/sql.(*Server).ServeConn.func1 | github.... sql: v23.1.1: index out of bounds in tree.(*Annotations).Get May 19, 2023
@craig craig bot closed this as completed in d529e9d May 19, 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

Successfully merging a pull request may close this issue.

2 participants