-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: logic test can throw nil-pointer #88398
Copy link
Copy link
Closed
Labels
C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.T-sql-queriesSQL Queries TeamSQL Queries Team
Description
Describe the problem
There was a test failure in the CI build for #88333 that looked like this:
=== RUN TestLogic_experimental_distsql_planning
test_log_scope.go:161: test logs captured to: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestLogic_experimental_distsql_planning3979966309
test_log_scope.go:79: use -show-logs to present logs inline
*
* INFO: Running test with the default test tenant. If you are only seeing a test case failure when this message appears, there may be a problem with your test case running within tenants.
*
panic.go:260: -- test log scope end --
ERROR: a panic has occurred!
Details cannot be printed yet because we are still unwinding.
Hopefully the test harness prints the panic below, otherwise check the test logs.
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestLogic_experimental_distsql_planning3979966309
panic.go:260: runtime error: invalid memory address or nil pointer dereference
goroutine 820655 [running]:
runtime/debug.Stack()
/usr/local/go/src/runtime/debug/stack.go:24 +0x65
github.com/cockroachdb/cockroach/pkg/util/leaktest.AfterTest.func1()
/go/src/github.com/cockroachdb/cockroach/pkg/util/leaktest/leaktest.go:110 +0x166
panic({0x43202c0, 0x8365120})
/usr/local/go/src/runtime/panic.go:884 +0x212
github.com/cockroachdb/cockroach/pkg/config.(*SystemConfig).PurgeZoneConfigCache(0x0)
/go/src/github.com/cockroachdb/cockroach/pkg/config/system.go:411 +0x33
github.com/cockroachdb/cockroach/pkg/testutils/serverutils.StartNewTestCluster({_, _}, _, {{{{0x5cd69a0, 0xc004806000}, {0x0, 0x0}, {0x5cd6880, 0xc0063534a0}, {0x5cd7a40, ...}, ...}, ...}, ...})
/go/src/github.com/cockroachdb/cockroach/pkg/testutils/serverutils/test_cluster_shim.go:267 +0xeb
github.com/cockroachdb/cockroach/pkg/sql/logictest.(*logicTest).newCluster(0xc000418f00, {0xc00005d958?, 0x0?, 0x0, 0x0?}, {0x0, 0x0, 0x3d28cc0?}, {0x0, 0x0, ...}, ...)
/go/src/github.com/cockroachdb/cockroach/pkg/sql/logictest/logic.go:1352 +0xde5
github.com/cockroachdb/cockroach/pkg/sql/logictest.(*logicTest).setup(0xc000418f00, {{0x49dd412, 0xd}, 0x3, 0x1, {0x49c1310, 0x2}, 0x0, {0x0, 0x0}, ...}, ...)
/go/src/github.com/cockroachdb/cockroach/pkg/sql/logictest/logic.go:1702 +0x38d
github.com/cockroachdb/cockroach/pkg/sql/logictest.RunLogicTest(0xc006286340, {0x20?, 0xc0?, 0xec?, 0x54?}, 0x6, {0xc0055be0a0, 0x4b})
/go/src/github.com/cockroachdb/cockroach/pkg/sql/logictest/logic.go:3941 +0x8ac
github.com/cockroachdb/cockroach/pkg/sql/logictest/tests/fakedist-disk.runLogicTest(0xc006286340, {0x4a28df1, 0x1d})
/go/src/github.com/cockroachdb/cockroach/pkg/sql/logictest/tests/fakedist-disk/generated_test.go:58 +0x97
github.com/cockroachdb/cockroach/pkg/sql/logictest/tests/fakedist-disk.TestLogic_experimental_distsql_planning(0xffb800?)
/go/src/github.com/cockroachdb/cockroach/pkg/sql/logictest/tests/fakedist-disk/generated_test.go:730 +0x59
testing.tRunner(0xc006286340, 0x4c8e378)
/usr/local/go/src/testing/testing.go:1446 +0x10b
created by testing.(*T).Run
/usr/local/go/src/testing/testing.go:1493 +0x35f
--- FAIL: TestLogic_experimental_distsql_planning (1.74s)
The problem is likely that SystemConfig.PurgeZoneConfigCache is called unconditionally on the result of SystemConfigProvider.GetSystemConfig, even though the result of GetSystemConfig can be nil.
Expected behavior
Either the nil-receiver case should be handled, or PurgeZoneConfigCache shouldn't be called when SystemConfig is nil.
Additional context
This panic should be testing-only, since it's only called in TestCluster and TestLogic.
Jira issue: CRDB-19801
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.T-sql-queriesSQL Queries TeamSQL Queries Team
Type
Projects
Status
Done