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

window function panic: runtime error: index out of range #12415

Closed
healeae opened this issue Sep 26, 2019 · 4 comments · Fixed by #12480
Closed

window function panic: runtime error: index out of range #12415

healeae opened this issue Sep 26, 2019 · 4 comments · Fixed by #12480
Assignees
Labels
type/bug The issue is confirmed as a bug.

Comments

@healeae
Copy link

healeae commented Sep 26, 2019

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
    SELECT
    income.customer_id,
    income.contract_id,
    income.pay_time,
    first_value ( contract_id ) over ( PARTITION BY customer_id ORDER BY pay_time ASC ) AS first_contract_id
    FROM
    contract_tidb.finance_income income

  2. What did you expect to see?
    return columns

  3. What did you see instead?
    tidb.log error:
    [ERROR] [conn.go:600] ["connection running loop panic"] [conn=5664] [lastCmd="SELECT
    income.customer_id,
    income.contract_id,
    income.pay_time,
    first_value ( contract_id ) over ( PARTITION BY customer_id ORDER BY pay_time ASC ) AS first_contract_id
    FROM
    contract_tidb.finance_income income"] [err=""index out of range""] [stack="goroutine 15400945 [running]:
    github.com/pingcap/tidb/server.(*clientConn).Run.func1(0x227cee0, 0xc013c58840, 0xc01d4dad00)
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/server/conn.go:598 +0xee
    panic(0x1daad60, 0x31d59f0)
    /usr/local/go/src/runtime/panic.go:522 +0x1b5
    github.com/pingcap/tidb/server.(*clientConn).writeResultset.func1(0x0, 0x228ece0, 0xc00adfb590, 0xc02e2cd738, 0x227cee0, 0xc013c58840, 0xc01d4dad00)
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/server/conn.go:1261 +0x59c
    panic(0x1daad60, 0x31d59f0)
    /usr/local/go/src/runtime/panic.go:522 +0x1b5
    github.com/pingcap/tidb/util/chunk.(*column).isNull(...)
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/util/chunk/column.go:71
    github.com/pingcap/tidb/util/chunk.Row.IsNull(...)
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/util/chunk/row.go:223
    github.com/pingcap/tidb/expression.(*Column).EvalInt(0xc01064bd10, 0x22b63e0, 0xc02eddd0e0, 0xc001bed080, 0x3ff, 0xc02eddd0e0, 0x22b76a0, 0xc01064be00, 0x22b76a0)
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/expression/column.go:221 +0x267
    github.com/pingcap/tidb/executor/aggfuncs.(*value4Int).extractRow(0xc00b7ab880, 0x22b63e0, 0xc02eddd0e0, 0x22b76a0, 0xc01064bd10, 0xc001bed080, 0x3ff, 0x0, 0x1)
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/executor/aggfuncs/func_value.go:42 +0x63
    github.com/pingcap/tidb/executor/aggfuncs.(*firstValue).UpdatePartialResult(0xc001becb10, 0x22b63e0, 0xc02eddd0e0, 0xc013952000, 0x2, 0x80, 0xc000f327c0, 0x0, 0x0)
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/executor/aggfuncs/func_value.go:247 +0x9f
    github.com/pingcap/tidb/executor.(*rangeFrameWindowProcessor).appendResult2Chunk(0xc022dd1580, 0x22b63e0, 0xc02eddd0e0, 0xc013952000, 0x2, 0x80, 0xc001becc60, 0x1, 0x1ea8680, 0x0, ...)
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/executor/window.go:404 +0x377
    github.com/pingcap/tidb/executor.(*WindowExec).appendResult2Chunk(0xc0015542d0, 0xc001becc60, 0x0, 0x0)
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/executor/window.go:149 +0xc1
    github.com/pingcap/tidb/executor.(*WindowExec).Next(0xc0015542d0, 0x227cee0, 0xc013c58840, 0xc001becc60, 0x0, 0x0)
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/executor/window.go:66 +0x1df
    github.com/pingcap/tidb/executor.Next(0x227cee0, 0xc013c58840, 0x2283f60, 0xc0015542d0, 0xc001becc60, 0x23, 0x13)
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/executor/executor.go:191 +0xbd
    github.com/pingcap/tidb/executor.(*recordSet).Next(0xc00adfb540, 0x227cee0, 0xc013c58840, 0xc001becc60, 0x0, 0x0)
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/executor/adapter.go:109 +0xb0
    github.com/pingcap/tidb/server.(*tidbResultSet).Next(0xc00adfb590, 0x227cee0, 0xc013c58840, 0xc001becc60, 0x0, 0x0)
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/server/driver_tidb.go:365 +0x51
    github.com/pingcap/tidb/server.(*clientConn).writeChunks(0xc01d4dad00, 0x227cee0, 0xc013c58840, 0x228ece0, 0xc00adfb590, 0xc00000d700, 0x227cee0, 0xc013c58840)
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/server/conn.go:1308 +0x319
    github.com/pingcap/tidb/server.(*clientConn).writeResultset(0xc01d4dad00, 0x227cee0, 0xc013c58840, 0x228ece0, 0xc00adfb590, 0xc000005800, 0x0, 0x0, 0x0)
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/server/conn.go:1274 +0x1a1
    github.com/pingcap/tidb/server.(*clientConn).handleQuery(0xc01d4dad00, 0x227cee0, 0xc013c58840, 0xc0014e0fc1, 0xd7, 0x0, 0x0)
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/server/conn.go:1191 +0x212
    github.com/pingcap/tidb/server.(*clientConn).dispatch(0xc01d4dad00, 0x227cee0, 0xc013c58840, 0xc0014e0fc1, 0xd8, 0xd8, 0x0, 0x0)
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/server/conn.go:897 +0x5c6
    github.com/pingcap/"] [stack="github.com/pingcap/tidb/server.(*clientConn).Run.func1
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/server/conn.go:600
    runtime.gopanic
    /usr/local/go/src/runtime/panic.go:522
    github.com/pingcap/tidb/server.(*clientConn).writeResultset.func1
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/server/conn.go:1261
    runtime.gopanic
    /usr/local/go/src/runtime/panic.go:522
    runtime.panicindex
    /usr/local/go/src/runtime/panic.go:44
    github.com/pingcap/tidb/util/chunk.(*column).isNull
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/util/chunk/column.go:71
    github.com/pingcap/tidb/util/chunk.Row.IsNull
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/util/chunk/row.go:223
    github.com/pingcap/tidb/expression.(*Column).EvalInt
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/expression/column.go:221
    github.com/pingcap/tidb/executor/aggfuncs.(*value4Int).extractRow
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/executor/aggfuncs/func_value.go:42
    github.com/pingcap/tidb/executor/aggfuncs.(*firstValue).UpdatePartialResult
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/executor/aggfuncs/func_value.go:247
    github.com/pingcap/tidb/executor.(*rangeFrameWindowProcessor).appendResult2Chunk
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/executor/window.go:404
    github.com/pingcap/tidb/executor.(*WindowExec).appendResult2Chunk
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/executor/window.go:149
    github.com/pingcap/tidb/executor.(*WindowExec).Next
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/executor/window.go:66
    github.com/pingcap/tidb/executor.Next
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/executor/executor.go:191
    github.com/pingcap/tidb/executor.(*recordSet).Next
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/executor/adapter.go:109
    github.com/pingcap/tidb/server.(*tidbResultSet).Next
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/server/driver_tidb.go:365
    github.com/pingcap/tidb/server.(*clientConn).writeChunks
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/server/conn.go:1308
    github.com/pingcap/tidb/server.(*clientConn).writeResultset
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/server/conn.go:1274
    github.com/pingcap/tidb/server.(*clientConn).handleQuery
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/server/conn.go:1191
    github.com/pingcap/tidb/server.(*clientConn).dispatch
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/server/conn.go:897
    github.com/pingcap/tidb/server.(*clientConn).Run
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/server/conn.go:652
    github.com/pingcap/tidb/server.(*Server).onConn
    /home/jenkins/workspace/release_tidb_3.0/go/src/github.com/pingcap/tidb/server/server.go:440"]
    [2019/09/26 14:11:50.344 +08:00] [INFO] [server.go:416] ["connection closed"] [conn=5664]

  4. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
    Release Version: v3.0.3
    Git Commit Hash: 836982c
    Git Branch: HEAD
    UTC Build Time: 2019-08-30 02:42:42
    GoVersion: go version go1.12 linux/amd64
    Race Enabled: false
    TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
    Check Table Before Drop: false

@healeae healeae added the type/bug The issue is confirmed as a bug. label Sep 26, 2019
@zz-jason
Copy link
Member

@SunRunAway PTAL

@SunRunAway SunRunAway self-assigned this Sep 26, 2019
@SunRunAway
Copy link
Contributor

Hi, @healeae
Thank you for your report.
Could you provide the table scheme and the data to reproduce this problem. It may help me to fix it quickly.

@healeae
Copy link
Author

healeae commented Sep 26, 2019

There's a lot of data. I put it on the baidu @SunRunAway
https://pan.baidu.com/s/1USMP3KUsV6HZ-H9etH1xAQ

@SunRunAway
Copy link
Contributor

SunRunAway commented Sep 26, 2019

Reproduced. Thanks. I'm investigating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants