Skip to content

cockroach version panic in schema change #83864

@davepacheco

Description

@davepacheco

(originally filed as #83706, moving here as requested)

Describe the problem

While trying to reproduce #82958, I found a case where cockroach version exited with status 2. Thinking maybe it would be reproducible, I started running that in a loop. I saw this panic:

panic: invalid predicate with signature *fmt.pp != func(*scpb.Column, scplan.Params) bool for *scpb.Column[0]

goroutine 1 [running]:
github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scplan.buildSchemaChangeOpGenFunc(0x703b2a0, 0x0, 0xc000e0aff0, 0xc000e0b050, 0xc000e08c18)
	/ws/gc/cockroach/cache/gopath/src/github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scplan/declarative.go:171 +0xd93
github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scplan.buildSchemaChangePlanner(0xc000e0ab40, 0xc000e0ab40)
	/ws/gc/cockroach/cache/gopath/src/github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scplan/declarative.go:60 +0x125
github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scplan.init()
	/ws/gc/cockroach/cache/gopath/src/github.co

To Reproduce

Just run cockroach version in a loop unti it exits. At first, I just did:

for ((i = 0; ; i++)) { echo "ATTEMPT $i"; cockroach version || break; }

Now I'm using this:

#!/bin/bash

# attempt to reproduce failure from `cockroach version`

# specifies a specific `cockroach` binary
export PATH="$HOME/tools/cockroachdb-v21.2.9/bin:$PATH"

date +%FT%TZ > start_time
which cockroach > which_cockroach

for ((i = 0; ; i++)) {
	echo "ATTEMPT $i"
	echo $i > attempt_number
	cockroach version > stdout 2>stderr
	rv=$?
	if [[ $rv -ne 0 ]]; then
		echo $rv > exit_status
		echo "exited with status $rv";
		break;
	fi
}

Unfortunately I lost the status code but I've fixed the above script to avoid that.

It took just over 53h and 1.4M iterations to hit this.

Expected behavior

This should run indefinitely without issue.

Environment:

$ cockroach version
Build Tag:        v21.2.9
Build Time:       2022/04/28 04:02:42
Distribution:     OSS
Platform:         illumos amd64 (x86_64-pc-solaris2.11)
Go Version:       go1.16.10
C Compiler:       gcc 10.3.0
Build Commit ID:  11787edfcfc157a0df951abc34684e4e18b3ef20
Build Type:       release

This is on helios helios-1.0.21004.

CC @knz

Jira issue: CRDB-17319

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-disaster-recoveryC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.O-communityOriginated from the communityT-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)X-blathers-triagedblathers was able to find an owner

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions