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

Runtime error when inserting point without value #3379

Closed
vbatoufflet opened this issue Jul 18, 2015 · 3 comments
Closed

Runtime error when inserting point without value #3379

vbatoufflet opened this issue Jul 18, 2015 · 3 comments

Comments

@vbatoufflet
Copy link

Hi,

When trying to insert some data into InfluxDB (the 0.9.1 version), we can end up with Go panicking on a runtime error if the value=… part is absent from the payload:

2015/07/18 05:44:44 http: panic serving 192.168.101.11:57225: runtime error: slice bounds out of range
goroutine 88318 [running]:
net/http.func·011()
    /usr/local/go/src/net/http/server.go:1130 +0xbb
github.com/influxdb/influxdb/tsdb.scanKey(0xc20803e200, 0x2b, 0x200, 0x2b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
    /home/philip/build/src/github.com/influxdb/influxdb/tsdb/points.go:296 +0x682
github.com/influxdb/influxdb/tsdb.parsePoint(0xc20803e200, 0x2b, 0x200, 0xecd3bdecc, 0x4f2e451, 0xe9e4c0, 0xad1050, 0x1, 0x0, 0x0, ...)
    /home/philip/build/src/github.com/influxdb/influxdb/tsdb/points.go:141 +0x86
github.com/influxdb/influxdb/tsdb.ParsePointsWithPrecision(0xc20803e200, 0x2b, 0x200, 0xecd3bdecc, 0x4f2e451, 0xe9e4c0, 0xad1050, 0x1, 0x0, 0x0, ...)
    /home/philip/build/src/github.com/influxdb/influxdb/tsdb/points.go:124 +0x22a
github.com/influxdb/influxdb/services/httpd.(*Handler).serveWriteLine(0xc208010310, 0x7ff18f9bc200, 0xc208196480, 0xc2080d5860, 0xc20803e200, 0x2b, 0x200, 0x0)
    /home/philip/build/src/github.com/influxdb/influxdb/services/httpd/handler.go:423 +0x1ca
github.com/influxdb/influxdb/services/httpd.(*Handler).serveWrite(0xc208010310, 0x7ff18f9bc200, 0xc208196480, 0xc2080d5860, 0x0)
    /home/philip/build/src/github.com/influxdb/influxdb/services/httpd/handler.go:326 +0x69d
github.com/influxdb/influxdb/services/httpd.*Handler.(github.com/influxdb/influxdb/services/httpd.serveWrite)·fm(0x7ff18f9bc200, 0xc208196480, 0xc2080d5860, 0x0)
    /home/philip/build/src/github.com/influxdb/influxdb/services/httpd/handler.go:98 +0x4f
github.com/influxdb/influxdb/services/httpd.func·001(0x7ff18f9bc200, 0xc208196480, 0xc2080d5860)
    /home/philip/build/src/github.com/influxdb/influxdb/services/httpd/handler.go:602 +0x78
net/http.HandlerFunc.ServeHTTP(0xc20804a6e0, 0x7ff18f9bc200, 0xc208196480, 0xc2080d5860)
    /usr/local/go/src/net/http/server.go:1265 +0x41
github.com/influxdb/influxdb/services/httpd.func·002(0x7ff18f9bc200, 0xc208196480, 0xc2080d5860)
    /home/philip/build/src/github.com/influxdb/influxdb/services/httpd/handler.go:653 +0xd9
net/http.HandlerFunc.ServeHTTP(0xc2080dd6b0, 0x7ff18f9bc200, 0xc208196480, 0xc2080d5860)
    /usr/local/go/src/net/http/server.go:1265 +0x41
github.com/influxdb/influxdb/services/httpd.func·003(0x7ff18f9bc200, 0xc208196480, 0xc2080d5860)
    /home/philip/build/src/github.com/influxdb/influxdb/services/httpd/handler.go:669 +0xba
net/http.HandlerFunc.ServeHTTP(0xc20804a700, 0x7ff18f9bc200, 0xc208196480, 0xc2080d5860)
    /usr/local/go/src/net/http/server.go:1265 +0x41
github.com/influxdb/influxdb/services/httpd.func·004(0x7ff18f9bc200, 0xc208196480, 0xc2080d5860)
    /home/philip/build/src/github.com/influxdb/influxdb/services/httpd/handler.go:702 +0x31a
net/http.HandlerFunc.ServeHTTP(0xc2080dd6e0, 0x7ff18f9bc200, 0xc208196480, 0xc2080d5860)
    /usr/local/go/src/net/http/server.go:1265 +0x41
github.com/influxdb/influxdb/services/httpd.func·005(0x7ff18f9bc200, 0xc208196480, 0xc2080d5860)
    /home/philip/build/src/github.com/influxdb/influxdb/services/httpd/handler.go:712 +0x179
net/http.HandlerFunc.ServeHTTP(0xc2080dd700, 0x7ff18f9bc200, 0xc208196480, 0xc2080d5860)
    /usr/local/go/src/net/http/server.go:1265 +0x41
github.com/influxdb/influxdb/services/httpd.func·006(0x7ff18f9bc200, 0xc208196460, 0xc2080d5860)
    /home/philip/build/src/github.com/influxdb/influxdb/services/httpd/handler.go:720 +0x123
net/http.HandlerFunc.ServeHTTP(0xc20804a720, 0x7ff18f9bc200, 0xc208196460, 0xc2080d5860)
    /usr/local/go/src/net/http/server.go:1265 +0x41
github.com/influxdb/influxdb/services/httpd.func·007(0x7ff18f9bc1c8, 0xc2082a80a0, 0xc2080d5860)
    /home/philip/build/src/github.com/influxdb/influxdb/services/httpd/handler.go:730 +0x12c
net/http.HandlerFunc.ServeHTTP(0xc20804a740, 0x7ff18f9bc1c8, 0xc2082a80a0, 0xc2080d5860)
    /usr/local/go/src/net/http/server.go:1265 +0x41
github.com/bmizerany/pat.(*PatternServeMux).ServeHTTP(0xc2080362f8, 0x7ff18f9bc1c8, 0xc2082a80a0, 0xc2080d5860)
    /home/philip/build/src/github.com/bmizerany/pat/mux.go:109 +0x21c
github.com/influxdb/influxdb/services/httpd.(*Handler).ServeHTTP(0xc208010310, 0x7ff18f9bc1c8, 0xc2082a80a0, 0xc2080d5860)
    /home/philip/build/src/github.com/influxdb/influxdb/services/httpd/handler.go:166 +0x256
net/http.serverHandler.ServeHTTP(0xc2080e0300, 0x7ff18f9bc1c8, 0xc2082a80a0, 0xc2080d5860)
    /usr/local/go/src/net/http/server.go:1703 +0x19a
net/http.(*conn).serve(0xc2082a8000)
    /usr/local/go/src/net/http/server.go:1204 +0xb57
created by net/http.(*Server).Serve
    /usr/local/go/src/net/http/server.go:1751 +0x35e

The following command fails:

curl -i -XPOST 'http://192.168.101.11:8086/write?db=test' --data-binary "cpu_load_short,host=server01,region=us-west"
curl: (52) Empty reply from server

But this one is ok:

curl -i -XPOST 'http://192.168.101.11:8086/write?db=test' --data-binary "cpu_load_short,host=server01,region=us-west value=0.64"
HTTP/1.1 204 No Content
Request-Id: 32705619-2d10-11e5-8182-000000000000
X-Influxdb-Version: 0.9.1
Date: Sat, 18 Jul 2015 05:45:29 GMT
@beckettsean beckettsean added this to the 0.9.3 milestone Jul 20, 2015
@beckettsean
Copy link
Contributor

A point without a value is invalid, but it shouldn't panic the server.

@vbatoufflet
Copy link
Author

Yes of course, I understand it's invalid.

I just forgot to pass it through cURL and I was surprised that the routine paniced.

jwilder added a commit that referenced this issue Jul 21, 2015
Fixes #3379 - added check for no fields in point
@vbatoufflet
Copy link
Author

Thanks for the fix

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