cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
30.15k stars 3.81k forks source link

plpgsql: v24.1.2: interface conversion: interface is nil, not plpgsqltree.Statement #129798

Open cockroach-sentry opened 2 months ago

cockroach-sentry commented 2 months ago

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

Sentry Link: https://cockroach-labs.sentry.io/issues/5766976498/?referrer=webhooks_plugin

Panic Message:

catch.go:29: interface conversion: interface is nil, not plpgsqltree.Statement
(1) assertion failure
Wraps: (2) attached stack trace
  -- stack trace:
  | github.com/cockroachdb/cockroach/pkg/util/errorutil.ShouldCatch
  |     github.com/cockroachdb/cockroach/pkg/util/errorutil/catch.go:29
  | github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder.(*Builder).Build.func1
  |     github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:225
  | runtime.gopanic
  |     GOROOT/src/runtime/panic.go:770
  | github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder.(*Builder).buildCreateFunction.func1
  |     github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/create_function.go:83
  | runtime.gopanic
  |     GOROOT/src/runtime/panic.go:770
  | runtime.panicnildottype
  |     GOROOT/src/runtime/iface.go:278
  | github.com/cockroachdb/cockroach/pkg/sql/plpgsql/parser.(*plpgsqlSymUnion).statement
  |     plpgsql-gen.y:82
  | github.com/cockroachdb/cockroach/pkg/sql/plpgsql/parser.(*plpgsqlParserImpl).Parse
  |     plpgsql-gen.y:425
  | github.com/cockroachdb/cockroach/pkg/sql/plpgsql/parser.(*Parser).parse
  |     github.com/cockroachdb/cockroach/pkg/sql/plpgsql/parser/parse.go:101
  | github.com/cockroachdb/cockroach/pkg/sql/plpgsql/parser.(*Parser).parseWithDepth
  |     github.com/cockroachdb/cockroach/pkg/sql/plpgsql/parser/parse.go:85
  | github.com/cockroachdb/cockroach/pkg/sql/plpgsql/parser.Parse
  |     github.com/cockroachdb/cockroach/pkg/sql/plpgsql/parser/parse.go:135
  | github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder.(*Builder).buildCreateFunction
  |     github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/create_function.go:375
  | github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder.(*Builder).buildStmt
  |     github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:387
  | github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder.(*Builder).buildStmtAtRootWithScope
  |     github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:299
  | github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder.(*Builder).buildStmtAtRoot
  |     github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:280
  | github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder.(*Builder).Build
  |     github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:259
  | github.com/cockroachdb/cockroach/pkg/sql.(*optPlanningCtx).buildReusableMemo
  |     github.com/cockroachdb/cockroach/pkg/sql/plan_opt.go:450
  | github.com/cockroachdb/cockroach/pkg/sql.(*planner).prepareUsingOptimizer
  |     github.com/cockroachdb/cockroach/pkg/sql/plan_opt.go:170
  | github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).populatePrepared
  |     github.com/cockroachdb/cockroach/pkg/sql/conn_executor_prepare.go:344
  | github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).prepare.func2
  |     github.com/cockroachdb/cockroach/pkg/sql/conn_executor_prepare.go:284
  | github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).prepare
  |     github.com/cockroachdb/cockroach/pkg/sql/conn_executor_prepare.go:289
  | github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).addPreparedStmt
  |     github.com/cockroachdb/cockroach/pkg/sql/conn_executor_prepare.go:122
  | github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).execPrepare
  |     github.com/cockroachdb/cockroach/pkg/sql/conn_executor_prepare.go:83
  | github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).execCmd
  |     github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:2423
  | github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).run
  |     github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:2214
  | github.com/cockroachdb/cockroach/pkg/sql.(*Server).ServeConn
  |     github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:965
  | github.com/cockroachdb/cockroach/pkg/sql/pgwire.(*conn).processCommands
  |     github.com/cockroachdb/cockroach/pkg/sql/pgwire/conn.go:253
  | github.com/cockroachdb/cockroach/pkg/sql/pgwire.(*Server).serveImpl.func3
  |     github.com/cockroachdb/cockroach/pkg/sql/pgwire/server.go:997
  | runtime.goexit
  |     src/runtime/asm_amd64.s:1695
Wraps: (3) interface conversion: interface is nil, not plpgsqltree.Statement
  | -- cause hidden behind barrier
  | interface conversion: interface is nil, not plpgsqltree.Statement
  | (1) interface conversion: interface is nil, not plpgsqltree.Statement
  | Error types: (1) *runtime.TypeAssertionError
Error types: (1) *assert.withAssertionFailure (2) *withstack.withStack (3) *barriers.barrierErr
-- report composition:
*barriers.barrierErr: masked error: interface conversion: interface is nil, not plpgsqltree.Statement
catch.go:29: *withstack.withStack (top exception)
*assert.withAssertionFailure
Stacktrace (expand for inline code snippets): [src/runtime/asm_amd64.s#L1694-L1696](src/runtime/asm_amd64.s#L1694-L1696) [https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/pgwire/server.go#L996-L998](https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/pgwire/server.go#L996-L998) [https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/pgwire/conn.go#L252-L254](https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/pgwire/conn.go#L252-L254) [https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/conn_executor.go#L964-L966](https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/conn_executor.go#L964-L966) [https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/conn_executor.go#L2213-L2215](https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/conn_executor.go#L2213-L2215) [https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/conn_executor.go#L2422-L2424](https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/conn_executor.go#L2422-L2424) [https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/conn_executor_prepare.go#L82-L84](https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/conn_executor_prepare.go#L82-L84) [https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/conn_executor_prepare.go#L121-L123](https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/conn_executor_prepare.go#L121-L123) [https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/conn_executor_prepare.go#L288-L290](https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/conn_executor_prepare.go#L288-L290) [https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/conn_executor_prepare.go#L283-L285](https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/conn_executor_prepare.go#L283-L285) [https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/conn_executor_prepare.go#L343-L345](https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/conn_executor_prepare.go#L343-L345) [https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/plan_opt.go#L169-L171](https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/plan_opt.go#L169-L171) [https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/plan_opt.go#L449-L451](https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/plan_opt.go#L449-L451) [https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/opt/optbuilder/builder.go#L258-L260](https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/opt/optbuilder/builder.go#L258-L260) [https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/opt/optbuilder/builder.go#L279-L281](https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/opt/optbuilder/builder.go#L279-L281) [https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/opt/optbuilder/builder.go#L298-L300](https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/opt/optbuilder/builder.go#L298-L300) [https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/opt/optbuilder/builder.go#L386-L388](https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/opt/optbuilder/builder.go#L386-L388) [https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/opt/optbuilder/create_function.go#L374-L376](https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/opt/optbuilder/create_function.go#L374-L376) [https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/plpgsql/parser/parse.go#L134-L136](https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/plpgsql/parser/parse.go#L134-L136) [https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/plpgsql/parser/parse.go#L84-L86](https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/plpgsql/parser/parse.go#L84-L86) [https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/plpgsql/parser/parse.go#L100-L102](https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/plpgsql/parser/parse.go#L100-L102) [plpgsql-gen.y#L424-L426](plpgsql-gen.y#L424-L426) [plpgsql-gen.y#L81-L83](plpgsql-gen.y#L81-L83) [GOROOT/src/runtime/iface.go#L277-L279](GOROOT/src/runtime/iface.go#L277-L279) [GOROOT/src/runtime/panic.go#L769-L771](GOROOT/src/runtime/panic.go#L769-L771) [https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/opt/optbuilder/create_function.go#L82-L84](https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/opt/optbuilder/create_function.go#L82-L84) [GOROOT/src/runtime/panic.go#L769-L771](GOROOT/src/runtime/panic.go#L769-L771) [https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/opt/optbuilder/builder.go#L224-L226](https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/sql/opt/optbuilder/builder.go#L224-L226) [https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/util/errorutil/catch.go#L28-L30](https://github.com/cockroachdb/cockroach/blob/5a68aaa15d7044e394b93b7ca78c8ddb7fcee150/pkg/util/errorutil/catch.go#L28-L30)
src/runtime/asm_amd64.s in runtime.goexit at line 1695
pkg/sql/pgwire/server.go in pkg/sql/pgwire.(*Server).serveImpl.func3 at line 997
pkg/sql/pgwire/conn.go in pkg/sql/pgwire.(*conn).processCommands at line 253
pkg/sql/conn_executor.go in pkg/sql.(*Server).ServeConn at line 965
pkg/sql/conn_executor.go in pkg/sql.(*connExecutor).run at line 2214
pkg/sql/conn_executor.go in pkg/sql.(*connExecutor).execCmd at line 2423
pkg/sql/conn_executor_prepare.go in pkg/sql.(*connExecutor).execPrepare at line 83
pkg/sql/conn_executor_prepare.go in pkg/sql.(*connExecutor).addPreparedStmt at line 122
pkg/sql/conn_executor_prepare.go in pkg/sql.(*connExecutor).prepare at line 289
pkg/sql/conn_executor_prepare.go in pkg/sql.(*connExecutor).prepare.func2 at line 284
pkg/sql/conn_executor_prepare.go in pkg/sql.(*connExecutor).populatePrepared at line 344
pkg/sql/plan_opt.go in pkg/sql.(*planner).prepareUsingOptimizer at line 170
pkg/sql/plan_opt.go in pkg/sql.(*optPlanningCtx).buildReusableMemo at line 450
pkg/sql/opt/optbuilder/builder.go in pkg/sql/opt/optbuilder.(*Builder).Build at line 259
pkg/sql/opt/optbuilder/builder.go in pkg/sql/opt/optbuilder.(*Builder).buildStmtAtRoot at line 280
pkg/sql/opt/optbuilder/builder.go in pkg/sql/opt/optbuilder.(*Builder).buildStmtAtRootWithScope at line 299
pkg/sql/opt/optbuilder/builder.go in pkg/sql/opt/optbuilder.(*Builder).buildStmt at line 387
pkg/sql/opt/optbuilder/create_function.go in pkg/sql/opt/optbuilder.(*Builder).buildCreateFunction at line 375
pkg/sql/plpgsql/parser/parse.go in pkg/sql/plpgsql/parser.Parse at line 135
pkg/sql/plpgsql/parser/parse.go in pkg/sql/plpgsql/parser.(*Parser).parseWithDepth at line 85
pkg/sql/plpgsql/parser/parse.go in pkg/sql/plpgsql/parser.(*Parser).parse at line 101
plpgsql-gen.y in pkg/sql/plpgsql/parser.(*plpgsqlParserImpl).Parse at line 425
plpgsql-gen.y in pkg/sql/plpgsql/parser.(*plpgsqlSymUnion).statement at line 82
GOROOT/src/runtime/iface.go in runtime.panicnildottype at line 278
GOROOT/src/runtime/panic.go in runtime.gopanic at line 770
pkg/sql/opt/optbuilder/create_function.go in pkg/sql/opt/optbuilder.(*Builder).buildCreateFunction.func1 at line 83
GOROOT/src/runtime/panic.go in runtime.gopanic at line 770
pkg/sql/opt/optbuilder/builder.go in pkg/sql/opt/optbuilder.(*Builder).Build.func1 at line 225
pkg/util/errorutil/catch.go in pkg/util/errorutil.ShouldCatch at line 29

Tags

Tag Value
Command mt start-sql
Environment v24.1.2
Go Version go1.22.3 X:nocoverageredesign
Platform linux amd64
Distribution CCL
Cockroach Release v24.1.2-2-g5a68aaa15d7
Cockroach SHA 5a68aaa15d7044e394b93b7ca78c8ddb7fcee150
# of CPUs 16
# of Goroutines 274

Jira issue: CRDB-41717

DrewKimball commented 13 hours ago

Probably we need to backport #129951 to 24.2 and 24.1.