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

[aggregate.go:393]["parallel hash aggregation panicked"] [error="runtime error: index out of range [0] with length 0"] #23670

Closed
wjhuang2016 opened this issue Mar 30, 2021 · 8 comments
Assignees
Labels
duplicate Issues or pull requests already exists. sig/execution SIG execution

Comments

@wjhuang2016
Copy link
Member

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

log3.sql.zip
source log3.sql;

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

No panic

3. What did you see instead (Required)

[aggregate.go:393] ["parallel hash aggregation panicked"] [error="runtime error: index out of range [0] with length 0"] [errorVerbose="runtime error: index out of range [0] with length 0
github.com/pingcap/tidb/executor.recoveryHashAgg
	/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/executor/aggregate.go:391
github.com/pingcap/tidb/executor.(*HashAggFinalWorker).run.func1
	/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/executor/aggregate.go:682
runtime.gopanic
	/usr/local/go/src/runtime/panic.go:679
runtime.goPanicIndex
	/usr/local/go/src/runtime/panic.go:75
github.com/pingcap/tidb/util/chunk.(*Column).AppendInt64
	/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/util/chunk/column.go:209
github.com/pingcap/tidb/util/chunk.(*Chunk).AppendInt64
	/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/util/chunk/chunk.go:557
github.com/pingcap/tidb/executor/aggfuncs.(*percentileOriginal4Int).AppendFinalResult2Chunk
	/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/executor/aggfuncs/func_percentile.go:175
github.com/pingcap/tidb/executor.(*HashAggFinalWorker).getFinalResult
	/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/executor/aggregate.go:648
github.com/pingcap/tidb/executor.(*HashAggFinalWorker).run
	/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/executor/aggregate.go:692
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1357"] [stack="github.com/pingcap/tidb/executor.recoveryHashAgg
	/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/executor/aggregate.go:393
github.com/pingcap/tidb/executor.(*HashAggFinalWorker).run.func1
	/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/executor/aggregate.go:682
runtime.gopanic
	/usr/local/go/src/runtime/panic.go:679
runtime.goPanicIndex
	/usr/local/go/src/runtime/panic.go:75
github.com/pingcap/tidb/util/chunk.(*Column).AppendInt64
	/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/util/chunk/column.go:209
github.com/pingcap/tidb/util/chunk.(*Chunk).AppendInt64
	/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/util/chunk/chunk.go:557
github.com/pingcap/tidb/executor/aggfuncs.(*percentileOriginal4Int).AppendFinalResult2Chunk
	/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/executor/aggfuncs/func_percentile.go:175
github.com/pingcap/tidb/executor.(*HashAggFinalWorker).getFinalResult
	/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/executor/aggregate.go:648
github.com/pingcap/tidb/executor.(*HashAggFinalWorker).run
	/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/executor/aggregate.go:692"]

4. What is your TiDB version? (Required)

master

@wjhuang2016 wjhuang2016 added the type/bug The issue is confirmed as a bug. label Mar 30, 2021
@zz-jason
Copy link
Member

@wjhuang2016 seems the panic stack is the same with #23662, maybe they have the same root cause?

@lzmhhh123 PTAL

@wjhuang2016
Copy link
Member Author

@wjhuang2016 seems the panic stack is the same with #23662, maybe they have the same root cause?

@lzmhhh123 PTAL

I guess not, I used the fresh build tidb,it should contain the fix of that issue.

@zimulala
Copy link
Contributor

I can reproduce it on release-5.0.

@ichn-hu
Copy link
Contributor

ichn-hu commented Mar 31, 2021

I can reproduce it on release-5.0.

did you use tikv as storage or unistore?

@ichn-hu
Copy link
Contributor

ichn-hu commented Mar 31, 2021

data has been simplified, source the following data

data.sql.gz

and the panic is caused by

(SELECT /*+  stream_agg() */ approx_percentile(col_13, 81) aggCol
   FROM
     (SELECT *
      FROM tbl_2
      WHERE col_13 in ('Nbr')
      ORDER BY col_11,
               col_12) ordered_tbl
   FOR UPDATE)
EXCEPT
  (SELECT /*+  hash_agg() */ approx_percentile(col_10, 85) aggCol
   FROM
     (SELECT *
      FROM tbl_2
      WHERE col_12 >= 'Charlie'
      ORDER BY col_11,
               col_12) ordered_tbl) ;

@ichn-hu
Copy link
Contributor

ichn-hu commented Mar 31, 2021

@zimulala @zz-jason @wjhuang2016 this panic is fixed by #23687, 5.0-release has this panic, because the fix PR has not yet been merged into 5.0-release, I tested on the fix PR, and it is fixed #23703

@ichn-hu
Copy link
Contributor

ichn-hu commented Mar 31, 2021

@wjhuang2016 I think it is safe to close this issue.

@XuHuaiyu
Copy link
Contributor

dup with #23662, thus we remove the bug and critical label

@lzmhhh123 lzmhhh123 added the duplicate Issues or pull requests already exists. label Apr 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issues or pull requests already exists. sig/execution SIG execution
Projects
None yet
Development

No branches or pull requests

6 participants