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

[Query Fuzz] Query panic - influxql.Expr is *influxql.Wildcard, not *influxql.VarRef #8064

Closed
e-dard opened this issue Feb 27, 2017 · 3 comments

Comments

@e-dard
Copy link
Contributor

e-dard commented Feb 27, 2017

This issue was found by fuzzing the database with a query generator tool. It may be possible to simplify the query to help identify the root cause.

Dataset
$ curl https://s3.amazonaws.com/noaa.water-database/NOAA_data.txt -o NOAA_data.txt
$ influx -import -path=NOAA_data.txt
Query
QUERY: SELECT    COUNT(*) +   MIN("pH") *   MEDIAN("index")  AS "fA" FROM ( SELECT    DISTINCT("index")  AS "_" FROM  "average_temperature" LIMIT 6162) ORDER BY time ASC
Result

Server returns a panic response.

See attached trace.

1488219733564080130-panic.txt

@e-dard e-dard changed the title [Query Fuzz] Query panic [Query Fuzz] Query panic - influxql.Expr is *influxql.Wildcard, not *influxql.VarRef Feb 27, 2017
@jsternberg
Copy link
Contributor

The reason this seems to happen is because the wildcard expansion code just outright ignores any binary expression.

The fix isn't that simple. The main problem is that when calls are substituted, they're given an alternative name so they don't all just show up as the function name like mean. They do this by setting the alias attribute on the field that gets created.

Unfortunately, the only way to do this reliably would be to recurse through the binary expression and return a list of new expressions. But the Field type isn't an expression and is treated differently (only at the top level) so I'm not yet sure how to get that iteration process working yet.

I'll look at it and see what I can come up with though.

@jsternberg
Copy link
Contributor

@e-dard I'm just going to prevent the panic and say this is currently impossible. Since it panicked before a change that now forbids it, I'm pretty certain nobody was using this successfully.

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

3 participants