cockroachdb / cockroachdb/cockroach

Sentry: catch.go:24: runtime error: invalid memory address or nil pointer dereference (1) plan gist: AgHO////vxwAANABAAAAAwUEBgQ= Wraps: (2) while executing: SHOW CREATE FUNCTION _._ Wraps: (3) Wraps:...

Open
#175,073 4 comments 0 reactions 1 assignee Assigned to @himanshu-shrivastava-crl View on GitHub
branch-release-26.2 C-bug O-sentry P-2 T-sql-foundations X-blathers-triaged
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

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/7727765677/?referrer=webhooks_plugin](https://cockroach-labs.sentry.io/issues/7727765677/?referrer=webhooks_plugin)

Panic Message:

```
catch.go:24: runtime error: invalid memory address or nil pointer dereference
(1) plan gist: AgHO////vxwAANABAAAAAwUEBgQ=
Wraps: (2) while executing: SHOW CREATE FUNCTION _._
Wraps: (3)
Wraps: (4) assertion failure
Wraps: (5) attached stack trace
-- stack trace:
| github.com/cockroachdb/cockroach/pkg/util/errorutil.shouldCatch
| pkg/util/errorutil/catch.go:24
| github.com/cockroachdb/cockroach/pkg/util/errorutil.MaybeCatchPanic
| pkg/util/errorutil/catch.go:38
| runtime.gopanic
| GOROOT/src/runtime/panic.go:783
| runtime.panicmem
| GOROOT/src/runtime/panic.go:262
| runtime.sigpanic
| GOROOT/src/runtime/signal_unix.go:925
| github.com/cockroachdb/cockroach/pkg/sql.formatFunctionQueryTypesForDisplay.func2
| pkg/sql/show_create_clauses.go:474
| github.com/cockroachdb/cockroach/pkg/sql/sem/plpgsqltree.(*TypeRefVisitor).Visit
| pkg/sql/sem/plpgsqltree/visitor.go:336
| github.com/cockroachdb/cockroach/pkg/sql/sem/plpgsqltree.(*Declaration).WalkStmt
| pkg/sql/sem/plpgsqltree/statements.go:180
| github.com/cockroachdb/cockroach/pkg/sql/sem/plpgsqltree.(*Block).WalkStmt
| pkg/sql/sem/plpgsqltree/statements.go:107
| github.com/cockroachdb/cockroach/pkg/sql/sem/plpgsqltree.Walk
| pkg/sql/sem/plpgsqltree/visitor.go:23
| github.com/cockroachdb/cockroach/pkg/sql.formatFunctionQueryTypesForDisplay
| pkg/sql/show_create_clauses.go:523
| github.com/cockroachdb/cockroach/pkg/sql.init.createRoutinePopulate.func955
| pkg/sql/crdb_internal.go:3383
| github.com/cockroachdb/cockroach/pkg/sql.(*virtualDefEntry).getPlanInfo.func1.1
| pkg/sql/virtual_schema.go:697
| github.com/cockroachdb/cockroach/pkg/sql.setupGenerator.func3.1
| pkg/sql/virtual_table.go:130
| github.com/cockroachdb/cockroach/pkg/sql.setupGenerator.func3
| pkg/sql/virtual_table.go:131
| github.com/cockroachdb/cockroach/pkg/util/stop.(*Stopper).RunAsyncTaskEx.func1
| pkg/util/stop/stopper.go:447
| runtime.goexit
| src/runtime/asm_amd64.s:1693
Wraps: (6) runtime error: invalid memory address or nil pointer dereference
| -- cause hidden behind barrier
| runtime error: invalid memory address or nil pointer dereference
| (1) runtime error: invalid memory address or nil pointer dereference
| Error types: (1) runtime.errorString
Error types: (1) *safedetails.withSafeDetails (2) *safedetails.withSafeDetails (3) *colexecerror.notInternalError (4) *assert.withAssertionFailure (5) *withstack.withStack (6) *barriers.barrierErr
-- report composition:
*barriers.barrierErr: masked error: runtime error: invalid memory address or nil pointer dereference
catch.go:24: *withstack.withStack (top exception)
*assert.withAssertionFailure
*colexecerror.notInternalError
*safedetails.withSafeDetails: while executing: SHOW CREATE FUNCTION _._
*safedetails.withSafeDetails: plan gist: AgHO////vxwAANABAAAAAwUEBgQ=
```

Stacktrace (expand for inline code snippets):

[src/runtime/asm_amd64.s#L1692-L1694](src/runtime/asm_amd64.s#L1692-L1694)
[pkg/util/stop/stopper.go#L446-L448](pkg/util/stop/stopper.go#L446-L448)
[pkg/sql/virtual_table.go#L130-L132](pkg/sql/virtual_table.go#L130-L132)
[pkg/sql/virtual_table.go#L129-L131](pkg/sql/virtual_table.go#L129-L131)
[pkg/sql/virtual_schema.go#L696-L698](pkg/sql/virtual_schema.go#L696-L698)
[pkg/sql/crdb_internal.go#L3382-L3384](pkg/sql/crdb_internal.go#L3382-L3384)
[pkg/sql/show_create_clauses.go#L522-L524](pkg/sql/show_create_clauses.go#L522-L524)
[pkg/sql/sem/plpgsqltree/visitor.go#L22-L24](pkg/sql/sem/plpgsqltree/visitor.go#L22-L24)
[pkg/sql/sem/plpgsqltree/statements.go#L106-L108](pkg/sql/sem/plpgsqltree/statements.go#L106-L108)
[pkg/sql/sem/plpgsqltree/statements.go#L179-L181](pkg/sql/sem/plpgsqltree/statements.go#L179-L181)
[pkg/sql/sem/plpgsqltree/visitor.go#L335-L337](pkg/sql/sem/plpgsqltree/visitor.go#L335-L337)
[pkg/sql/show_create_clauses.go#L473-L475](pkg/sql/show_create_clauses.go#L473-L475)
[GOROOT/src/runtime/signal_unix.go#L924-L926](GOROOT/src/runtime/signal_unix.go#L924-L926)
[GOROOT/src/runtime/panic.go#L261-L263](GOROOT/src/runtime/panic.go#L261-L263)
[GOROOT/src/runtime/panic.go#L782-L784](GOROOT/src/runtime/panic.go#L782-L784)
[pkg/util/errorutil/catch.go#L37-L39](pkg/util/errorutil/catch.go#L37-L39)
[pkg/util/errorutil/catch.go#L23-L25](pkg/util/errorutil/catch.go#L23-L25)

```
src/runtime/asm_amd64.s in runtime.goexit at line 1693
pkg/util/stop/stopper.go in pkg/util/stop.(*Stopper).RunAsyncTaskEx.func1 at line 447
pkg/sql/virtual_table.go in pkg/sql.setupGenerator.func3 at line 131
pkg/sql/virtual_table.go in pkg/sql.setupGenerator.func3.1 at line 130
pkg/sql/virtual_schema.go in pkg/sql.(*virtualDefEntry).getPlanInfo.func1.1 at line 697
pkg/sql/crdb_internal.go in pkg/sql.init.createRoutinePopulate.func955 at line 3383
pkg/sql/show_create_clauses.go in pkg/sql.formatFunctionQueryTypesForDisplay at line 523
pkg/sql/sem/plpgsqltree/visitor.go in pkg/sql/sem/plpgsqltree.Walk at line 23
pkg/sql/sem/plpgsqltree/statements.go in pkg/sql/sem/plpgsqltree.(*Block).WalkStmt at line 107
pkg/sql/sem/plpgsqltree/statements.go in pkg/sql/sem/plpgsqltree.(*Declaration).WalkStmt at line 180
pkg/sql/sem/plpgsqltree/visitor.go in pkg/sql/sem/plpgsqltree.(*TypeRefVisitor).Visit at line 336
pkg/sql/show_create_clauses.go in pkg/sql.formatFunctionQueryTypesForDisplay.func2 at line 474
GOROOT/src/runtime/signal_unix.go in runtime.sigpanic at line 925
GOROOT/src/runtime/panic.go in runtime.panicmem at line 262
GOROOT/src/runtime/panic.go in runtime.gopanic at line 783
pkg/util/errorutil/catch.go in pkg/util/errorutil.MaybeCatchPanic at line 38
pkg/util/errorutil/catch.go in pkg/util/errorutil.shouldCatch at line 24
```

### Tags

| Tag | Value |
| --- | --- |
| Command | mt start-sql |
| Environment | v26.2.6 |
| Go Version | go1.25.13 |
| Platform | linux amd64 |
| Distribution | CCL |
| Cockroach Release | v26.2.6 |
| Cockroach SHA | f0adfbe4c645d4d458de930b415fd46c4459ad90 |
| # of CPUs | 16 |
| # of Goroutines | 270 |

Jira issue: CRDB-68212

Contributor guide

Open the contributing guide

Research direction

Start in pkg/sql/show_create_clauses.go at lines 474 and 523, then read pkg/sql/sem/plpgsqltree/visitor.go around line 336 and the related declaration walking code. Investigate the nil dereference while executing SHOW CREATE FUNCTION, using the mt start-sql environment described in the report. Done means this operation no longer crashes with the reported invalid memory address error.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, sql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.