Skip to content

Instance crashed when no matched value in WHERE clause with ORDER BY or GROUP BY clause #345

Closed

Description

@MOOS2021

Can be reproduced ?

Yes

Steps:

Result is normal when matched values when ORDER BY and GROUP BY
mysql> SELECT sum(LO_REVENUE), LO_ORDERDATE, P_BRAND FROM lineorder_flat WHERE P_BRAND = 'MFGR#2239' AND S_REGION = 'EUROPE' GROUP BY LO_ORDERDATE, P_BRAND;
+-----------------+--------------+-----------+
| sum(LO_REVENUE) | LO_ORDERDATE | P_BRAND |
+-----------------+--------------+-----------+
| 2694816 | 19920110 | MFGR#2239 |
| 4878239 | 19920101 | MFGR#2239 |
| 994264 | 19920102 | MFGR#2239 |
| 4816459 | 19920103 | MFGR#2239 |
+-----------------+--------------+-----------+
4 rows in set (0.07 sec)

Result is normal when no matched values without ORDER BY or GROUP BY
mysql> SELECT LO_REVENUE, LO_ORDERDATE, P_BRAND FROM lineorder_flat WHERE P_BRAND = 'MFGR#123123123' AND S_REGION = 'EUROPE';
Empty set (0.06 sec)

Instance Crashed when no matched value with GROUP BY clause
mysql> SELECT sum(LO_REVENUE), LO_ORDERDATE, P_BRAND FROM lineorder_flat WHERE P_BRAND = 'MFGR#123123' AND S_REGION = 'EUROPE' GROUP BY LO_ORDERDATE, P_BRAND;
ERROR 2013 (HY000): Lost connection to MySQL server during query

Instance Crashed when no matched value with ORDER BY clause
mysql> SELECT LO_REVENUE, LO_ORDERDATE, P_BRAND FROM lineorder_flat WHERE P_BRAND = 'MFGR#123123123' AND S_REGION = 'EUROPE' ORDER BY LO_ORDERDATE, P_BRAND;
ERROR 2013 (HY000): Lost connection to MySQL server during query

Expected behavior:

No value in query

Actual behavior:

Instance crashed

Environment:

  • Version or commit-id (e.g. v0.1.0 or 8b23a93): v0.1.0
  • Hardware parameters:
  • OS type: CentOS 7
  • Others:

Configuration file:

Additional context:

  • Error message from client:
  • Server log:
    query:SELECT LO_REVENUE, LO_ORDERDATE, P_BRAND FROM lineorder_flat WHERE P_BRAND = 'MFGR#123123123' AND S_REGION = 'EUROPE' ORDER BY LO_ORDERDATE, P_BRAND
    panic: runtime error: invalid memory address or nil pointer dereference
    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x70 pc=0x1afe4de]

goroutine 15927 [running]:
matrixone/pkg/sql/colexec/mergeorder.(*Container).eval(0xc001d2bd60, 0xc00929a090, 0xbf3113, 0x21e82e0)
/root/matrixone-main/pkg/sql/colexec/mergeorder/order.go:172 +0x3e
matrixone/pkg/sql/colexec/mergeorder.Call(0xc00929a090, 0x2133600, 0xc001d2bd40, 0x39821e0, 0xbfe2b3, 0x2352e20)
/root/matrixone-main/pkg/sql/colexec/mergeorder/order.go:53 +0xb5
matrixone/pkg/vm.Run(0xc001d2be00, 0x3, 0x4, 0xc00929a090, 0xc0023eaaa0, 0xc2954c, 0x2352e20)
/root/matrixone-main/pkg/vm/vm.go:35 +0x9b
matrixone/pkg/vm/pipeline.(*Pipeline).RunMerge.func1(0xc00929a090, 0xc0023eaf38)
/root/matrixone-main/pkg/vm/pipeline/pipeline.go:76 +0x65
panic(0x21fcda0, 0x33aaa20)
/usr/lib/golang/src/runtime/panic.go:965 +0x1b9
matrixone/pkg/sql/colexec/mergeorder.(*Container).eval(0xc001d2bd60, 0xc00929a090, 0xc00929a090, 0x0)
/root/matrixone-main/pkg/sql/colexec/mergeorder/order.go:172 +0x3e
matrixone/pkg/sql/colexec/mergeorder.Call(0xc00929a090, 0x2133600, 0xc001d2bd40, 0x2133740, 0xc00c0aef90, 0x0)
/root/matrixone-main/pkg/sql/colexec/mergeorder/order.go:53 +0xb5
matrixone/pkg/vm.Run(0xc001d2be00, 0x3, 0x4, 0xc00929a090, 0x0, 0x0, 0xc001ac76d8)
/root/matrixone-main/pkg/vm/vm.go:35 +0x9b
matrixone/pkg/vm/pipeline.(*Pipeline).RunMerge(0xc0023eaf38, 0xc00929a090, 0x2728700, 0x0, 0x0)
/root/matrixone-main/pkg/vm/pipeline/pipeline.go:85 +0xf7
matrixone/pkg/sql/compile.(*Scope).MergeRun(0xc002632480, 0x27287f8, 0xc00488e0e8, 0x0, 0x0)
/root/matrixone-main/pkg/sql/compile/scope.go:101 +0x2f8
matrixone/pkg/sql/compile.(*Exec).Run.func2(0xc0027bae80, 0xc00c35f690, 0xc002632480)
/root/matrixone-main/pkg/sql/compile/compile.go:141 +0x46
created by matrixone/pkg/sql/compile.(*Exec).Run
/root/matrixone-main/pkg/sql/compile/compile.go:140 +0xfc

  • Other information:

Activity

  1. added
    kind/bug
    on Aug 11, 2021
  2. changed the title [-]Instance crashed when there is no matched value in WHERE clause with ORDER BY or GROUP BY clause[/-] [+]Instance crashed when no matched value in WHERE clause with ORDER BY or GROUP BY clause[/+] on Aug 11, 2021
  3. MOOS2021 commented on Aug 19, 2021

    @MOOS2021
    ContributorAuthor

    This reproduced in 3fea8f5.

    mysql> SELECT C_CITY, S_CITY, LO_ORDERDATE, sum(LO_REVENUE) AS revenue FROM lineorder_flat WHERE (C_CITY = 'UNITED KI0' OR C_CITY = 'UNITED KI7') AND (S_CITY = 'UNITED KI0' OR S_CITY = 'UNITED KI7') AND LO_ORDERDATE >= 19920101 AND LO_ORDERDATE <= 19971231 GROUP BY C_CITY, S_CITY, LO_ORDERDATE;
    Empty set (4.67 sec)

    mysql> SELECT C_CITY, S_CITY, LO_ORDERDATE, sum(LO_REVENUE) AS revenue FROM lineorder_flat WHERE (C_CITY = 'UNITED KI0' OR C_CITY = 'UNITED KI7') AND (S_CITY = 'UNITED KI0' OR S_CITY = 'UNITED KI7') AND LO_ORDERDATE >= 19920101 AND LO_ORDERDATE <= 19971231 GROUP BY C_CITY, S_CITY, LO_ORDERDATE ORDER BY LO_ORDERDATE asc, revenue desc;
    ERROR 2013 (HY000): Lost connection to MySQL server during query

  4. nnsgmsone commented on Aug 20, 2021

    @nnsgmsone
    Contributor
    matrixone/pkg/vm/engine/aoe/storage/layout/table/v2.(*Block).Size(0xc001f17800, 0xc002334fd0, 0x7, 0xc001f17800)
    	/root/github/dist/matrixone/pkg/vm/engine/aoe/storage/layout/table/v2/blk.go:113 +0xf1
    matrixone/pkg/vm/engine/aoe/storage/db.(*Block).Size(0xc0025a2c80, 0xc002334fd0, 0x7, 0x0)
    	/root/github/dist/matrixone/pkg/vm/engine/aoe/storage/db/blk.go:26 +0x9f
    matrixone/pkg/vm/pipeline.(*Pipeline).prefetch(0xc001793e60, 0xc002786a60, 0x2, 0x2, 0xc0006486c0, 0x0, 0xc001793d10, 0x1ed0065)
    	/root/github/dist/matrixone/pkg/vm/pipeline/pipeline.go:103 +0x403
    matrixone/pkg/vm/pipeline.(*Pipeline).Run(0xc001793e60, 0xc002786a60, 0x2, 0x2, 0xc0006486c0, 0x0, 0x0, 0x0)
    	/root/github/dist/matrixone/pkg/vm/pipeline/pipeline.go:45 +0x10d
    matrixone/pkg/sql/compile.(*Scope).Run(0xc00475fc00, 0x25ffb58, 0xc00078a1c8, 0x0, 0x0)
    	/root/github/dist/matrixone/pkg/sql/compile/scope.go:62 +0x70f
    matrixone/pkg/sql/compile.(*Scope).MergeRun.func1(0x25ffb58, 0xc00078a1c8, 0xc00085a810, 0xc00002ef20, 0xc00475fc00)
    	/root/github/dist/matrixone/pkg/sql/compile/scope.go:77 +0x45
    created by matrixone/pkg/sql/compile.(*Scope).MergeRun
    	/root/github/dist/matrixone/pkg/sql/compile/scope.go:76 +0x278
    

    @XuPeng-SH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

kind/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions