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

CockroachDB Internal Error: index out of range [0] with length 0 #137631

Open
SteveLeungYL opened this issue Dec 17, 2024 · 3 comments · May be fixed by #138025
Open

CockroachDB Internal Error: index out of range [0] with length 0 #137631

SteveLeungYL opened this issue Dec 17, 2024 · 3 comments · May be fixed by #138025
Assignees
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-community Originated from the community T-sql-queries SQL Queries Team X-blathers-triaged blathers was able to find an owner

Comments

@SteveLeungYL
Copy link

SteveLeungYL commented Dec 17, 2024

Describe the problem

The latest version of the CockroachDB (v24.3.1) crashes when executing the following query:

SET experimental_enable_temp_tables = 'on';
CREATE TABLE v00 (c01 INT, c02 STRING);
CREATE TEMP TABLE v300 AS ( ( TABLE [ SHOW EXPERIMENTAL_FINGERPRINTS FROM TABLE v00 ] ) ) ;

To Reproduce

  1. In operating system Ubuntu 20.04 LTS, download the pre-build CockroachDB binaries (v24.3.1) from link
  2. Run ./cockroach demo, and then paste the PoC query to the CockroachDB cli environment.
  3. Observe the crash and log the stack information.

Expected behavior
Should not be Internal Error

Additional data / screenshots

This is the stack frame from the crash (v24.3.1):

ERROR: internal error: runtime error: index out of range [0] with length 0
SQLSTATE: XX000
DETAIL: stack trace:
pkg/util/errorutil/catch.go:24: ShouldCatch()
pkg/sql/opt/optbuilder/builder.go:237: func1()
GOROOT/src/runtime/panic.go:770: gopanic()
GOROOT/src/runtime/panic.go:114: goPanicIndex()
pkg/sql/sem/tree/annotation.go:43: Set()
pkg/sql/sem/tree/annotation.go:30: SetAnnotation()
pkg/sql/resolver.go:1221: ResolveExistingObjectEx()
pkg/sql/resolver.go:1198: func1()
pkg/sql/schema_resolver.go:438: runWithOptions()
pkg/sql/resolver.go:1197: ResolveUncachedTableDescriptorEx()
pkg/sql/show_fingerprints.go:95: ShowFingerprints()
pkg/sql/opaque.go:281: planOpaque()
pkg/sql/opaque.go:59: buildOpaque()
pkg/sql/opt/optbuilder/opaque.go:65: tryBuildOpaque()
pkg/sql/opt/optbuilder/builder.go:482: buildStmt()
pkg/sql/opt/optbuilder/select.go:213: buildDataSource()
pkg/sql/opt/optbuilder/select.go:89: buildDataSource()
pkg/sql/opt/optbuilder/select.go:1409: buildFromTablesRightDeep()
pkg/sql/opt/optbuilder/select.go:1386: buildFromTables()
pkg/sql/opt/optbuilder/select.go:1316: buildFrom()
pkg/sql/opt/optbuilder/select.go:1232: buildSelectClause()
pkg/sql/opt/optbuilder/select.go:1164: buildSelectStmtWithoutParens()
pkg/sql/opt/optbuilder/select.go:1116: func1()
pkg/sql/opt/optbuilder/with.go:111: processWiths()
pkg/sql/opt/optbuilder/select.go:1115: buildSelect()
pkg/sql/opt/optbuilder/builder.go:368: buildStmt()
pkg/sql/opt/optbuilder/builder.go:311: buildStmtAtRootWithScope()
pkg/sql/opt/optbuilder/builder.go:292: buildStmtAtRoot()
pkg/sql/opt/optbuilder/builder.go:271: Build()
pkg/sql/plan_opt.go:824: buildExecMemo()
pkg/sql/plan_opt.go:260: makeOptimizerPlan()
pkg/sql/schema_changer.go:376: 2()

Environment:

  • CockroachDB version: v24.3.1
  • Server OS: Ubuntu 24.04 LTS
  • Client app: CockroachDB demo command. (./cockroach demo)
  • Detailed CockroachDB version output:
cockroach version details:
Build Tag:        v24.3.1
Build Time:       2024/12/13 20:29:56
Distribution:     CCL
Platform:         linux arm64 (aarch64-unknown-linux-gnu)
Go Version:       go1.22.8 X:nocoverageredesign
C Compiler:       gcc 6.5.0
Build Commit ID:  950be288db97fe1d8f9c19918e37695d3c1f4bb0
Build Type:       release
Enabled Assertions: false

Jira issue: CRDB-45679

@SteveLeungYL SteveLeungYL added the C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. label Dec 17, 2024
Copy link

blathers-crl bot commented Dec 17, 2024

Hi @SteveLeungYL, please add branch-* labels to identify which branch(es) this C-bug affects.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

Copy link

blathers-crl bot commented Dec 17, 2024

Hello, I am Blathers. I am here to help you get the issue triaged.

Hoot - a bug! Though bugs are the bane of my existence, rest assured the wretched thing will get the best of care here.

I have CC'd a few people who may be able to assist you:

  • @cockroachdb/sql-queries (found keywords: Optimizer,plan)

If we have not gotten back to your issue within a few business days, you can try the following:

  • Join our community slack channel and ask on #cockroachdb.
  • Try find someone from here if you know they worked closely on the area and CC them.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@blathers-crl blathers-crl bot added O-community Originated from the community X-blathers-triaged blathers was able to find an owner labels Dec 17, 2024
@rytaft rytaft added the T-sql-queries SQL Queries Team label Dec 17, 2024
@github-project-automation github-project-automation bot moved this to Triage in SQL Queries Dec 17, 2024
@mgartner mgartner moved this from Triage to Bugs to Fix in SQL Queries Dec 26, 2024
@mgartner
Copy link
Collaborator

Thanks for the report!

@yuzefovich yuzefovich self-assigned this Dec 27, 2024
@yuzefovich yuzefovich moved this from Bugs to Fix to Active in SQL Queries Dec 27, 2024
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-community Originated from the community T-sql-queries SQL Queries Team X-blathers-triaged blathers was able to find an owner
Projects
Status: Active
Development

Successfully merging a pull request may close this issue.

4 participants