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.0.0-beta1] Invalid JSON response causes the client to print the wrong error message #6846

Closed
kjeacle opened this issue Jun 15, 2016 · 6 comments
Assignees
Milestone

Comments

@kjeacle
Copy link

kjeacle commented Jun 15, 2016

Running Influx 1.0.0-beta1 on Ubuntu server 16.04 using collectd 5.5 with snmp plugin to populate database.

Not sure if this is a NaN value bug but appears to be the same as issue #3994

Querying tx values for a particular interface works:

> select non_negative_derivative(value) from snmp_tx where host='xxx' and type_instance='272662528' and time > now() - 10m
name: snmp_tx
-------------
time                    non_negative_derivative
1465987277148127000     596.697775819089

But querying rx values for the same interface fails:

> select non_negative_derivative(value) from snmp_rx where host='xxx' and type_instance='272662528' and time > now() - 10m
ERR: invalid character 'j' looking for beginning of value

This causes in-house graphing system to fail as JSON response is invalid.

@jsternberg
Copy link
Contributor

@kjeacle can you try running that query with curl and pasting the output? It looks like the client is having difficulty parsing the response. The NaN value bug was a problem with the server encoding a response.

This is just a guess of mine. That error might come from the server.

@kjeacle
Copy link
Author

kjeacle commented Jun 17, 2016

I tried this:

$ curl -GET 'http://localhost:8086/query?pretty=true' -u user:pass --data-urlencode "db=snmp" --data-urlencode "q=select non_negative_derivative(value) from snmp_rx where host='xxx' and type_instance='272662528' and time > now() - 10m"

and got this:

json: error calling MarshalJSON for type httpd.Response: json: error calling MarshalJSON for type *influxql.Result: json: unsupported value: NaN

@jsternberg
Copy link
Contributor

Have you tried checking the raw values that are going into the non negative derivative?

SELECT value from snmp_rx where host='xxx' and type_instance='272662528' and time > now() - 10m

I'd like to know if that works and what values are returned. If that fails with the same error, a NaN somehow slipped in. If it doesn't fail, then there's an error with the aggregate function. Remember to modify the time condition to one that makes sense for your data.

@jsternberg
Copy link
Contributor

Never mind. I have a reproducer:

> create database mydb
> use mydb
Using database mydb
> insert cpu,host=server01 value=2 1000000
> insert cpu,host=server02 value=2 1000000
> select derivative(value) from cpu
ERR: invalid character 'j' looking for beginning of value

You likely have two series that match that condition at the same time with the same value. I don't think we should be letting this happen, so I'll look into how we can prevent it from happening. One way to prevent it though would be to add a GROUP BY * which would prevent any of the series from merging with each other.

jsternberg added a commit that referenced this issue Jun 17, 2016
@jsternberg jsternberg self-assigned this Jun 20, 2016
@jsternberg jsternberg changed the title [1.0.0-beta1] NaN values still breaking JSON response [1.0.0-beta1] Invalid JSON response causes the client to print the wrong error message Sep 9, 2016
@jsternberg
Copy link
Contributor

@jwilder I forgot about this one in the run up to the 1.0 GA release. Is it OK for me to come up with a fix for this and get it into 1.0.1? The derivative function needs to be fixed separately, but this is an issue with the client trying to parse an error message and then using that error when it fails to parse the error message instead of the raw text. It should be easy enough to fix for general usability.

@jsternberg
Copy link
Contributor

Fixed via #7280.

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

2 participants