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

[Bug]: [date 2.4]tke regression: create and drop table concurrent test reported panic error invalid memory address or nil pointer dereference #21352

Open
1 task done
heni02 opened this issue Feb 5, 2025 · 2 comments
Assignees
Labels
kind/bug Something isn't working phase/testing severity/s0 Extreme impact: Cause the application to break down and seriously affect the use
Milestone

Comments

@heni02
Copy link
Contributor

heni02 commented Feb 5, 2025

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

2.0-dev

Commit ID

690ae94

Other Environment Information

- Hardware parameters:
- OS type:
- Others:

Actual Behavior

job:https://github.com/matrixorigin/mo-nightly-regression/actions/runs/13132842096/job/36690230727
Image
测试场景:create if not exists table和drop if exists table各并发10同时下发执行测试
测试sql:({index}值为1-10的随机值)
"create table if not exists test_{index}(a int, b varchar, c datetime);"
"drop table if exists test_{index};"

Statement : drop table if exists test_2;
ErrorCode : 1105
ErrorMessage : internal error: panic runtime error: invalid memory address or nil pointer dereference:
runtime.panicmem
/usr/local/go/src/runtime/panic.go:262
runtime.sigpanic
/usr/local/go/src/runtime/signal_unix.go:900
github.com/matrixorigin/matrixone/pkg/sql/compile.(*Scope).DropTable
/go/src/github.com/matrixorigin/matrixone/pkg/sql/compile/ddl.go:2625
github.com/matrixorigin/matrixone/pkg/sql/compile.(*Compile).run
/go/src/github.com/matrixorigin/matrixone/pkg/sql/compile/compile.go:402
github.com/matrixorigin/matrixone/pkg/sql/compile.(*Compile).runOnce
/go/src/github.com/matrixorigin/matrixone/pkg/sql/compile/compile.go:492
github.com/matrixorigin/matrixone/pkg/sql/compile.(*Compile).Run
/go/src/github.com/matrixorigin/matrixone/pkg/sql/compile/compile2.go:245
github.com/matrixorigin/matrixone/pkg/frontend.executeStatusStmt
/go/src/github.com/matrixorigin/matrixone/pkg/frontend/status_stmt.go:141
github.com/matrixorigin/matrixone/pkg/frontend.executeStmt
/go/src/github.com/matrixorigin/matrixone/pkg/frontend/mysql_cmd_executor.go:2883
github.com/matrixorigin/matrixone/pkg/frontend.dispatchStmt
/go/src/github.com/matrixorigin/matrixone/pkg/frontend/mysql_cmd_executor.go:2731
github.com/matrixorigin/matrixone/pkg/frontend.executeStmtWithIncrStmt
/go/src/github.com/matrixorigin/matrixone/pkg/frontend/mysql_cmd_executor.go:2700
github.com/matrixorigin/matrixone/pkg/frontend.executeStmtWithWorkspace
/go/src/github.com/matrixorigin/matrixone/pkg/frontend/mysql_cmd_executor.go:2644
github.com/matrixorigin/matrixone/pkg/frontend.executeStmtWithTxn
/go/src/github.com/matrixorigin/matrixone/pkg/frontend/mysql_cmd_executor.go:2519
github.com/matrixorigin/matrixone/pkg/frontend.executeStmtWithResponse
/go/src/github.com/matrixorigin/matrixone/pkg/frontend/mysql_cmd_executor.go:2482
github.com/matrixorigin/matrixone/pkg/frontend.doComQuery
/go/src/github.com/matrixorigin/matrixone/pkg/frontend/mysql_cmd_executor.go:3132
github.com/matrixorigin/matrixone/pkg/frontend.ExecRequest
/go/src/github.com/matrixorigin/matrixone/pkg/frontend/mysql_cmd_executor.go:3212
github.com/matrixorigin/matrixone/pkg/frontend.(*Routine).handleRequest
/go/src/github.com/matrixorigin/matrixone/pkg/frontend/routine.go:298
github.com/matrixorigin/matrixone/pkg/frontend.(*RoutineManager).Handler
/go/src/github.com/matrixorigin/matrixone/pkg/frontend/routine_manager.go:385
github.com/matrixorigin/matrixone/pkg/frontend.(*MOServer).handleRequest
/go/src/github.com/matrixorigin/matrixone/pkg/frontend/server.go:527
github.com/matrixorigin/matrixone/pkg/frontend.(*MOServer).handleMessage
/go/src/github.com/matrixorigin/matrixone/pkg/frontend/server.go:495
github.com/matrixorigin/matrixone/pkg/frontend.(*MOServer).handleLoop
/go/src/github.com/matrixorigin/matrixone/pkg/frontend/server.go:212
github.com/matrixorigin/matrixone/pkg/frontend.(*MOServer).handleConn
/go/src/github.com/matrixorigin/matrixone/pkg/frontend/server.go:208
runtime.goexit
/usr/local/go/src/runtime/asm_amd64.s:1700

mo log:
https://grafana.ci.matrixorigin.cn/explore?panes=%7B%22oUt%22:%7B%22datasource%22:%22loki%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%7Bnamespace%3D%5C%22mo-branch-nightly-690ae9413-20250204%5C%22%7D%20%7C%3D%20%60panic%60%22,%22queryType%22:%22range%22,%22datasource%22:%7B%22type%22:%22loki%22,%22uid%22:%22loki%22%7D,%22editorMode%22:%22builder%22%7D%5D,%22range%22:%7B%22from%22:%221738674959385%22,%22to%22:%221738761359385%22%7D%7D%7D&schemaVersion=1&orgId=1

Expected Behavior

No response

Steps to Reproduce

1.git clone -b 1.0 https://github.com/matrixorigin/mo-load.git
2.mo创建db:create database concurrent_test;
3.cd mo-load && ./start.sh -h 172.16.112.246  -b concurrent_test -c cases/ddl/create_drop_table/ -g

Additional information

No response

@heni02 heni02 added kind/bug Something isn't working needs-triage severity/s0 Extreme impact: Cause the application to break down and seriously affect the use labels Feb 5, 2025
@YANGGMM
Copy link
Contributor

YANGGMM commented Feb 5, 2025

@ouyuanning 麻烦看一下

@ouyuanning
Copy link
Contributor

本地跑了3遍没有复现。
看代码判断是因为 build plan 期间该表不存在,于是plan中的TableDef为nil。
而执行之前,这个表被其他线程又创建了。于是逻辑正常往下走,直到取TableDef做一些操作的时候,拿到了nil于是报错。

经讨论,当发生这种情况时。
如果有if exists直接返回,否则报错

@heni02 heni02 added this to the 2.0.2 milestone Feb 8, 2025
@ouyuanning ouyuanning assigned heni02 and unassigned ouyuanning Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working phase/testing severity/s0 Extreme impact: Cause the application to break down and seriously affect the use
Projects
None yet
Development

No branches or pull requests

4 participants