pingcap / tidb

TiDB - the open-source, cloud-native, distributed SQL database designed for modern applications.
https://pingcap.com
Apache License 2.0
37.39k stars 5.85k forks source link

unexpected fault address 0x0 in the parser #32392

Open hawkingrei opened 2 years ago

hawkingrei commented 2 years ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

make race
 unexpected fault address 0x0
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x80 addr=0x0 pc=0x23af429]
goroutine 3126 [running]:
runtime.throw({0x4ea2bab, 0x18})
    /usr/local/go/src/runtime/panic.go:1198 +0x71 fp=0xc000d321c8 sp=0xc000d32198 pc=0x12c35b1
runtime.sigpanic()
    /usr/local/go/src/runtime/signal_unix.go:742 +0x2f6 fp=0xc000d32218 sp=0xc000d321c8 pc=0x12db456
github.com/pingcap/tidb/parser.yyParse({0x5f04cf8, 0xc00536a5e7}, 0xc00536a59f)
    /go/tidb/parser/parser.go:11083 +0x389 fp=0xc000d36d30 sp=0xc000d32218 pc=0x23af429
github.com/pingcap/tidb/parser.(*Parser).ParseSQL(0xc00536a59f, {0xc00572ced0, 0x4ea8c5b}, {0x0, 0x0, 0x273bafa})
    /go/tidb/parser/yy_parser.go:153 +0x216 fp=0xc000d36e00 sp=0xc000d36d30 pc=0x24828d6
github.com/pingcap/tidb/session.(*session).ParseSQL(0xc003a4ca00, {0x5ef8e80, 0xc000142008}, {0xc00572ced0, 0x25}, {0x0, 0x0, 0x0})
    /go/tidb/session/session.go:1374 +0x509 fp=0xc000d37070 sp=0xc000d36e00 pc=0x451e769
github.com/pingcap/tidb/session.(*session).ParseWithParams(0xc003a4ca00, {0x5ef8e80, 0xc000142008}, {0x4efb521, 0x20}, {0xc005ae6160, 0x1, 0x1})
    /go/tidb/session/session.go:1576 +0x1a9 fp=0xc000d37348 sp=0xc000d37070 pc=0x45218e9
github.com/pingcap/tidb/session.(*session).ExecuteInternal(0xc003a4ca00, {0x5ef8e80, 0xc000142008}, {0x4efb521, 0x20}, {0xc005ae6160, 0x1, 0x1})
    /go/tidb/session/session.go:1480 +0x485 fp=0xc000d37528 sp=0xc000d37348 pc=0x4520145
github.com/pingcap/tidb/session.mustExecute({0x5fa5b60, 0xc003a4ca00}, {0x4efb521, 0x20}, {0xc005ae6160, 0x1, 0x1})
    /go/tidb/session/bootstrap.go:1915 +0xcd fp=0xc000d37618 sp=0xc000d37528 pc=0x4503a0d
github.com/pingcap/tidb/session.doDDLWorks({0x5fa5b60, 0xc003a4ca00})
    /go/tidb/session/bootstrap.go:1757 +0xbe fp=0xc000d37668 sp=0xc000d37618 pc=0x450101e
github.com/pingcap/tidb/session.bootstrap({0x5fa5b60, 0xc003a4ca00})
    /go/tidb/session/bootstrap.go:411 +0x2dd fp=0xc000d37810 sp=0xc000d37668 pc=0x44f2f7d
github.com/pingcap/tidb/session.runInBootstrapSession({0x5f51b30, 0xc0008970c0}, 0x4fadf28)
    /go/tidb/session/session.go:2909 +0x228 fp=0xc000d378f8 sp=0xc000d37810 pc=0x45311a8
github.com/pingcap/tidb/session.BootstrapSession({0x5f51b30, 0xc0008970c0})
    /go/tidb/session/session.go:2751 +0x205 fp=0xc000d37ae0 sp=0xc000d378f8 pc=0x4530265
github.com/pingcap/tidb/testkit.bootstrap({0x5f5ecf0, 0xc0032b69c0}, {0x5f51b30, 0xc0008970c0})
    /go/tidb/testkit/mockstore.go:49 +0x85 fp=0xc000d37b60 sp=0xc000d37ae0 pc=0x47f59e5
github.com/pingcap/tidb/testkit.CreateMockStoreAndDomain({0x5f5ecf0, 0xc0032b69c0}, {0x0, 0x0, 0x0})
    /go/tidb/testkit/mockstore.go:42 +0xc5 fp=0xc000d37bd8 sp=0xc000d37b60 pc=0x47f58e5
github.com/pingcap/tidb/testkit.CreateMockStore(...)
    /go/tidb/testkit/mockstore.go:34
github.com/pingcap/tidb/planner/cascades_test.doTestPushdownDistinct(0x1, {0xc000d37da0, 0x1, 0x6faa7d8}, {0xc004f1c240, 0x7, 0x6683902}, {0xc00604a900, 0x7, 0x9})
    /go/tidb/planner/cascades/integration_test.go:211 +0x7a fp=0xc000d37d08 sp=0xc000d37bd8 pc=0x47fe7ba
github.com/pingcap/tidb/planner/cascades_test.TestPushdownDistinctDisable(0x0)
    /go/tidb/planner/cascades/integration_test.go:203 +0x2de fp=0xc000d37e98 sp=0xc000d37d08 pc=0x47fe6fe
testing.tRunner(0xc0032b69c0, 0x4fade38)
    /usr/local/go/src/testing/testing.go:1259 +0x230 fp=0xc000d37fb0 sp=0xc000d37e98 pc=0x140a3b0
testing.(*T).Run·dwrap·21()
    /usr/local/go/src/testing/testing.go:1306 +0x48 fp=0xc000d37fe0 sp=0xc000d37fb0 pc=0x140b948
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:1581 +0x1 fp=0xc000d37fe8 sp=0xc000d37fe0 pc=0x12f9621
created by testing.(*T).Run
    /usr/local/go/src/testing/testing.go:1306 +0x727
goroutine 1 [chan receive]:
testing.(*T).Run(0xc0009a8340, {0x4ee874f, 0x1b}, 0x4fade38)
    /usr/local/go/src/testing/testing.go:1307 +0x752
testing.runTests.func1(0x0)
    /usr/local/go/src/testing/testing.go:1598 +0x9a
testing.tRunner(0xc0009a8340, 0xc000abfa68)
    /usr/local/go/src/testing/testing.go:1259 +0x230
testing.runTests(0xc0009ae000, {0x78e6f40, 0x28, 0x28}, {0xc, 0x3c, 0x7fd9180})
    /usr/local/go/src/testing/testing.go:1596 +0x7cb
testing.(*M).Run(0xc0009ae000)
    /usr/local/go/src/testing/testing.go:1504 +0x9d2
github.com/pingcap/tidb/planner/cascades.TestMain(0x12c7f65)
    /go/tidb/planner/cascades/main_test.go:43 +0x34c
main.main()
    _testmain.go:125 +0x265
goroutine 3 [select]:
go.opencensus.io/stats/view.(*worker).start(0xc0007dcc80)
    /home/prow/go/pkg/mod/go.opencensus.io@v0.23.0/stats/view/worker.go:276 +0x185
created by go.opencensus.io/stats/view.init.0
    /home/prow/go/pkg/mod/go.opencensus.io@v0.23.0/stats/view/worker.go:34 +0xf9
goroutine 3212 [select]:
github.com/tikv/client-go/v2/internal/locate.(*RegionCache).asyncCheckAndResolveLoop(0xc004754780, 0x0)
    /home/prow/go/pkg/mod/github.com/tikv/client-go/v2@v2.0.0-rc.0.20220210073132-b5eb031edde7/internal/locate/region_cache.go:399 +0x1b6
created by github.com/tikv/client-go/v2/internal/locate.NewRegionCache
    /home/prow/go/pkg/mod/github.com/tikv/client-go/v2@v2.0.0-rc.0.20220210073132-b5eb031edde7/internal/locate/region_cache.go:370 +0x559
goroutine 3259 [select]:
github.com/pingcap/tidb/domain.(*Domain).globalConfigSyncerKeeper(0xc000d1a140)
    /go/tidb/domain/domain.go:539 +0x1b0
created by github.com/pingcap/tidb/domain.(*Domain).Init
    /go/tidb/domain/domain.go:865 +0x151c
goroutine 3256 [select]:
github.com/pingcap/tidb/domain.(*Domain).topNSlowQueryLoop(0xc000d1a140)
    /go/tidb/domain/domain.go:484 +0x35c
created by github.com/pingcap/tidb/domain.(*Domain).Init
    /go/tidb/domain/domain.go:862 +0x139c
goroutine 3260 [select]:
github.com/pingcap/tidb/domain.(*Domain).topologySyncerKeeper(0xc000d1a140)
    /go/tidb/domain/domain.go:562 +0x30f
created by github.com/pingcap/tidb/domain.(*Domain).Init
    /go/tidb/domain/domain.go:868 +0x15bd
goroutine 121 [chan receive]:
go.etcd.io/etcd/pkg/logutil.(*MergeLogger).outputLoop(0xc00000fa40)
    /home/prow/go/pkg/mod/go.etcd.io/etcd@v0.5.0-alpha.5.0.20210512015243-d19fbe541bf9/pkg/logutil/merge_logger.go:173 +0xb0
created by go.etcd.io/etcd/pkg/logutil.NewMergeLogger
    /home/prow/go/pkg/mod/go.etcd.io/etcd@v0.5.0-alpha.5.0.20210512015243-d19fbe541bf9/pkg/logutil/merge_logger.go:91 +0x159
goroutine 3128 [select]:
github.com/pingcap/badger/epoch.(*ResourceManager).collectLoop(0x7f5b81c70008, 0xc0065a87e0)
    /home/prow/go/pkg/mod/github.com/pingcap/badger@v1.5.1-0.20210831093107-2f6cb8008145/epoch/manager.go:101 +0x185
created by github.com/pingcap/badger/epoch.NewResourceManager
    /home/prow/go/pkg/mod/github.com/pingcap/badger@v1.5.1-0.20210831093107-2f6cb8008145/epoch/manager.go:79 +0x199
goroutine 3215 [select]:
github.com/dgraph-io/ristretto.(*defaultPolicy).processItems(0xc00180e750)
    /home/prow/go/pkg/mod/github.com/dgraph-io/ristretto@v0.0.1/policy.go:96 +0x16d
created by github.com/dgraph-io/ristretto.newDefaultPolicy
    /home/prow/go/pkg/mod/github.com/dgraph-io/ristretto@v0.0.1/policy.go:80 +0x2d1
goroutine 3239 [select]:
github.com/pingcap/tidb/store/mockstore/unistore/tikv.(*MVCCStore).runUpdateSafePointLoop(0xc0056b6100)
    /go/tidb/store/mockstore/unistore/tikv/mvcc.go:1639 +0x2e9
created by github.com/pingcap/tidb/store/mockstore/unistore/tikv.NewMVCCStore
    /go/tidb/store/mockstore/unistore/tikv/mvcc.go:85 +0x6f9
goroutine 161 [chan receive]:
go.etcd.io/etcd/pkg/logutil.(*MergeLogger).outputLoop(0xc0000369a8)
    /home/prow/go/pkg/mod/go.etcd.io/etcd@v0.5.0-alpha.5.0.20210512015243-d19fbe541bf9/pkg/logutil/merge_logger.go:173 +0xb0
created by go.etcd.io/etcd/pkg/logutil.NewMergeLogger
    /home/prow/go/pkg/mod/go.etcd.io/etcd@v0.5.0-alpha.5.0.20210512015243-d19fbe541bf9/pkg/logutil/merge_logger.go:91 +0x159
goroutine 164 [chan receive]:
go.etcd.io/etcd/pkg/logutil.(*MergeLogger).outputLoop(0xc000036ae0)
    /home/prow/go/pkg/mod/go.etcd.io/etcd@v0.5.0-alpha.5.0.20210512015243-d19fbe541bf9/pkg/logutil/merge_logger.go:173 +0xb0
created by go.etcd.io/etcd/pkg/logutil.NewMergeLogger
    /home/prow/go/pkg/mod/go.etcd.io/etcd@v0.5.0-alpha.5.0.20210512015243-d19fbe541bf9/pkg/logutil/merge_logger.go:91 +0x159
goroutine 3213 [select]:
github.com/tikv/client-go/v2/tikv.(*KVStore).runSafePointChecker(0xc00468db80)
    /home/prow/go/pkg/mod/github.com/tikv/client-go/v2@v2.0.0-rc.0.20220210073132-b5eb031edde7/tikv/kv.go:234 +0x1b4
created by github.com/tikv/client-go/v2/tikv.NewKVStore
    /home/prow/go/pkg/mod/github.com/tikv/client-go/v2@v2.0.0-rc.0.20220210073132-b5eb031edde7/tikv/kv.go:189 +0x685
goroutine 3255 [select]:
github.com/pingcap/tidb/ddl.(*ddl).PollTiFlashRoutine(0xc004754a80)
    /go/tidb/ddl/ddl_tiflash_api.go:417 +0x229
github.com/pingcap/tidb/util.(*WaitGroupWrapper).Run.func1()
    /go/tidb/util/wait_group_wrapper.go:33 +0x7f
created by github.com/pingcap/tidb/util.(*WaitGroupWrapper).Run
    /go/tidb/util/wait_group_wrapper.go:31 +0xdf
goroutine 3196 [select]:
github.com/pingcap/badger.(*blobGCHandler).run(0xc00005cac0, 0xc0019d6630)
    /home/prow/go/pkg/mod/github.com/pingcap/badger@v1.5.1-0.20210831093107-2f6cb8008145/blob.go:468 +0x189
created by github.com/pingcap/badger.(*blobManager).Open
    /home/prow/go/pkg/mod/github.com/pingcap/badger@v1.5.1-0.20210831093107-2f6cb8008145/blob.go:292 +0xaa8
goroutine 3240 [select]:
github.com/pingcap/tidb/store/mockstore/unistore/tikv.(*MVCCStore).StartDeadlockDetection.func1()
    /go/tidb/store/mockstore/unistore/tikv/mvcc.go:1344 +0x117
created by github.com/pingcap/tidb/store/mockstore/unistore/tikv.(*MVCCStore).StartDeadlockDetection
    /go/tidb/store/mockstore/unistore/tikv/mvcc.go:1342 +0x145
goroutine 3238 [select]:
github.com/pingcap/tidb/store/mockstore/unistore/tikv.writeLockWorker.run({0xc00658dda0, 0xc00005d7c0})
    /go/tidb/store/mockstore/unistore/tikv/write.go:148 +0x1ef
created by github.com/pingcap/tidb/store/mockstore/unistore/tikv.(*dbWriter).Open
    /go/tidb/store/mockstore/unistore/tikv/write.go:206 +0x1ef
goroutine 3127 [select]:
github.com/pingcap/badger.(*DB).updateSize(0x7f5b90a70008, 0xc0065a87b0)
    /home/prow/go/pkg/mod/github.com/pingcap/badger@v1.5.1-0.20210831093107-2f6cb8008145/db.go:1039 +0x1f9
created by github.com/pingcap/badger.Open
    /home/prow/go/pkg/mod/github.com/pingcap/badger@v1.5.1-0.20210831093107-2f6cb8008145/db.go:328 +0x1778
goroutine 3237 [select]:
github.com/pingcap/tidb/store/mockstore/unistore/tikv.writeDBWorker.run({0xc00658dd40, 0xc00005d7c0})
    /go/tidb/store/mockstore/unistore/tikv/write.go:96 +0x18d
created by github.com/pingcap/tidb/store/mockstore/unistore/tikv.(*dbWriter).Open
    /go/tidb/store/mockstore/unistore/tikv/write.go:199 +0x10f
goroutine 3234 [select]:
github.com/pingcap/badger.(*writeWorker).runWriteVLog(0xc000bc8120, 0xc0019d6738)
    /home/prow/go/pkg/mod/github.com/pingcap/badger@v1.5.1-0.20210831093107-2f6cb8008145/writer.go:94 +0x232
created by github.com/pingcap/badger.startWriteWorker
    /home/prow/go/pkg/mod/github.com/pingcap/badger@v1.5.1-0.20210831093107-2f6cb8008145/writer.go:64 +0x411
goroutine 3235 [chan receive, locked to thread]:
github.com/pingcap/badger.(*writeWorker).runWriteLSM(0xc000bc8120, 0xc0019d6738)
    /home/prow/go/pkg/mod/github.com/pingcap/badger@v1.5.1-0.20210831093107-2f6cb8008145/writer.go:141 +0x227
created by github.com/pingcap/badger.startWriteWorker
    /home/prow/go/pkg/mod/github.com/pingcap/badger@v1.5.1-0.20210831093107-2f6cb8008145/writer.go:65 +0x4b9
goroutine 3252 [select]:
github.com/pingcap/tidb/ddl.(*worker).start(0xc0018e2000, 0xc001857ec0)
    /go/tidb/ddl/ddl_worker.go:179 +0x565
created by github.com/pingcap/tidb/ddl.(*ddl).Start
    /go/tidb/ddl/ddl.go:387 +0x994
goroutine 3251 [select]:
github.com/pingcap/tidb/ddl.(*delRange).startEmulator(0xc000128190)
    /go/tidb/ddl/delete_range.go:144 +0x194
created by github.com/pingcap/tidb/ddl.(*delRange).start
    /go/tidb/ddl/delete_range.go:126 +0xb9
goroutine 3258 [select]:
github.com/pingcap/tidb/domain.(*Domain).renewLease(0xc000d1a140)
    /go/tidb/domain/domain.go:1791 +0x193
created by github.com/pingcap/tidb/domain.(*Domain).Init
    /go/tidb/domain/domain.go:864 +0x149c
goroutine 3211 [select]:
github.com/tikv/client-go/v2/oracle/oracles.(*pdOracle).updateTS(0xc004698700, {0x5ef8e80, 0xc000142018}, 0x481a500)
    /home/prow/go/pkg/mod/github.com/tikv/client-go/v2@v2.0.0-rc.0.20220210073132-b5eb031edde7/oracle/oracles/pd.go:229 +0x1e5
created by github.com/tikv/client-go/v2/oracle/oracles.NewPdOracle
    /home/prow/go/pkg/mod/github.com/tikv/client-go/v2@v2.0.0-rc.0.20220210073132-b5eb031edde7/oracle/oracles/pd.go:77 +0x219
goroutine 3236 [chan receive]:
github.com/pingcap/badger.(*writeWorker).runMergeLSM(0xc000bc8120, 0xc0019d6738)
    /home/prow/go/pkg/mod/github.com/pingcap/badger@v1.5.1-0.20210831093107-2f6cb8008145/writer.go:154 +0x10d
created by github.com/pingcap/badger.startWriteWorker
    /home/prow/go/pkg/mod/github.com/pingcap/badger@v1.5.1-0.20210831093107-2f6cb8008145/writer.go:66 +0x55d
goroutine 3129 [select]:
github.com/pingcap/badger.Open.func4()
    /home/prow/go/pkg/mod/github.com/pingcap/badger@v1.5.1-0.20210831093107-2f6cb8008145/db.go:342 +0x305
created by github.com/pingcap/badger.Open
    /home/prow/go/pkg/mod/github.com/pingcap/badger@v1.5.1-0.20210831093107-2f6cb8008145/db.go:339 +0x1d0c
goroutine 3250 [select]:
github.com/pingcap/tidb/ddl.(*ddl).limitDDLJobs(0xc004754a80)
    /go/tidb/ddl/ddl_worker.go:264 +0x2b6
created by github.com/pingcap/tidb/ddl.(*ddl).Start
    /go/tidb/ddl/ddl.go:369 +0x34b
goroutine 3214 [select]:
github.com/tikv/client-go/v2/tikv.(*KVStore).safeTSUpdater(0xc00468db80)
    /home/prow/go/pkg/mod/github.com/tikv/client-go/v2@v2.0.0-rc.0.20220210073132-b5eb031edde7/tikv/kv.go:521 +0x2ab
created by github.com/tikv/client-go/v2/tikv.NewKVStore
    /home/prow/go/pkg/mod/github.com/tikv/client-go/v2@v2.0.0-rc.0.20220210073132-b5eb031edde7/tikv/kv.go:190 +0x6f8
goroutine 3253 [select]:
github.com/pingcap/tidb/ddl.(*worker).start(0xc0018e20b0, 0xc001857ec0)
    /go/tidb/ddl/ddl_worker.go:179 +0x565
created by github.com/pingcap/tidb/ddl.(*ddl).Start
    /go/tidb/ddl/ddl.go:387 +0x994
goroutine 3198 [chan receive]:
github.com/pingcap/badger.(*DB).runFlushMemTable(0xc000c34d80, 0xc0065a8e58)
    /home/prow/go/pkg/mod/github.com/pingcap/badger@v1.5.1-0.20210831093107-2f6cb8008145/db.go:920 +0x154
created by github.com/pingcap/badger.Open
    /home/prow/go/pkg/mod/github.com/pingcap/badger@v1.5.1-0.20210831093107-2f6cb8008145/db.go:361 +0x21bc
goroutine 3197 [select]:
github.com/pingcap/badger.(*levelsController).runWorker(0xc000e95420, 0xc0019d6660, 0x0)
    /home/prow/go/pkg/mod/github.com/pingcap/badger@v1.5.1-0.20210831093107-2f6cb8008145/levels.go:212 +0x2fc
created by github.com/pingcap/badger.(*levelsController).startCompact
    /home/prow/go/pkg/mod/github.com/pingcap/badger@v1.5.1-0.20210831093107-2f6cb8008145/levels.go:180 +0x89
goroutine 3216 [select]:
github.com/dgraph-io/ristretto.(*Cache).processItems(0xc005c58900)
    /home/prow/go/pkg/mod/github.com/dgraph-io/ristretto@v0.0.1/cache.go:257 +0x10e
created by github.com/dgraph-io/ristretto.NewCache
    /home/prow/go/pkg/mod/github.com/dgraph-io/ristretto@v0.0.1/cache.go:155 +0x7d9
goroutine 3257 [select]:
github.com/pingcap/tidb/domain.(*Domain).infoSyncerKeeper(0xc000d1a140)
    /go/tidb/domain/domain.go:516 +0x2af
created by github.com/pingcap/tidb/domain.(*Domain).Init
    /go/tidb/domain/domain.go:863 +0x141c 

2. What did you expect to see? (Required)

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

master eabd78cae

hawkingrei commented 2 years ago

https://prow.hawkingrei.com/view/gs/prowpingcap/logs/tidb_race/1493759676985118720