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

[1.2] Dividing an aggregate function with elapsed() throws panic #7880

Closed
kostasb opened this issue Jan 25, 2017 · 6 comments
Closed

[1.2] Dividing an aggregate function with elapsed() throws panic #7880

kostasb opened this issue Jan 25, 2017 · 6 comments

Comments

@kostasb
Copy link

kostasb commented Jan 25, 2017

version tested: 1.2

Description: sum(count::float) / elapsed(sum(count::float), 1m) throws panic.

Repro case using actual sample dataset: influx -import -path=sample.txt

sample.txt

use repro

SELECT sum(count::float) / elapsed(sum(count::float), 1m) FROM jvm_threads WHERE time > '2017-01-25T06:40:41.663090514Z' GROUP BY time(1m) fill(previous)

response is:

[panic:runtime error: invalid memory address or nil pointer dereference]

log excerpt:

25 16:16:13 ubuntu16 influxd[27798]: runtime/debug.Stack(0xc423ff9ba0, 0xc422182bb0, 0xa7)
25 16:16:13 ubuntu16 influxd[27798]:         /usr/local/go/src/runtime/debug/stack.go:24 +0x79
25 16:16:13 ubuntu16 influxd[27798]: github.com/influxdata/influxdb/influxql.(*QueryExecutor).recover(0xc420154660, 0xc423ff9ba0, 0xc422a812c0)
25 16:16:13 ubuntu16 influxd[27798]:         /root/go/src/github.com/influxdata/influxdb/influxql/query_executor.go:362 +0x96
25 16:16:13 ubuntu16 influxd[27798]: panic(0xa03980, 0xc420010070)
25 16:16:13 ubuntu16 influxd[27798]:         /usr/local/go/src/runtime/panic.go:458 +0x243
25 16:16:13 ubuntu16 influxd[27798]: github.com/influxdata/influxdb/influxql.(*floatExprIterator).Next(0xc421b0a200, 0xe2bce0, 0xc421b0a200, 0xc42655b7a0)
25 16:16:13 ubuntu16 influxd[27798]:         /root/go/src/github.com/influxdata/influxdb/influxql/iterator.gen.go:1290 +0x13a
25 16:16:13 ubuntu16 influxd[27798]: github.com/influxdata/influxdb/influxql.(*Emitter).readIterator(0xc4205ec300, 0xe2bce0, 0xc421b0a200, 0xc42655b8b8, 0xc422d6c0e0, 0xc422186440, 0xc42606c06
25 16:16:13 ubuntu16 influxd[27798]:         /root/go/src/github.com/influxdata/influxdb/influxql/emitter.go:195 +0xc2
25 16:16:13 ubuntu16 influxd[27798]: github.com/influxdata/influxdb/influxql.(*Emitter).loadBuf(0xc4205ec300, 0xc42655b8e8, 0x0, 0x0, 0x0, 0xc3, 0xc422d6c0e0, 0xb, 0x0)
25 16:16:13 ubuntu16 influxd[27798]:         /root/go/src/github.com/influxdata/influxdb/influxql/emitter.go:101 +0x778
25 16:16:13 ubuntu16 influxd[27798]: github.com/influxdata/influxdb/influxql.(*Emitter).Emit(0xc4205ec300, 0xbac548, 0xc4205ec300, 0x2, 0x1)
25 16:16:13 ubuntu16 influxd[27798]:         /root/go/src/github.com/influxdata/influxdb/influxql/emitter.go:53 +0x60
25 16:16:13 ubuntu16 influxd[27798]: github.com/influxdata/influxdb/coordinator.(*StatementExecutor).executeSelectStatement(0xc42016c070, 0xc421986e00, 0xc42655bc68, 0x0, 0x0)
25 16:16:13 ubuntu16 influxd[27798]:         /root/go/src/github.com/influxdata/influxdb/coordinator/statement_executor.go:454 +0x3f0
25 16:16:13 ubuntu16 influxd[27798]: github.com/influxdata/influxdb/coordinator.(*StatementExecutor).ExecuteStatement(0xc42016c070, 0xe324a0, 0xc421986e00, 0x0, 0x8, 0xc422a813e0, 0xc422a812c0
25 16:16:13 ubuntu16 influxd[27798]:         /root/go/src/github.com/influxdata/influxdb/coordinator/statement_executor.go:57 +0x2afc
25 16:16:13 ubuntu16 influxd[27798]: github.com/influxdata/influxdb/influxql.(*QueryExecutor).executeQuery(0xc420154660, 0xc423ff9ba0, 0xc42479731c, 0x5, 0x2710, 0x0, 0x0, 0x0, 0xc422a81200, 0
25 16:16:13 ubuntu16 influxd[27798]:         /root/go/src/github.com/influxdata/influxdb/influxql/query_executor.go:312 +0x55d
25 16:16:13 ubuntu16 influxd[27798]: created by github.com/influxdata/influxdb/influxql.(*QueryExecutor).ExecuteQuery
25 16:16:13 ubuntu16 influxd[27798]:         /root/go/src/github.com/influxdata/influxdb/influxql/query_executor.go:207 +0xb5
25 16:16:13 ubuntu16 influxd[27798]:  service=query
@desa
Copy link
Contributor

desa commented Jan 25, 2017

@kostasb can you see if this was an issue with 1.1? I'm curios to know if this is a regression or something that has been here for a while.

@e-dard e-dard added the panic label Jan 25, 2017
@e-dard
Copy link
Contributor

e-dard commented Jan 25, 2017

@desa it's in 1.1 too.

@e-dard e-dard added this to the 1.3.0 milestone Jan 25, 2017
@timhallinflux timhallinflux modified the milestones: 1.2.1, 1.3.0 Jan 25, 2017
@pauldix pauldix removed the ready label Jan 25, 2017
@corylanou corylanou self-assigned this Jan 31, 2017
@jwilder
Copy link
Contributor

jwilder commented Feb 1, 2017

Fixed via #7924

@jwilder jwilder closed this as completed Feb 1, 2017
@kostasb
Copy link
Author

kostasb commented Feb 20, 2017

Tested again on 1.2.1~rc4

> SELECT sum(count::float) / elapsed(sum(count::float), 1m) FROM jvm_threads WHERE time > '2017-01-25T06:40:41.663090514Z' GROUP BY time(1m) fill(previous)
ERR: SELECT sum(count::float) / elapsed(sum(count::float), 1m) FROM repro.autogen.jvm_threads WHERE time > '2017-01-25T06:40:41.663090514Z' GROUP BY time(1m) fill(previous) [panic:runtime error: invalid memory address or nil pointer dereference]
Φεβ 20 17:11:36 ubuntu16 influxd[17733]: [E] 2017-02-20T15:11:36Z SELECT sum(count::float) / elapsed(sum(count::float), 1m) FROM repro.autogen.jvm_threads WHERE time > '20
17-01-25T06:40:41.663090514Z' GROUP BY time(1m) fill(previous) [panic:runtime error: invalid memory address or nil pointer dereference] goroutine 885 [running]:
Φεβ 20 17:11:36 ubuntu16 influxd[17733]: runtime/debug.Stack(0xc42322a040, 0xc420e53080, 0xa7)
Φεβ 20 17:11:36 ubuntu16 influxd[17733]:         /usr/local/go/src/runtime/debug/stack.go:24 +0x79
Φεβ 20 17:11:36 ubuntu16 influxd[17733]: github.com/influxdata/influxdb/influxql.(*QueryExecutor).recover(0xc420154b10, 0xc42322a040, 0xc42266e780)
Φεβ 20 17:11:36 ubuntu16 influxd[17733]:         /root/go/src/github.com/influxdata/influxdb/influxql/query_executor.go:362 +0x96
Φεβ 20 17:11:36 ubuntu16 influxd[17733]: panic(0xa05ac0, 0xc420010070)
Φεβ 20 17:11:36 ubuntu16 influxd[17733]:         /usr/local/go/src/runtime/panic.go:458 +0x243
Φεβ 20 17:11:36 ubuntu16 influxd[17733]: github.com/influxdata/influxdb/influxql.(*floatExprIterator).Next(0xc425774340, 0xe2ece0, 0xc425774340, 0xc423bb37a0)
Φεβ 20 17:11:36 ubuntu16 influxd[17733]:         /root/go/src/github.com/influxdata/influxdb/influxql/iterator.gen.go:1291 +0x168
Φεβ 20 17:11:36 ubuntu16 influxd[17733]: github.com/influxdata/influxdb/influxql.(*Emitter).readIterator(0xc421c5db80, 0xe2ece0, 0xc425774340, 0xc423bb38b8, 0xc4253fb830, 0xc42322a700, 0xc42322bca0)
Φεβ 20 17:11:36 ubuntu16 influxd[17733]:         /root/go/src/github.com/influxdata/influxdb/influxql/emitter.go:194 +0xc2
Φεβ 20 17:11:36 ubuntu16 influxd[17733]: github.com/influxdata/influxdb/influxql.(*Emitter).loadBuf(0xc421c5db80, 0xc423bb38e8, 0x0, 0x0, 0x0, 0x68, 0xc4253fb830, 0xb, 0x0)
Φεβ 20 17:11:36 ubuntu16 influxd[17733]:         /root/go/src/github.com/influxdata/influxdb/influxql/emitter.go:101 +0x778
Φεβ 20 17:11:36 ubuntu16 influxd[17733]: github.com/influxdata/influxdb/influxql.(*Emitter).Emit(0xc421c5db80, 0xbae8c0, 0xc421c5db80, 0x2, 0x1)
Φεβ 20 17:11:36 ubuntu16 influxd[17733]:         /root/go/src/github.com/influxdata/influxdb/influxql/emitter.go:53 +0x60
Φεβ 20 17:11:36 ubuntu16 influxd[17733]: github.com/influxdata/influxdb/coordinator.(*StatementExecutor).executeSelectStatement(0xc420170150, 0xc42584f180, 0xc423bb3c68, 0x0, 0x0)
Φεβ 20 17:11:36 ubuntu16 influxd[17733]:         /root/go/src/github.com/influxdata/influxdb/coordinator/statement_executor.go:454 +0x3f0
Φεβ 20 17:11:36 ubuntu16 influxd[17733]: github.com/influxdata/influxdb/coordinator.(*StatementExecutor).ExecuteStatement(0xc420170150, 0xe354a0, 0xc42584f180, 0x0, 0x2d, 0xc42266e8a0, 0xc42266e780, 0xe38b60, 0xc42016f380, 0xc42266e7e0, ...)
Φεβ 20 17:11:36 ubuntu16 influxd[17733]:         /root/go/src/github.com/influxdata/influxdb/coordinator/statement_executor.go:57 +0x2afc
Φεβ 20 17:11:36 ubuntu16 influxd[17733]: github.com/influxdata/influxdb/influxql.(*QueryExecutor).executeQuery(0xc420154b10, 0xc42322a040, 0xc422910e1c, 0x5, 0x2710, 0x0, 0x0, 0x0, 0xc42266e6c0, 0xc42266e660, ...)
Φεβ 20 17:11:36 ubuntu16 influxd[17733]:         /root/go/src/github.com/influxdata/influxdb/influxql/query_executor.go:312 +0x55d
Φεβ 20 17:11:36 ubuntu16 influxd[17733]: created by github.com/influxdata/influxdb/influxql.(*QueryExecutor).ExecuteQuery
Φεβ 20 17:11:36 ubuntu16 influxd[17733]:         /root/go/src/github.com/influxdata/influxdb/influxql/query_executor.go:207 +0xb5
Φεβ 20 17:11:36 ubuntu16 influxd[17733]:  service=query

@desa desa reopened this Feb 21, 2017
@jwilder jwilder assigned jsternberg and unassigned corylanou Feb 23, 2017
@jsternberg
Copy link
Contributor

Looks like the remaining issue has to do with FILL(previous). I'm looking at it now.

@jwilder
Copy link
Contributor

jwilder commented Feb 24, 2017

Fixed via #8056

@jwilder jwilder closed this as completed Feb 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants