-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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: v24.1.14: nil pointer regression due to a type-checking logic change #142615
Comments
CC'ing via the CODEOWNERS-based sentry heuristic:
🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
This is an unusual case. We encounter a panic due to following a nil pointer dereference in the nextval builtin. However, we shouldn't have entered that builtin in the first place. Here’s the calling function from the stack: cockroach/pkg/sql/catalog/schemaexpr/expr.go Lines 311 to 321 in 8486453
We check the expression to ensure its maximum volatility is immutable and, based on that, set up an empty evalContext. However, the nextval builtin requires a fully initialized evalContext (which is why we dereference nil) and is marked as volatility.Volatile. |
I have a local repro for this:
The last query fails on v24.1.14 but succeeds on v24.1.13. Other versions might be affected as well. Eventually, this query reaches the following code path: cockroach/pkg/sql/catalog/schemaexpr/expr.go Lines 311 to 321 in 8486453
The expression passed to I ran a git bisect between v24.1.13 and v24.1.14, and the issue first appeared in commit 978b109. |
cc @DrewKimball |
I forgot to post in here, this also came through support - ZD#26099 |
This commit adds a `RoutineUseResolvedType` flag to the `SemaContext` properties to indicate that type-checking for a routine that has already been resolved to a concrete type should short-circuit. This is used to determine the column type for a `Values` operator which depends on a RECORD-returning routine, which only determines its type after the body is built. This will prevent regressions in other code paths that do not desire this short-circuiting behavior. Fixes cockroachdb#142615 Release note (bug fix): Fixed a bug in `v24.1.14`, `v24.3.7`, `v24.3.8`, and `v25.1` which could cause a nil-pointer error when a column's default expression contained a volatile expression (like `nextval`) as a UDF argument.
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/6382290044/?referrer=webhooks_plugin
Panic Message:
Stacktrace (expand for inline code snippets):
src/runtime/asm_amd64.s#L1694-L1696
cockroach/pkg/util/stop/stopper.go
Lines 479 to 481 in c8459c0
cockroach/pkg/sql/virtual_table.go
Lines 138 to 140 in c8459c0
cockroach/pkg/sql/virtual_table.go
Lines 137 to 139 in c8459c0
cockroach/pkg/sql/virtual_schema.go
Lines 655 to 657 in c8459c0
cockroach/pkg/sql/pg_catalog.go
Lines 1180 to 1182 in c8459c0
cockroach/pkg/sql/information_schema.go
Lines 2689 to 2691 in c8459c0
cockroach/pkg/sql/information_schema.go
Lines 2718 to 2720 in c8459c0
cockroach/pkg/sql/information_schema.go
Lines 2845 to 2847 in c8459c0
cockroach/pkg/sql/pg_catalog.go
Lines 1186 to 1188 in c8459c0
cockroach/pkg/sql/pg_catalog.go
Lines 376 to 378 in c8459c0
cockroach/pkg/sql/catalog/schemaexpr/expr.go
Lines 212 to 214 in c8459c0
cockroach/pkg/sql/catalog/schemaexpr/expr.go
Lines 255 to 257 in c8459c0
cockroach/pkg/sql/catalog/schemaexpr/expr.go
Lines 317 to 319 in c8459c0
cockroach/pkg/sql/sem/eval/expr.go
Lines 20 to 22 in c8459c0
https://github.com/cockroachdb/cockroach/blob/c8459c085e2258f589949e970a527a0342871276/bazel-out/k8-opt/bin/pkg/sql/sem/tree/eval_expr_generated.go#L276-L278
cockroach/pkg/sql/sem/eval/expr.go
Lines 465 to 467 in c8459c0
cockroach/pkg/sql/sem/eval/expr.go
Lines 500 to 502 in c8459c0
https://github.com/cockroachdb/cockroach/blob/c8459c085e2258f589949e970a527a0342871276/bazel-out/k8-opt/bin/pkg/sql/sem/tree/eval_expr_generated.go#L276-L278
cockroach/pkg/sql/sem/eval/expr.go
Lines 483 to 485 in c8459c0
cockroach/pkg/sql/sem/builtins/builtins.go
Lines 2188 to 2190 in c8459c0
GOROOT/src/runtime/signal_unix.go#L880-L882
GOROOT/src/runtime/panic.go#L260-L262
GOROOT/src/runtime/panic.go#L769-L771
cockroach/pkg/sql/virtual_table.go
Lines 129 to 131 in c8459c0
cockroach/pkg/util/errorutil/catch.go
Lines 23 to 25 in c8459c0
Tags
Jira issue: CRDB-48445
The text was updated successfully, but these errors were encountered: