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: CockroachDB crashes when executing the PoC query. #91301

Closed
SteveLeungYL opened this issue Nov 4, 2022 · 5 comments · Fixed by #91307
Closed

sql: CockroachDB crashes when executing the PoC query. #91301

SteveLeungYL opened this issue Nov 4, 2022 · 5 comments · Fixed by #91307
Assignees
Labels
A-schema-changes branch-master Failures and bugs on the master branch. branch-release-22.2 Used to mark GA and release blockers, technical advisories, and bugs for 22.2 C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. GA-blocker O-community Originated from the community T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) X-blathers-triaged blathers was able to find an owner

Comments

@SteveLeungYL
Copy link

SteveLeungYL commented Nov 4, 2022

Describe the problem

The latest version of CockroachDB (e01f162) crashes when executing the following query:

CREATE TABLE v0 (c1 INT PRIMARY KEY, c2 DECIMAL NOT NULL); 
ALTER TABLE v0 ALTER PRIMARY KEY USING COLUMNS ( c2, c2); 

To Reproduce

Here is the detail steps to reproduce the bug.

  1. In system Ubuntu 20.04, download the CockroachDB source code from the github source.
  2. Use the latest version of the CockroachDB code (tested version: e01f162)
  3. Directly make install in the root repository folder.
  4. Run ./cockroach demo, and then paste the PoC query to the cockroach cli environment.
  5. Observe the crash.
# poc
CREATE TABLE v0 (c1 INT PRIMARY KEY, c2 DECIMAL NOT NULL); 
ALTER TABLE v0 ALTER PRIMARY KEY USING COLUMNS ( c2, c2); 

Expected behavior
The query should throw an error indicating that the USING COLUMNS (c2, c2) might contain a semantic error.

Additional data / screenshots

Stack Trace:

[email protected]:26257/movr> CREATE TABLE v0 (c1 INT PRIMARY KEY, c2 DECIMAL NOT NULL);
CREATE TABLE


Time: 5ms total (execution 4ms / network 1ms)

[email protected]:26257/movr> ALTER TABLE v0 ALTER PRIMARY KEY USING COLUMNS ( c2, c2);
*
* ERROR: a SQL panic has occurred while executing the following statement:
* ALTER TABLE v0 ALTER PRIMARY KEY USING COLUMNS (c2, c2)
*
*
* ERROR: a panic has occurred!
* runtime error: index out of range [1] with length 1
* (1) attached stack trace
*   -- stack trace:
*   | github.com/cockroachdb/cockroach/pkg/sql.(*Server).ServeConn.func1
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:828
*   | [...repeated from below...]
* Wraps: (2) while executing: ALTER TABLE _ ALTER PRIMARY KEY USING COLUMNS (_, _)
* Wraps: (3) attached stack trace
*   -- stack trace:
*   | github.com/cockroachdb/cockroach/pkg/sql.(*Server).ServeConn.func1
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:828
*   | runtime.gopanic
*   |   /usr/local/go/src/runtime/panic.go:884
*   | github.com/cockroachdb/cockroach/pkg/sql/colexecerror.CatchVectorizedRuntimeError.func1
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/colexecerror/error.go:58
*   | runtime.gopanic
*   |   /usr/local/go/src/runtime/panic.go:884
*   | github.com/cockroachdb/cockroach/pkg/sql/colexecerror.CatchVectorizedRuntimeError.func1
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/colexecerror/error.go:58
*   | runtime.gopanic
*   |   /usr/local/go/src/runtime/panic.go:884
*   | runtime.goPanicIndex
*   |   /usr/local/go/src/runtime/panic.go:113
*   | github.com/cockroachdb/cockroach/pkg/sql/catalog/tabledesc.index.GetKeyColumnID
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/catalog/tabledesc/index.go:303
*   | github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scexec/scmutationexec.(*visitor).AddColumnToIndex
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scexec/scmutationexec/index.go:410
*   | github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scop.AddColumnToIndex.Visit
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scop/mutation_visitor_generated.go:475
*   | github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scexec.executeDescriptorMutationOps
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scexec/exec_mutation.go:43
*   | github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scexec.ExecuteStage
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scexec/executor.go:32
*   | github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scrun.executeStage
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scrun/scrun.go:177
*   | github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scrun.runTransactionPhase
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scrun/scrun.go:81
*   | github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scrun.RunStatementPhase
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scrun/scrun.go:41
*   | github.com/cockroachdb/cockroach/pkg/sql.(*schemaChangePlanNode).startExec
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/schema_change_plan_node.go:226
*   | github.com/cockroachdb/cockroach/pkg/sql.startExec.func2
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/plan.go:518
*   | github.com/cockroachdb/cockroach/pkg/sql.(*planVisitor).visitInternal.func1
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/walk.go:112
*   | github.com/cockroachdb/cockroach/pkg/sql.(*planVisitor).visitInternal
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/walk.go:297
*   | github.com/cockroachdb/cockroach/pkg/sql.(*planVisitor).visit
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/walk.go:79
*   | github.com/cockroachdb/cockroach/pkg/sql.walkPlan
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/walk.go:43
*   | github.com/cockroachdb/cockroach/pkg/sql.startExec
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/plan.go:521
*   | github.com/cockroachdb/cockroach/pkg/sql.(*planNodeToRowSource).Start
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/plan_node_to_row_source.go:159
*   | github.com/cockroachdb/cockroach/pkg/sql/colexec.(*Columnarizer).Init
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/colexec/columnarizer.go:189
*   | github.com/cockroachdb/cockroach/pkg/sql/colflow.(*batchInfoCollector).init
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/colflow/stats.go:92
*   | github.com/cockroachdb/cockroach/pkg/sql/colexecerror.CatchVectorizedRuntimeError
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/colexecerror/error.go:92
*   | github.com/cockroachdb/cockroach/pkg/sql/colflow.(*batchInfoCollector).Init
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/colflow/stats.go:101
*   | github.com/cockroachdb/cockroach/pkg/sql/colflow.(*BatchFlowCoordinator).init.func1
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/colflow/flow_coordinator.go:247
*   | github.com/cockroachdb/cockroach/pkg/sql/colexecerror.CatchVectorizedRuntimeError
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/colexecerror/error.go:92
*   | github.com/cockroachdb/cockroach/pkg/sql/colflow.(*BatchFlowCoordinator).init
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/colflow/flow_coordinator.go:246
*   | github.com/cockroachdb/cockroach/pkg/sql/colflow.(*BatchFlowCoordinator).Run
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/colflow/flow_coordinator.go:291
*   | github.com/cockroachdb/cockroach/pkg/sql/colflow.(*vectorizedFlow).Run
*   |   /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/colflow/vectorized_flow.go:320
* Wraps: (4) runtime error: index out of range [1] with length 1
* Error types: (1) *withstack.withStack (2) *safedetails.withSafeDetails (3) *withstack.withStack (4) runtime.boundsError
*
panic: runtime error: index out of range [1] with length 1 [recovered]
        panic: runtime error: index out of range [1] with length 1 [recovered]
        panic: runtime error: index out of range [1] with length 1 [recovered]
        panic: runtime error: index out of range [1] with length 1

goroutine 4552 [running]:
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).closeWrapper(0x4005570c00, {0x7921428, 0x4005458640}, {0x48a88c0?, 0x40063f5170?})
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1076 +0x168
github.com/cockroachdb/cockroach/pkg/sql.(*Server).ServeConn.func1({0x7921428, 0x4005458640}, {0x4?})
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:828 +0x4c
panic({0x48a88c0, 0x40063f5170})
        /usr/local/go/src/runtime/panic.go:884 +0x20c
github.com/cockroachdb/cockroach/pkg/sql/colexecerror.CatchVectorizedRuntimeError.func1()
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/colexecerror/error.go:58 +0x360
panic({0x48a88c0, 0x40063f5170})
        /usr/local/go/src/runtime/panic.go:884 +0x20c
github.com/cockroachdb/cockroach/pkg/sql/colexecerror.CatchVectorizedRuntimeError.func1()
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/colexecerror/error.go:58 +0x360
panic({0x48a88c0, 0x40063f5170})
        /usr/local/go/src/runtime/panic.go:884 +0x20c
github.com/cockroachdb/cockroach/pkg/sql/catalog/tabledesc.index.GetKeyColumnID(...)
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/catalog/tabledesc/index.go:303
github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scexec/scmutationexec.(*visitor).AddColumnToIndex(0x0?, {0x79214d0?, 0x4004735890?}, {{{}}, 0x70, 0x2, 0x4, 0x1, 0x0, 0x1})
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scexec/scmutationexec/index.go:410 +0x35c
github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scop.AddColumnToIndex.Visit(...)
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scop/mutation_visitor_generated.go:475
github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scexec.executeDescriptorMutationOps({0x79214d0, 0x4004735890}, {0x79845e0, 0x4001eb2840}, {0x4005095080, 0xc, 0x40059ea588?})
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scexec/exec_mutation.go:43 +0x530
github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scexec.ExecuteStage({0x79214d0, 0x4004735890}, {0x79845e0, 0x4001eb2840}, {0x4005095080, 0xc, 0xc})
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scexec/executor.go:32 +0x110
github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scrun.executeStage({_, _}, _, {_, _}, {{{{0x4004fb2000, 0x17, 0x3a}, {0x4004689500, 0x1, ...}, ...}, ...}, ...}, ...)
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scrun/scrun.go:177 +0x34c
github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scrun.runTransactionPhase({0x79214d0, 0x4004735890}, 0x0?, {0x79845e0?, 0x4001eb2840?}, {{{0x4004fb2000, 0x17, 0x3a}, {0x4004689500, 0x1, ...}, ...}, ...}, ...)
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scrun/scrun.go:81 +0x454
github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scrun.RunStatementPhase(...)
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scrun/scrun.go:41
github.com/cockroachdb/cockroach/pkg/sql.(*schemaChangePlanNode).startExec(0x4004d5f500, {{0x79214d0?, 0x4004735890?}, 0x4003cbd400?, 0x40055710e8?})
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/schema_change_plan_node.go:226 +0x3f0
github.com/cockroachdb/cockroach/pkg/sql.startExec.func2({0x40059eb3c8?, 0x2fa3f08?}, {0x7923bc0, 0x4004d5f500})
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/plan.go:518 +0xf4
github.com/cockroachdb/cockroach/pkg/sql.(*planVisitor).visitInternal.func1()
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/walk.go:112 +0x44
github.com/cockroachdb/cockroach/pkg/sql.(*planVisitor).visitInternal(0x40059eb4e0, {0x7923bc0?, 0x4004d5f500?}, {0x4b98144?, 0xd?})
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/walk.go:297 +0x1698
github.com/cockroachdb/cockroach/pkg/sql.(*planVisitor).visit(0x40059eb4e0, {0x7923bc0, 0x4004d5f500})
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/walk.go:79 +0xe8
github.com/cockroachdb/cockroach/pkg/sql.walkPlan(...)
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/walk.go:43
github.com/cockroachdb/cockroach/pkg/sql.startExec({{0x79214d0?, 0x4004735890?}, 0x4003cbd400?, 0x40055710e8?}, {0x7923bc0, 0x4004d5f500})
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/plan.go:521 +0xf0
github.com/cockroachdb/cockroach/pkg/sql.(*planNodeToRowSource).Start(0x40044cc300, {0x79214d0, 0x4004735860})
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/plan_node_to_row_source.go:159 +0xa4
github.com/cockroachdb/cockroach/pkg/sql/colexec.(*Columnarizer).Init(0x4005375200, {0x79214d0, 0x4004735830})
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/colexec/columnarizer.go:189 +0xc8
github.com/cockroachdb/cockroach/pkg/sql/colflow.(*batchInfoCollector).init(0x15641c3c7?)
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/colflow/stats.go:92 +0x34
github.com/cockroachdb/cockroach/pkg/sql/colexecerror.CatchVectorizedRuntimeError(0x4004da5480?)
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/colexecerror/error.go:92 +0x58
github.com/cockroachdb/cockroach/pkg/sql/colflow.(*batchInfoCollector).Init(0x40029d85a0, {0x79214d0?, 0x4004735830?})
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/colflow/stats.go:101 +0x80
github.com/cockroachdb/cockroach/pkg/sql/colflow.(*BatchFlowCoordinator).init.func1()
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/colflow/flow_coordinator.go:247 +0x34
github.com/cockroachdb/cockroach/pkg/sql/colexecerror.CatchVectorizedRuntimeError(0x40023dc1c0?)
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/colexecerror/error.go:92 +0x58
github.com/cockroachdb/cockroach/pkg/sql/colflow.(*BatchFlowCoordinator).init(0x4003131800?, {0x79214d0?, 0x4004735830?})
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/colflow/flow_coordinator.go:246 +0x48
github.com/cockroachdb/cockroach/pkg/sql/colflow.(*BatchFlowCoordinator).Run(0x4003851290, {0x7921428?, 0x4004da5440?})
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/colflow/flow_coordinator.go:291 +0x1d0
github.com/cockroachdb/cockroach/pkg/sql/colflow.(*vectorizedFlow).Run(0x40070bfcc0, {0x7921428, 0x4004da5440})
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/colflow/vectorized_flow.go:320 +0x180
github.com/cockroachdb/cockroach/pkg/sql.(*DistSQLPlanner).Run(0x4002fd43c0, {0x79214d0, 0x4004735590}, 0x40036c5180, 0x40034fb760, 0x40036e6100, 0x4004e0c700, 0x4005571440, 0x0)
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/distsql_running.go:688 +0x78c
github.com/cockroachdb/cockroach/pkg/sql.(*DistSQLPlanner).PlanAndRun(0x0?, {0x79214d0, 0x4004735590}, 0x2e47af0?, 0x40036c5180, 0x4a78bc0?, {{0x7923bc0?, 0x4004d5f500?}, 0x0?}, 0x4004e0c700)
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/distsql_running.go:1555 +0x158
github.com/cockroachdb/cockroach/pkg/sql.(*DistSQLPlanner).PlanAndRunAll(0x40036c5180?, {0x79214d0, 0x4004735590}, 0x40055710e8?, 0x1?, 0x40055710e8, 0x4004e0c700, 0x78e5a20?)
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/distsql_running.go:1307 +0x160
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).execWithDistSQLEngine(0x4005570c00, {0x79214d0, 0x4004735590}, 0x40055710e8, 0x0?, {0xffff56ee60b0?, 0x4004241f08}, 0x40059ec518?, 0x40034fb8a8)
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:1576 +0x354
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).dispatchToExecutionEngine(0x4005570c00, {0x79214d0, 0x40046891d0}, 0x40055710e8, {0xffff56ee60b0, 0x4004241f08})
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:1216 +0x848
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).execStmtInOpenState(0x4005570c00, {0x79214d0?, 0x40046890b0?}, {{0x7948e80, 0x4004689050}, {0x0, 0x0, 0x0}, {0x400562e2a6, 0x38}, ...}, ...)
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:725 +0x1b98
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).execStmt.func1({0x79214d0?, 0x40046890b0?})
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:129 +0x8c
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).execWithProfiling(0x79214d0?, {0x79214d0?, 0x40046890b0?}, {0x7948e80?, 0x4004689050?}, 0x0?, 0xa450b80?)
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:2421 +0x280
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).execStmt(0x4005570c00, {0x79214d0, 0x40046890b0}, {{0x7948e80, 0x4004689050}, {0x0, 0x0, 0x0}, {0x400562e2a6, 0x38}, ...}, ...)
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:128 +0x380
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).execCmd.func1(0x40050ddaa8, 0x4005570c00, 0x40050dd7c0, 0x40050dd878, 0x40050dd8b8, 0x40059ed898, 0x40059ed888, 0x40059ed8a8)
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1927 +0x2d4
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).execCmd(0x4005570c00)
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1932 +0xcdc
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).run(0x4005570c00, {0x7921428, 0x4005458640}, 0xf13398?, 0x400150fdc8?, 0x400599d7f0?)
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1852 +0x18c
github.com/cockroachdb/cockroach/pkg/sql.(*Server).ServeConn(0x40033c3360?, {0x7921428?, 0x4005458640?}, {0x40014a2a00?}, 0x3?, 0x4006cd1b90?)
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:830 +0xb4
github.com/cockroachdb/cockroach/pkg/sql/pgwire.(*conn).processCommandsAsync.func1()
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/pgwire/conn.go:728 +0x274
created by github.com/cockroachdb/cockroach/pkg/sql/pgwire.(*conn).processCommandsAsync
        /home/cockroach/go_projects/src/github.com/cockroachdb/cockroach/pkg/sql/pgwire/conn.go:639 +0x1dc

Environment:

  • CockroachDB version: v22.2.0-alpha.3-1819-ge01f162913
  • Server OS: Ubuntu 20.04 LTS
  • Client app: CockroachDB demo command.

Additional context
CockroachDB crashes.

Jira issue: CRDB-21196

@SteveLeungYL SteveLeungYL added the C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. label Nov 4, 2022
@blathers-crl
Copy link

blathers-crl bot commented Nov 4, 2022

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/cdc (found keywords: cdc)
  • @cockroachdb/sql-schema (found keywords: ALTER TABLE)
  • @cockroachdb/sql-queries (found keywords: Vectorized,DistSQL,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 otan.

@blathers-crl blathers-crl bot added A-cdc Change Data Capture O-community Originated from the community X-blathers-triaged blathers was able to find an owner T-cdc labels Nov 4, 2022
@blathers-crl
Copy link

blathers-crl bot commented Nov 4, 2022

cc @cockroachdb/cdc

@HonoreDB HonoreDB added A-schema-changes T-sql-schema-deprecated Use T-sql-foundations instead and removed A-cdc Change Data Capture T-cdc labels Nov 4, 2022
@michae2
Copy link
Collaborator

michae2 commented Nov 4, 2022

This sounds a lot like #90306.

@postamar
Copy link
Contributor

postamar commented Nov 4, 2022

It's in fact a shocking bug in the declarative schema changer. I'm tagging it as a GA-blocker, the fix should be simple, low-impact, and the severity justifies not letting this bug fly in 22.2.0.

@postamar postamar added GA-blocker branch-release-22.2 Used to mark GA and release blockers, technical advisories, and bugs for 22.2 branch-release-22.2.0 branch-master Failures and bugs on the master branch. labels Nov 4, 2022
@postamar postamar self-assigned this Nov 4, 2022
@ajwerner
Copy link
Contributor

ajwerner commented Nov 4, 2022

#73604

craig bot pushed a commit that referenced this issue Nov 8, 2022
91100: logictest: only run create_as_non_metamorphic under local r=ajwerner a=ajwerner

This test is very expensive because it was writing 100Mib of data. It now writes more like 10. Nevertheless, let's not run it in so many places. I did verify that it still tests what it was intended to test.

Fixes #91080

Release note: None

91253: ui: fiz size chart when first load r=maryliag a=maryliag

Previously, the chart sizes were being properly
updated when resized, but the initial value was not correct.
This commit adds the call to handle resize so it
can load the correct size on first load.

Fix #91207

https://www.loom.com/share/3faf00b251e849d59120ce0b6e94047f

Release note: None

91283: ui: add horizontal scroll txn insight details r=maryliag a=maryliag

Previously, the table of "waiten on" inside the Transaction Insights details didn't have a horizontal scroll, not letting the user to see the full page on CC console. This commits adds the proper scroll to it.

Fixes #91199

Before
https://www.loom.com/share/80437381cd4546cfad9692c7718de38c

After
https://www.loom.com/share/7363d53bec1d49a0be1b90ab0c9069f2

Release note (bug fix): Add horizontal scroll on "waited on" table on Transaction Insight details page.

91307: scbuild: error on duplicate columns in ALTER PRIMARY KEY r=ajwerner a=postamar

This check has been missing from the declarative schema changer builder. This would result in execution errors in later stages when the new index makes it into the table descriptor. Since these are internal errors, the user experience is correspondingly poor. This patch fixes this.

Fixes #91301

Release note (bug fix): fixed a bug present only in earlier 22.2 release candidates, in which an ALTER PRIMARY KEY USING COLUMNS (x, x) statement would result in an internal error instead of the expected user-facing error with a pg-code.

91443: colexecop: remove stale TODO r=yuzefovich a=yuzefovich

This commit removes now-stale TODO about `Closer.Close` being safe to execute even after `Release` call. The root cause was the intertwining of planning and execution infrastructure and has been recently addressed in #89052.

Epic: None

Release note: None

91446: colexec: protect columnarizer when closing not started input r=yuzefovich a=yuzefovich

This commit makes sure that the columnarizer calls `InternalClose` only if it has been initialized. Previously, if `Columnarizer.Init` wasn't performed (most likely due to a panic in `Init` of another operator), the columnarizer's input would not be started, so when `InternalClose` called `input.ConsumerClosed`, that could lead to a nil pointer panic since `input.Ctx` would be `nil` if the input tried to do some logging (some processors do that). We now protect against this by short-circuiting `InternalClose` call altogether, similar to what we do in `Columnarizer.DrainMeta`. This makes it so that the columnarizer satisfies `Closer.Close` contract properly.

Fixes: #84902.

Release note: None

91450: workload/schemachange: address intermittent failures with select stmts r=fqazi a=fqazi

Fixes: #91445

Previously, we added logic to detect memory budget, and disk budget errors but those were only when opening a result set. Unfortunately, these errors can also be hit when consuming the rows themselves. To address this, this patch will detect the same errors and ignore them if detected consuming the result set.

Release note: None

Co-authored-by: Andrew Werner <[email protected]>
Co-authored-by: maryliag <[email protected]>
Co-authored-by: Marius Posta <[email protected]>
Co-authored-by: Yahor Yuzefovich <[email protected]>
Co-authored-by: Faizan Qazi <[email protected]>
@craig craig bot closed this as completed in 3a3123d Nov 8, 2022
postamar pushed a commit that referenced this issue Nov 8, 2022
This check has been missing from the declarative schema changer builder.
This would result in execution errors in later stages when the new index
makes it into the table descriptor. Since these are internal errors, the
user experience is correspondingly poor. This patch fixes this.

Fixes #91301

Release note (bug fix): fixed a bug present only in earlier 22.2 release
candidates, in which an ALTER PRIMARY KEY USING COLUMNS (x, x) statement
would result in an internal error instead of the expected user-facing
error with a pg-code.
postamar pushed a commit that referenced this issue Nov 8, 2022
This check has been missing from the declarative schema changer builder.
This would result in execution errors in later stages when the new index
makes it into the table descriptor. Since these are internal errors, the
user experience is correspondingly poor. This patch fixes this.

Fixes #91301

Release note (bug fix): fixed a bug present only in earlier 22.2 release
candidates, in which an ALTER PRIMARY KEY USING COLUMNS (x, x) statement
would result in an internal error instead of the expected user-facing
error with a pg-code.
postamar pushed a commit that referenced this issue Nov 8, 2022
postamar pushed a commit that referenced this issue Nov 8, 2022
@exalate-issue-sync exalate-issue-sync bot added T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) and removed T-sql-schema-deprecated Use T-sql-foundations instead labels May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-schema-changes branch-master Failures and bugs on the master branch. branch-release-22.2 Used to mark GA and release blockers, technical advisories, and bugs for 22.2 C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. GA-blocker O-community Originated from the community T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) X-blathers-triaged blathers was able to find an owner
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants