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

[0.12.1] Panic from influxql interface conversion #6379

Closed
jpillora opened this issue Apr 14, 2016 · 3 comments
Closed

[0.12.1] Panic from influxql interface conversion #6379

jpillora opened this issue Apr 14, 2016 · 3 comments
Assignees
Labels
Milestone

Comments

@jpillora
Copy link

Bug report

This query crashes InfluxDB, version 0.12.1, branch 0.12, commit e094138 on Mac 10.11.4

[query] 2016/04/14 22:53:29 SELECT percentile(difference(rx_bytes), 95) FROM company."day".interface_counters WHERE interface_id = 'eth0' LIMIT 1000
panic: interface conversion: influxql.Expr is *influxql.Call, not *influxql.VarRef

goroutine 119 [running]:
panic(0x73db40, 0xc820d11940)
    /usr/local/Cellar/go/1.6/libexec/src/runtime/panic.go:464 +0x3e6
github.com/influxdata/influxdb/influxql.buildExprIterator.func1(0xc821bc89c0, 0x1494670, 0xc822b48ec0, 0xc82241b1a0, 0x0, 0x0, 0x0, 0x0)
    /private/tmp/influxdb20160411-37282-1xqnzr8/influxdb-0.12.1/src/github.com/influxdata/influxdb/influxql/select.go:336 +0x219f
github.com/influxdata/influxdb/influxql.buildExprIterator(0x16e3140, 0xc821bc89c0, 0x1494670, 0xc822b48ec0, 0x16e3140, 0xc821bc89c0, 0xcb4ff0, 0x0, 0x0, 0xc823a144b0, ...)
    /private/tmp/influxdb20160411-37282-1xqnzr8/influxdb-0.12.1/src/github.com/influxdata/influxdb/influxql/select.go:351 +0x1850
github.com/influxdata/influxdb/influxql.buildFieldIterators.func1(0xc8201e42d8, 0x1, 0x1, 0x1494670, 0xc822b48ec0, 0xc82241b538, 0xc823a15050, 0x1, 0x1, 0x0, ...)
    /private/tmp/influxdb20160411-37282-1xqnzr8/influxdb-0.12.1/src/github.com/influxdata/influxdb/influxql/select.go:161 +0x5be
github.com/influxdata/influxdb/influxql.buildFieldIterators(0xc8201e42d8, 0x1, 0x1, 0x1494670, 0xc822b48ec0, 0x0, 0x0, 0xcb4ff0, 0x0, 0x0, ...)
    /private/tmp/influxdb20160411-37282-1xqnzr8/influxdb-0.12.1/src/github.com/influxdata/influxdb/influxql/select.go:147 +0xf8
github.com/influxdata/influxdb/influxql.Select(0xc8229fc820, 0x1494670, 0xc822b48ec0, 0xc82241bc90, 0x0, 0x0, 0x0, 0x0, 0x0)
    /private/tmp/influxdb20160411-37282-1xqnzr8/influxdb-0.12.1/src/github.com/influxdata/influxdb/influxql/select.go:81 +0xbb9
github.com/influxdata/influxdb/cluster.(*QueryExecutor).executeSelectStatement(0xc820140090, 0xc8229fc820, 0x2710, 0x0, 0x3, 0xc821e88b40, 0xc821e88ba0, 0x0, 0x0)
    /private/tmp/influxdb20160411-37282-1xqnzr8/influxdb-0.12.1/src/github.com/influxdata/influxdb/cluster/query_executor.go:500 +0x9a4
github.com/influxdata/influxdb/cluster.(*QueryExecutor).executeQuery(0xc820140090, 0xc822b488a0, 0xc8229f80a3, 0x9, 0x2710, 0xc821e88ba0, 0xc821e88b40)
    /private/tmp/influxdb20160411-37282-1xqnzr8/influxdb-0.12.1/src/github.com/influxdata/influxdb/cluster/query_executor.go:146 +0xa2e
created by github.com/influxdata/influxdb/cluster.(*QueryExecutor).ExecuteQuery
    /private/tmp/influxdb20160411-37282-1xqnzr8/influxdb-0.12.1/src/github.com/influxdata/influxdb/cluster/query_executor.go:80 +0x96

Edit: I'm aware I'm using PERCENTILE(<field_key>,[0,100]) incorrectly, just thought I'd file the bug anyway since crashes in production are no fun

@e-dard e-dard added this to the 0.13.0 milestone Apr 14, 2016
@e-dard e-dard added the panic label Apr 14, 2016
@e-dard
Copy link
Contributor

e-dard commented Apr 14, 2016

Thanks for the report @jpillora. We'll get it fixed.

jsternberg added a commit that referenced this issue Apr 14, 2016
The `percentile()` call previously did not validate that the first
argument was a variable reference and that would let an invalid query
slip by that would panic the query engine.

Added checking for this case and also included test cases for the other
calls that require a variable reference as the first argument.

Fixes #6379.
@jwilder jwilder mentioned this issue Apr 19, 2016
jsternberg added a commit that referenced this issue Apr 20, 2016
The `percentile()` call previously did not validate that the first
argument was a variable reference and that would let an invalid query
slip by that would panic the query engine.

Added checking for this case and also included test cases for the other
calls that require a variable reference as the first argument.

Fixes #6379.
@junyhu
Copy link

junyhu commented May 18, 2016

hi all,

we are facing exactly same error while running below query in influxdb
SELECT max(distinct(memory)) FROM mydb."default".mydb_usage

here is log info

POST /write?db=crmetrics&rp=rp_server_metrics HTTP/1.1 204 0 - - fc5eb7a9-1c96-11e6-b783-000000000000 19.091296ms
[query] 2016/05/18 01:22:36 SELECT max(distinct(memory)) FROM mydb."default".mydb_usage
panic: interface conversion: influxql.Expr is *influxql.Call, not *influxql.VarRef

goroutine 132231 [running]:
github.com/influxdata/influxdb/tsdb/engine/tsm1.(_Engine).CreateIterator(0xc2081c69a0, 0x7f1c66f38998, 0xc20ee87710, 0xf39d88, 0x0, 0x0, 0xc21b98b250, 0x1, 0x1, 0x0, ...)
/tmp/influxdb/src/github.com/influxdata/influxdb/tsdb/engine/tsm1/engine.go:681 +0xfe
github.com/influxdata/influxdb/tsdb.(_Shard).CreateIterator(0xc210950360, 0x7f1c66f38998, 0xc20ee87710, 0xf39d88, 0x0, 0x0, 0xc21b98b250, 0x1, 0x1, 0x0, ...)
/tmp/influxdb/src/github.com/influxdata/influxdb/tsdb/shard.go:437 +0x190
github.com/influxdata/influxdb/tsdb.(_shardIteratorCreator).CreateIterator(0xc2148c90a0, 0x7f1c66f38998, 0xc20ee87710, 0xf39d88, 0x0, 0x0, 0xc21b98b250, 0x1, 0x1, 0x0, ...)
/tmp/influxdb/src/github.com/influxdata/influxdb/tsdb/shard.go:907 +0x78
github.com/influxdata/influxdb/influxql.func·065(0x0, 0x0)
/tmp/influxdb/src/github.com/influxdata/influxdb/influxql/iterator.go:483 +0x100
github.com/influxdata/influxdb/influxql.IteratorCreators.CreateIterator(0xc20da99160, 0x2, 0x2, 0x7f1c66f38998, 0xc20ee87710, 0xf39d88, 0x0, 0x0, 0xc21b98b250, 0x1, ...)
/tmp/influxdb/src/github.com/influxdata/influxdb/influxql/iterator.go:490 +0x110
github.com/influxdata/influxdb/influxql.(_IteratorCreators).CreateIterator(0xc20da99260, 0x7f1c66f38998, 0xc20ee87710, 0xf39d88, 0x0, 0x0, 0xc21b98b250, 0x1, 0x1, 0x0, ...)
:152 +0xfd
github.com/influxdata/influxdb/influxql.func·076(0x0, 0x0, 0x0, 0x0)
/tmp/influxdb/src/github.com/influxdata/influxdb/influxql/select.go:260 +0xc48
github.com/influxdata/influxdb/influxql.buildExprIterator(0x7f1c66f38998, 0xc20ee87710, 0x7f1c66f38f78, 0xc20da99260, 0x7f1c66f38998, 0xc20ee87710, 0xf39d88, 0x0, 0x0, 0xc21b98b250, ...)
/tmp/influxdb/src/github.com/influxdata/influxdb/influxql/select.go:344 +0x140e
github.com/influxdata/influxdb/influxql.func·075(0x0, 0x0)
/tmp/influxdb/src/github.com/influxdata/influxdb/influxql/select.go:154 +0x64c
github.com/influxdata/influxdb/influxql.buildFieldIterators(0xc2148c9050, 0x1, 0x1, 0x7f1c66f38f78, 0xc20da99260, 0x0, 0x0, 0xf39d88, 0x0, 0x0, ...)
/tmp/influxdb/src/github.com/influxdata/influxdb/influxql/select.go:190 +0x103
github.com/influxdata/influxdb/influxql.Select(0xc219b8c1a0, 0x7f1c66f38f78, 0xc20da99260, 0xc20c780480, 0x0, 0x0, 0x0, 0x0, 0x0)
/tmp/influxdb/src/github.com/influxdata/influxdb/influxql/select.go:81 +0xd7a
github.com/influxdata/influxdb/cluster.(_QueryExecutor).executeSelectStatement(0xc208072120, 0xc219b8c1a0, 0x2710, 0x0, 0xba0, 0xc210897200, 0xc210897260, 0x0, 0x0)
/tmp/influxdb/src/github.com/influxdata/influxdb/cluster/query_executor.go:500 +0x9c5
github.com/influxdata/influxdb/cluster.(_QueryExecutor).executeQuery(0xc208072120, 0xc20dc21560, 0xc20e27b1c3, 0x4, 0x2710, 0xc210897260, 0xc210897200)
/tmp/influxdb/src/github.com/influxdata/influxdb/cluster/query_executor.go:146 +0x9c0
created by github.com/influxdata/influxdb/cluster.(*QueryExecutor).ExecuteQuery
/tmp/influxdb/src/github.com/influxdata/influxdb/cluster/query_executor.go:80 +0x8c

goroutine 1 [chan receive, 1468 minutes]:
main.(*Main).Run(0xc20800a340, 0xc20800a020, 0x2, 0x2, 0x0, 0x0)
/tmp/influxdb/src/github.com/influxdata/influxdb/cmd/influxd/main.go:94 +0x765
main.main()
/tmp/influxdb/src/github.com/influxdata/influxdb/cmd/influxd/main.go:45 +0xdc

goroutine 76 [sleep]:
github.com/influxdata/influxdb/tsdb/engine/tsm1.(*Engine).compactCache(0xc20805cc60)
/tmp/influxdb/src/github.com/influxdata/influxdb/tsdb/engine/tsm1/engine.go:510 +0x20c

@jsternberg
Copy link
Contributor

@junyhu are you running 0.13? This is fixed in 0.13.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants