Closed sukki37 closed 2 years ago
Additional Information, running bvt in our hosted server, and the memory usage of mo-server is recorded(while true; do ps -e -o 'pid,comm,args,pcpu,rsz,vsz,stime,user,uid' | grep 740300 | grep -v 'grep' | sort -nrk5; sleep 1; done
). we can find that the maximum memory usage during bvt test is up to 22G which is somehow unreasonable.
740300 mo-server ./mo-server system_vars_con 5.4 65572 2242216 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 5.4 65572 2242216 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 5.6 251192 2660544 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 6.0 274012 2660800 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 6.3 554732 3269668 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 6.6 462244 3269668 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 7.0 396000 3269668 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 7.4 691064 3269668 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 7.7 489880 3269924 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 8.0 546816 3270180 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 8.4 656612 3270180 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 8.7 654332 3270180 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 9.0 737572 3270180 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 9.3 759428 3405740 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 9.6 968140 3406060 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 9.9 951752 3406060 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 10.2 995488 3406060 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 10.6 1150892 3541364 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 10.8 1115632 3541364 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 11.0 1436228 3811972 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 11.1 1436484 3811972 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 11.2 1581544 4082964 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 11.5 1800360 4082964 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 11.8 1861472 4285920 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 12.1 1893928 4285920 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 12.3 1899880 4285920 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 12.5 1974584 4285920 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 12.7 2370228 8683300 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 12.9 5723192 8683300 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 13.2 6348292 8683300 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 13.4 6348292 8683300 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 13.8 7632324 13013028 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 14.3 9602500 13013028 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 14.7 11566756 17342756 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 14.9 13547172 17342756 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 15.1 15007712 17342756 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 15.1 15007712 17342756 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 15.3 15646784 21672484 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 15.6 16281668 21672484 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 15.8 16760828 21672484 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 16.0 17291220 21672484 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 16.2 17653616 21672484 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 16.4 18106240 21672484 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 16.6 18515304 21672484 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 16.9 18948000 21672484 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 17.1 19512712 26069864 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 17.3 20072856 26069864 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 17.5 20655956 26069864 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 17.7 21251456 26069864 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 17.9 21845484 26069864 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 18.1 22440804 26069864 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 18.3 23005500 26069864 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 18.5 23665100 26069864 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 18.8 21593552 27152296 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 19.0 18884048 27152296 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 19.3 4774012 27152296 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 19.6 5105220 27152296 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 19.7 5577816 27152296 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 19.9 2817880 27152328 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 20.2 2849000 27152328 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 20.5 3035292 27152328 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 20.7 3071540 27152328 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 20.9 3228800 27152328 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 21.2 3330176 27152328 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 21.2 3330176 27152328 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 21.1 3330176 27152328 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 21.1 3330176 27152328 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 21.1 3330176 27152328 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 21.0 3330176 27152328 00:34 ubuntu 1000
740300 mo-server ./mo-server system_vars_con 21.0 3330176 27152328 00:34 ubuntu 1000
aoe pprof result:
(pprof) top
Showing nodes accounting for 98512.61MB, 97.47% of 101065.36MB total
Dropped 1238 nodes (cum <= 505.33MB)
Showing top 10 nodes out of 49
flat flat% sum% cum cum%
95659.92MB 94.65% 94.65% 95662.42MB 94.65% github.com/matrixorigin/matrixone/pkg/vm/engine/aoe/engine.(*worker).alloc
1512.68MB 1.50% 96.15% 2003.56MB 1.98% github.com/matrixorigin/matrixone/pkg/vm/engine/aoe/storage/common.(*Mempool).Alloc
807.85MB 0.8% 96.95% 807.85MB 0.8% github.com/matrixorigin/matrixone/pkg/vm/engine/aoe/storage/container/vector.NewStrVector (inline)
528.66MB 0.52% 97.47% 983.54MB 0.97% reflect.Select
1MB 0.00099% 97.47% 1217.25MB 1.20% github.com/matrixorigin/matrixcube/raftstore.(*stateMachine).execWriteRequest
0.50MB 0.00049% 97.47% 1715.27MB 1.70% github.com/matrixorigin/matrixcube/raftstore.(*replicaCreator).maybeInitReplica.func1
0.50MB 0.00049% 97.47% 784.52MB 0.78% github.com/matrixorigin/matrixone/pkg/frontend.(*MysqlCmdExecutor).ExecRequest
0.50MB 0.00049% 97.47% 1291.33MB 1.28% github.com/matrixorigin/matrixcube/raftstore.(*stateMachine).applyCommittedEntries
0.50MB 0.00049% 97.47% 785.52MB 0.78% github.com/matrixorigin/matrixone/pkg/frontend.(*MysqlCmdExecutor).doComQuery
0.50MB 0.00049% 97.47% 780.30MB 0.77% github.com/matrixorigin/matrixone/pkg/frontend.(*Routine).Loop
tae pprof result:
(pprof) top
Showing nodes accounting for 59378.87MB, 99.24% of 59834.97MB total
Dropped 419 nodes (cum <= 299.17MB)
Showing top 10 nodes out of 39
flat flat% sum% cum cum%
54828.03MB 91.63% 91.63% 54832.03MB 91.64% github.com/matrixorigin/matrixone/pkg/vm/engine/tae/moengine.newReader
4096MB 6.85% 98.48% 4096MB 6.85% github.com/matrixorigin/matrixone/pkg/sql/plan2/function/builtin/unary.SpaceInt64
448.34MB 0.75% 99.23% 448.34MB 0.75% github.com/matrixorigin/matrixone/pkg/vm/engine/tae/common.init.0.func2
5.50MB 0.0092% 99.24% 54776.65MB 91.55% github.com/matrixorigin/matrixone/pkg/sql/compile2.(*Scope).ParallelRun
0.50MB 0.00084% 99.24% 305.22MB 0.51% github.com/matrixorigin/matrixone/pkg/frontend.(*MysqlCmdExecutor).ExecRequest
0.50MB 0.00084% 99.24% 446.89MB 0.75% github.com/matrixorigin/matrixone/pkg/vm/engine/tae/container/vector.NewStdVector
0 0% 99.24% 304.22MB 0.51% github.com/matrixorigin/matrixone/pkg/frontend.(*MysqlCmdExecutor).doComQuery
0 0% 99.24% 309.57MB 0.52% github.com/matrixorigin/matrixone/pkg/frontend.(*Routine).Loop
0 0% 99.24% 4096.50MB 6.85% github.com/matrixorigin/matrixone/pkg/sql/colexec2.EvalExpr
0 0% 99.24% 4096.50MB 6.85% github.com/matrixorigin/matrixone/pkg/sql/colexec2/projection.Call
aoe pprof result:
(pprof) top Showing nodes accounting for 98512.61MB, 97.47% of 101065.36MB total Dropped 1238 nodes (cum <= 505.33MB) Showing top 10 nodes out of 49 flat flat% sum% cum cum% 95659.92MB 94.65% 94.65% 95662.42MB 94.65% github.com/matrixorigin/matrixone/pkg/vm/engine/aoe/engine.(*worker).alloc 1512.68MB 1.50% 96.15% 2003.56MB 1.98% github.com/matrixorigin/matrixone/pkg/vm/engine/aoe/storage/common.(*Mempool).Alloc 807.85MB 0.8% 96.95% 807.85MB 0.8% github.com/matrixorigin/matrixone/pkg/vm/engine/aoe/storage/container/vector.NewStrVector (inline) 528.66MB 0.52% 97.47% 983.54MB 0.97% reflect.Select 1MB 0.00099% 97.47% 1217.25MB 1.20% github.com/matrixorigin/matrixcube/raftstore.(*stateMachine).execWriteRequest 0.50MB 0.00049% 97.47% 1715.27MB 1.70% github.com/matrixorigin/matrixcube/raftstore.(*replicaCreator).maybeInitReplica.func1 0.50MB 0.00049% 97.47% 784.52MB 0.78% github.com/matrixorigin/matrixone/pkg/frontend.(*MysqlCmdExecutor).ExecRequest 0.50MB 0.00049% 97.47% 1291.33MB 1.28% github.com/matrixorigin/matrixcube/raftstore.(*stateMachine).applyCommittedEntries 0.50MB 0.00049% 97.47% 785.52MB 0.78% github.com/matrixorigin/matrixone/pkg/frontend.(*MysqlCmdExecutor).doComQuery 0.50MB 0.00049% 97.47% 780.30MB 0.77% github.com/matrixorigin/matrixone/pkg/frontend.(*Routine).Loop
https://github.com/matrixorigin/matrixone/blob/main/cmd/db-server/debug.go#L50 allocs : samples of all memory allocations during program execution. Not a sampling of memory allocations for the currently active object.Reader has no memory leaks. The root cause of this problem is the "space" function.
fixed
Is there an existing issue for the same bug?
Environment
Actual Behavior
during bvt, mo-server will be killed by the os because of OOM and the last SQL is
select space(4294967295);
Expected Behavior
No response
Steps to Reproduce
No response
Additional information
No response