influxdb server crash when perform query from empty db (from data explore)
OS: CentOS 6.6, x86_64 The version of InfluxDB you are running: 0.9.0 Installed from RPM http://influxdb.s3.amazonaws.com/influxdb-0.9.0-1.x86_64.rpm A small test case, if applicable, that demonstrates the issues:
select value from test_db
I cannot reproduce this, @hordecore. I'm running 0.9.0 on OS X and when I query a new but empty database or a non-existent database, I get the expected errors but no crash.
Note that your example is somewhat confusing, as you do not SELECT from a database but from a measurement within the database.
Can you provide direct curl statements to reproduce or copy-paste the commands from your CLI session?
Hmm, @beckettsean, on new installation (only difference is that now I run influxdb in lxc container) I can't reproduce this too. Maybe floating bug, maybe I just missed something special.
I think this bug can be closed.
I reproduced it on Linux. Twice. One bare metal and one VPS. The first attempt using 0.9.0 DEB package, the other compiled from source after 4933736d51d4c163d9a2e64264916e19649015d2 "Update CHANGELOG for PR 3038".
sanic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x6693ff]
@diarized Please paste in your curl commands or CLI session so we can see how you were able to reproduce this issue. Until we can reproduce it locally we can't proceed.
@beckettsean, just for clarification: the idea of putting <nil> is to let the user query the table without knowledge that its empty.
> CREATE DATABASE aaa
> exit
$ curl -i -XPOST 'http://localhost:8086/write?db=aaa' -d 'df,disk=simfs value=<nil>'
HTTP/1.1 400 Bad Request
Request-Id: e775a549-16c6-11e5-8009-000000000000
X-Influxdb-Version: 0.9
Date: Fri, 19 Jun 2015 21:05:24 GMT
Content-Length: 61
Content-Type: text/plain; charset=utf-8
unable to parse 'df,disk=simfs value=<nil>': invalid boolean
$ ./bin/influx -database 'aaa'
Connected to http://localhost:8086 version 0.9
InfluxDB shell 0.9
> SELECT * FROM df
ERR: Get http://localhost:8086/query?db=aaa&q=SELECT+%2A+FROM+df: EOF
Here is the runtime error in log.
> SELECT * FROM df
ERR: Get http://localhost:8086/query?db=aaa&q=SELECT+%2A+FROM+df: dial tcp 127.0.0.1:8086: connection refused
>
@diarized I don't quite follow what your statements recreate. First you use the CLI to make database aaa, then you write a bad point using curl and get a 400 response plus an error. Then you run the CLI again to select from an empty measurement and you get an error that indicates the database is no longer running. (The CLI is basically a wrapper around curl. If the database process crashes it doesn't know. The tcp 127.0.0.1:8086: connection refused indicates that your influxd daemon is not running.)
Lots of things happening there, to be sure, but what was it you expected to happen?
the idea of putting
is to let the user query the table without knowledge that its empty.
I'm confused, as there are no tables in InfluxDB. Do you mean query the measurement? Querying an empty measurement is fine, it just returns a reasonable error:
> show measurements
name: measurements
------------------
name
amount
boolean
foobar
meas
negative
tag_key_query
test-show-tags
time
> select * from empty
ERR: measurement not found: "mydb"."default".empty
Note that you can use the CLI to insert points rather than curl. For example, here's your exact steps re-created in the CLI:
> create database aaa
> use aaa
Using database aaa
> insert df,disk=simfs value=<nil>
> select * from df
name: df
tags: disk=simfs
time value
---- -----
2015-06-19T21:31:13.053090817Z false
Issue #3063 describes why the value is false rather than <nil>
I'm guessing the reason you get the 400 error on write is that the curl string isn't encoding properly, but I'm not sure why. If you can recreate reliably please open a new issue.
Came here to see if this is a known bug. I am seeing the same problem on Windows 8.1, with a freshly pulled and built InfluxDB.
In the influx console, if I do
create database mydb
use mydb
select * from whatever
influxd crashes. It also crashes if I try to query the empty database from Grafana. Once I insert whatever, everything works as expected.