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

Join queries from different series with functions and arithmetic cause a panic #445

Closed
jjmalina opened this issue Apr 16, 2014 · 2 comments

Comments

@jjmalina
Copy link

Using InfluxDB v0.5.7 (git: 9111691) (leveldb: 1.15).
I have this query: SELECT COUNT(chats.csid) / COUNT(start_chats.csid) FROM conversations AS chats INNER JOIN client_events AS start_chats WHERE time > '2014-03-17 11:01:30.200' AND start_chats.code = 'start_chat' AND chats.answered = true GROUP BY time(24.0h);
which causes this stacktrace:

[04/16/14 11:01:30] [INFO] Query: db: test_database, u: root, q: SELECT COUNT(chats.csid) / COUNT(start_chats.csid) FROM conversations AS chats INNER JOIN client_events AS start_chats WHERE time > '2014-03-17 11:01:30.200' AND start_chats.code = 'start_chat' AND chats.answered = true GROUP BY time(24.0h);
[04/16/14 11:01:30] [DEBG] BUFFER SIZE: %!(EXTRA int=100)
[04/16/14 11:01:30] [DEBG] BUFFER SIZE: %!(EXTRA int=100)
[04/16/14 11:01:30] [DEBG] BUFFER SIZE: %!(EXTRA int=100)
[04/16/14 11:01:30] [DEBG] BUFFER SIZE: %!(EXTRA int=100)
[04/16/14 11:01:30] [DEBG] BUFFER SIZE: %!(EXTRA int=100)
[04/16/14 11:01:30] [DEBG] Shard concurrent limit: %!(EXTRA int=10)
[04/16/14 11:01:30] [DEBG] BUFFER SIZE: %!(EXTRA int=100)
[04/16/14 11:01:30] [DEBG] QUERYING: shard: %!(EXTRA int=0, string=[ID: 1, START: 1397088000000000, END: 1397692800000000, LOCAL: true, SERVERS: []])
[04/16/14 11:01:30] [DEBG] BUFFER SIZE: %!(EXTRA int=100)
[04/16/14 11:01:30] [DEBG] QUERYING: shard: %!(EXTRA int=1, string=[ID: 2, START: 1396483200000000, END: 1397088000000000, LOCAL: true, SERVERS: []])
[04/16/14 11:01:30] [DEBG] BUFFER SIZE: %!(EXTRA int=100)
[04/16/14 11:01:30] [DEBG] QUERYING: shard: %!(EXTRA int=2, string=[ID: 3, START: 1395878400000000, END: 1396483200000000, LOCAL: true, SERVERS: []])
[04/16/14 11:01:30] [DEBG] BUFFER SIZE: %!(EXTRA int=100)
[04/16/14 11:01:30] [DEBG] QUERYING: shard: %!(EXTRA int=3, string=[ID: 4, START: 1395273600000000, END: 1395878400000000, LOCAL: true, SERVERS: []])
[04/16/14 11:01:30] [DEBG] BUFFER SIZE: %!(EXTRA int=100)
[04/16/14 11:01:30] [DEBG] QUERYING: shard: %!(EXTRA int=4, string=[ID: 5, START: 1394668800000000, END: 1395273600000000, LOCAL: true, SERVERS: []])
[04/16/14 11:01:30] [DEBG] creating a query engine

[04/16/14 11:01:30] [DEBG] creating a query engine

[04/16/14 11:01:30] [DEBG] creating a query engine

[04/16/14 11:01:30] [DEBG] commiting 154 for server 1
[04/16/14 11:01:30] [DEBG] creating a query engine

[04/16/14 11:01:30] [DEBG] creating a query engine

[04/16/14 11:01:30] [DEBG] Final Flush chats
[04/16/14 11:01:30] [DEBG] Final Flush chats
[04/16/14 11:01:30] [DEBG] Final Flush start_chats
[04/16/14 11:01:30] [DEBG] Final Flush start_chats
********************************BUG********************************
Database: test_database
Query: [SELECT COUNT(chats.csid) / COUNT(start_chats.csid) FROM conversations AS chats INNER JOIN client_events AS start_chats WHERE time > '2014-03-17 11:01:30.200' AND start_chats.code = 'start_chat' AND chats.answered = true GROUP BY time(24.0h);]
Error: runtime error: index out of range. Stacktrace: goroutine 27 [running]:
common.RecoverFunc(0xc210066586, 0xd, 0xc210072c00, 0xf1, 0x5b1def8)
    /private/tmp/influxdb-5uTS/influxdb/src/common/recover.go:13 +0x106
runtime.panic(0x4447e60, 0x49d43b7)
    /usr/local/Cellar/go/1.2.1/libexec/src/pkg/runtime/panic.c:248 +0x106
engine.getExpressionValue(0xc21034e120, 0x1, 0x2, 0xc2102e7600, 0x6, ...)
    /private/tmp/influxdb-5uTS/influxdb/src/engine/filtering.go:42 +0xa4a
engine.matchesExpression(0xc210111960, 0xc2102e7600, 0x6, 0x8, 0xc210356e80, ...)
    /private/tmp/influxdb-5uTS/influxdb/src/engine/filtering.go:59 +0x9e
engine.matches(0xc2106f4330, 0xc2102e7600, 0x6, 0x8, 0xc210356e80, ...)
    /private/tmp/influxdb-5uTS/influxdb/src/engine/filtering.go:74 +0x91
engine.matches(0xc2106f42a0, 0xc2102e7600, 0x6, 0x8, 0xc210356e80, ...)
    /private/tmp/influxdb-5uTS/influxdb/src/engine/filtering.go:78 +0x129
engine.Filter(0xc2101542d0, 0xc2104384b0, 0x10, 0x2, 0x2)
    /private/tmp/influxdb-5uTS/influxdb/src/engine/filtering.go:136 +0x18b
engine.func·013(0xc210438460, 0xc2103fa8d0
[04/16/14 11:01:30] [DEBG] Final Flush start_chats
[04/16/14 11:01:30] [DEBG] GOT RESPONSE: %!(EXTRA *protocol.Response_Type=END_STREAM)
[04/16/14 11:01:30] [EROR] Error while executing query: Internal Error
********************************BUG********************************
Database: test_database
Query: [SELECT COUNT(chats.csid) / COUNT(start_chats.csid) FROM conversations AS chats INNER JOIN client_events AS start_chats WHERE time > '2014-03-17 11:01:30.200' AND start_chats.code = 'start_chat' AND chats.answered = true GROUP BY time(24.0h);]
Error: runtime error: index out of range. Stacktrace: goroutine 28 [running]:
common.RecoverFunc(0xc210066586, 0xd, 0xc210072c00, 0xf1, 0x5b1bef8)
    /private/tmp/influxdb-5uTS/influxdb/src/common/recover.go:13 +0x106
runtime.panic(0x4447e60, 0x49d43b7)
    /usr/local/Cellar/go/1.2.1/libexec/src/pkg/runtime/panic.c:248 +0x106
engine.getExpressionValue(0xc21034e120, 0x1, 0x2, 0xc210410680, 0x6, ...)
    /private/tmp/influxdb-5uTS/influxdb/src/engine/filtering.go:42 +0xa4a
engine.matchesExpression(0xc210111960, 0xc210410680, 0x6, 0x8, 0xc21035c340, ...)
    /private/tmp/influxdb-5uTS/influxdb/src/engine/filtering.go:59 +0x9e
engine.matches(0xc2106f4330, 0xc210410680, 0x6, 0x8, 0xc21035c340, ...)
    /private/tmp/influxdb-5uTS/influxdb/src/engine/filtering.go:74 +0x91
engine.matches(0xc2106f42a0, 0xc210410680, 0x6, 0x8, 0xc21035c340, ...)
    /private/tmp/influxdb-5uTS/influxdb/src/engine/filtering.go:78 +0x129
engine.Filter(0xc2101542d0, 0xc210434be0, 0x10, 0x2, 0x2)
    /private/tmp/influxdb-5uTS/influxdb/src/engine/filtering.go:136 +0x18b
engine.func·013(0xc210434b90, 0xc210755cf8

I have another query which is similar:
SELECT COUNT(starts.csid) / COUNT(clicks.csid) FROM client_events AS clicks INNER JOIN client_events AS renders WHERE time > '2014-03-17 11:16:07.005' AND clicks.code = 'cta_click' AND renders.code = 'cta_render' GROUP BY time(24.0h);
This works it just doesn't return any data. So it seems that joining from two different series causes the panic. I also tried removing the count functions and where clauses and the panic didn't happen but there was no data. If I separate the joins into their own queries the data is there, so there is definitely some issue with joining. Or my query is wrong (-‸ლ).

I have tests in my app for this so reproducing is easy, LMK if you need the db data. Thanks!

@jvshahid jvshahid added this to the Next release milestone May 21, 2014
@mattheworiordan
Copy link

This may be related to #652

@jvshahid jvshahid removed this from the Next release milestone Oct 9, 2014
@jjmalina jjmalina removed this from the Next release milestone Oct 9, 2014
@jvshahid
Copy link
Contributor

I think this is in fact duplicate of #652.

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

No branches or pull requests

3 participants