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

[0.9.1-2] WHERE regex within single quotes followed by LIMIT causes panic #3301

Closed
andrewpwade opened this issue Jul 12, 2015 · 7 comments
Closed
Milestone

Comments

@andrewpwade
Copy link

Version: 0.9.1-rc1-120-g29a34df (from nightly deb package).
OS: Ubuntu 14.04 64-bit

This query using the Influxdb web interface reliably crashes the program:

SELECT derivative(value) FROM "interface_rx" WHERE type = 'if_octets' AND instance =~ '/eth/' limit 2

If you remove the single quotes around the regex, it does not crash.

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x67f589]

goroutine 166 [running]:
github.com/influxdb/influxdb/influxql.CloneExpr(0x7f03736a50f0, 0x0, 0x0, 0x0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/influxql/ast.go:2252 +0xcc9
github.com/influxdb/influxdb/influxql.reduce(0x7f03736a50f0, 0x0, 0x7f037369f570, 0xc208636b60, 0x0, 0x0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/influxql/ast.go:2645 +0x196
github.com/influxdb/influxdb/influxql.reduceBinaryExpr(0xc20863e300, 0x7f037369f570, 0xc208636b60, 0x0, 0x0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/influxql/ast.go:2653 +0xcf
github.com/influxdb/influxdb/influxql.reduce(0x7f037369f168, 0xc20863e300, 0x7f037369f570, 0xc208636b60, 0x0, 0x0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/influxql/ast.go:2637 +0xe4
github.com/influxdb/influxdb/influxql.reduceBinaryExpr(0xc20863e2d0, 0x7f037369f570, 0xc208636b60, 0x0, 0x0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/influxql/ast.go:2653 +0xcf
github.com/influxdb/influxdb/influxql.reduce(0x7f037369f168, 0xc20863e2d0, 0x7f037369f570, 0xc208636b60, 0x0, 0x0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/influxql/ast.go:2637 +0xe4
github.com/influxdb/influxdb/influxql.Reduce(0x7f037369f168, 0xc20863e2d0, 0x7f037369f570, 0xc208636b60, 0x0, 0x0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/influxql/ast.go:2621 +0x58
github.com/influxdb/influxdb/influxql.(*Planner).Plan(0xc208636b40, 0xc2080e0000, 0x2710, 0x0, 0x0, 0x0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/influxql/engine.go:852 +0x170
github.com/influxdb/influxdb/tsdb.(*QueryExecutor).executeSelectStatement(0xc2080c3950, 0x0, 0xc2080e0000, 0xc2086276e0, 0x2710, 0x0, 0x0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/tsdb/query_executor.go:214 +0x175
github.com/influxdb/influxdb/tsdb.func·004()
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/tsdb/query_executor.go:149 +0x6bd
created by github.com/influxdb/influxdb/tsdb.(*QueryExecutor).ExecuteQuery
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/tsdb/query_executor.go:199 +0x1f5

goroutine 1 [chan receive (nil chan)]:
main.(*Main).Run(0xc2081b5f60, 0xc20800a010, 0x4, 0x4, 0x0, 0x0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/cmd/influxd/main.go:75 +0x450
main.main()
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/cmd/influxd/main.go:35 +0x1d3

goroutine 6 [syscall]:
os/signal.loop()
    /usr/local/go/src/os/signal/signal_unix.go:21 +0x1f
created by os/signal.init·1
    /usr/local/go/src/os/signal/signal_unix.go:27 +0x35

goroutine 9 [IO wait]:
net.(*pollDesc).Wait(0xc20800c450, 0x72, 0x0, 0x0)
    /usr/local/go/src/net/fd_poll_runtime.go:84 +0x47
net.(*pollDesc).WaitRead(0xc20800c450, 0x0, 0x0)
    /usr/local/go/src/net/fd_poll_runtime.go:89 +0x43
net.(*netFD).accept(0xc20800c3f0, 0x0, 0x7f0373696cc8, 0xc20802e348)
    /usr/local/go/src/net/fd_unix.go:419 +0x40b
net.(*TCPListener).AcceptTCP(0xc208036a28, 0xaf41b0, 0x0, 0x0)
    /usr/local/go/src/net/tcpsock_posix.go:234 +0x4e
net.(*TCPListener).Accept(0xc208036a28, 0x0, 0x0, 0x0, 0x0)
    /usr/local/go/src/net/tcpsock_posix.go:244 +0x4c
github.com/influxdb/influxdb/tcp.(*Mux).Serve(0xc2080c3c20, 0x7f0373698290, 0xc208036a28, 0x0, 0x0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/tcp/mux.go:45 +0x57
created by github.com/influxdb/influxdb/cmd/influxd/run.func·003
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/cmd/influxd/run/server.go:291 +0x7a8

goroutine 8 [chan receive]:
github.com/influxdb/influxdb/cmd/influxd/run.func·004()
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/cmd/influxd/run/server.go:462 +0xed
created by github.com/influxdb/influxdb/cmd/influxd/run.startProfile
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/cmd/influxd/run/server.go:465 +0x4d4

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:2232 +0x1

goroutine 10 [chan receive]:
github.com/influxdb/influxdb/tcp.(*listener).Accept(0xc208036a30, 0x0, 0x0, 0x0, 0x0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/tcp/mux.go:117 +0x80
github.com/influxdb/influxdb/meta.(*raftLayer).Accept(0xc2080c3c50, 0x0, 0x0, 0x0, 0x0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/meta/store.go:1817 +0x64
github.com/hashicorp/raft.(*NetworkTransport).listen(0xc20800c4d0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/hashicorp/raft/net_transport.go:346 +0x50
created by github.com/hashicorp/raft.NewNetworkTransport
    /tmp/tmp.LbwxI0GfS9/src/github.com/hashicorp/raft/net_transport.go:138 +0x2c4

goroutine 11 [select]:
github.com/hashicorp/raft.(*Raft).leaderLoop(0xc2080c01c0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/hashicorp/raft/raft.go:807 +0xc7c
github.com/hashicorp/raft.(*Raft).runLeader(0xc2080c01c0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/hashicorp/raft/raft.go:779 +0x74e
github.com/hashicorp/raft.(*Raft).run(0xc2080c01c0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/hashicorp/raft/raft.go:576 +0xc9
github.com/hashicorp/raft.*Raft.(github.com/hashicorp/raft.run)·fm()
    /tmp/tmp.LbwxI0GfS9/src/github.com/hashicorp/raft/raft.go:241 +0x27
github.com/hashicorp/raft.func·011()
    /tmp/tmp.LbwxI0GfS9/src/github.com/hashicorp/raft/state.go:152 +0x51
created by github.com/hashicorp/raft.(*raftState).goFunc
    /tmp/tmp.LbwxI0GfS9/src/github.com/hashicorp/raft/state.go:153 +0xe3

goroutine 12 [select]:
github.com/hashicorp/raft.(*Raft).runFSM(0xc2080c01c0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/hashicorp/raft/raft.go:490 +0xf74
github.com/hashicorp/raft.*Raft.(github.com/hashicorp/raft.runFSM)·fm()
    /tmp/tmp.LbwxI0GfS9/src/github.com/hashicorp/raft/raft.go:242 +0x27
github.com/hashicorp/raft.func·011()
    /tmp/tmp.LbwxI0GfS9/src/github.com/hashicorp/raft/state.go:152 +0x51
created by github.com/hashicorp/raft.(*raftState).goFunc
    /tmp/tmp.LbwxI0GfS9/src/github.com/hashicorp/raft/state.go:153 +0xe3

goroutine 13 [select]:
github.com/hashicorp/raft.(*Raft).runSnapshots(0xc2080c01c0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/hashicorp/raft/raft.go:1594 +0x466
github.com/hashicorp/raft.*Raft.(github.com/hashicorp/raft.runSnapshots)·fm()
    /tmp/tmp.LbwxI0GfS9/src/github.com/hashicorp/raft/raft.go:243 +0x27
github.com/hashicorp/raft.func·011()
    /tmp/tmp.LbwxI0GfS9/src/github.com/hashicorp/raft/state.go:152 +0x51
created by github.com/hashicorp/raft.(*raftState).goFunc
    /tmp/tmp.LbwxI0GfS9/src/github.com/hashicorp/raft/state.go:153 +0xe3

goroutine 15 [chan receive]:
github.com/influxdb/influxdb/tcp.(*listener).Accept(0xc208036a38, 0x0, 0x0, 0x0, 0x0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/tcp/mux.go:117 +0x80
github.com/influxdb/influxdb/meta.(*Store).serveExecListener(0xc208072000)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/meta/store.go:467 +0x8f
created by github.com/influxdb/influxdb/meta.(*Store).Open
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/meta/store.go:205 +0x1c2

goroutine 16 [select]:
github.com/influxdb/influxdb/cmd/influxd/run.(*Server).monitorErrorChan(0xc208032410, 0xc208044420)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/cmd/influxd/run/server.go:413 +0x14a
created by github.com/influxdb/influxdb/cmd/influxd/run.func·003
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/cmd/influxd/run/server.go:297 +0x919

goroutine 18 [select]:
github.com/influxdb/influxdb/tsdb.(*Shard).autoflusher(0xc208030210, 0xc208149620)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/tsdb/shard.go:453 +0x39d
created by github.com/influxdb/influxdb/tsdb.func·008
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/tsdb/shard.go:149 +0x611

goroutine 19 [select]:
github.com/influxdb/influxdb/services/hh.(*Service).retryWrites(0xc208071360)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/hh/service.go:98 +0x2e7
created by github.com/influxdb/influxdb/services/hh.(*Service).Open
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/hh/service.go:62 +0xef

goroutine 20 [select]:
github.com/influxdb/influxdb/services/hh.(*Service).expireWrites(0xc208071360)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/hh/service.go:116 +0x2a4
created by github.com/influxdb/influxdb/services/hh.(*Service).Open
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/hh/service.go:63 +0x109

goroutine 21 [chan receive]:
github.com/influxdb/influxdb/tcp.(*listener).Accept(0xc208036a40, 0x0, 0x0, 0x0, 0x0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/tcp/mux.go:117 +0x80
github.com/influxdb/influxdb/cluster.(*Service).serve(0xc20800c2a0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/cluster/service.go:79 +0x102
created by github.com/influxdb/influxdb/cluster.(*Service).Open
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/cluster/service.go:56 +0x67

goroutine 22 [select]:
github.com/influxdb/influxdb/services/precreator.(*Service).runPrecreation(0xc20800ad70)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/precreator/service.go:72 +0x407
created by github.com/influxdb/influxdb/services/precreator.(*Service).Open
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/precreator/service.go:50 +0xcb

goroutine 23 [chan receive]:
github.com/influxdb/influxdb/tcp.(*listener).Accept(0xc208036a48, 0x0, 0x0, 0x0, 0x0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/tcp/mux.go:117 +0x80
github.com/influxdb/influxdb/services/snapshotter.(*Service).serve(0xc20800ae60)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/snapshotter/service.go:68 +0xad
created by github.com/influxdb/influxdb/services/snapshotter.(*Service).Open
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/snapshotter/service.go:46 +0x62

goroutine 24 [IO wait]:
net.(*pollDesc).Wait(0xc208216060, 0x72, 0x0, 0x0)
    /usr/local/go/src/net/fd_poll_runtime.go:84 +0x47
net.(*pollDesc).WaitRead(0xc208216060, 0x0, 0x0)
    /usr/local/go/src/net/fd_poll_runtime.go:89 +0x43
net.(*netFD).accept(0xc208216000, 0x0, 0x7f0373696cc8, 0xc208112da0)
    /usr/local/go/src/net/fd_unix.go:419 +0x40b
net.(*TCPListener).AcceptTCP(0xc208036028, 0xc20801e700, 0x0, 0x0)
    /usr/local/go/src/net/tcpsock_posix.go:234 +0x4e
net.(*TCPListener).Accept(0xc208036028, 0x0, 0x0, 0x0, 0x0)
    /usr/local/go/src/net/tcpsock_posix.go:244 +0x4c
net/http.(*Server).Serve(0xc2081947e0, 0x7f0373698290, 0xc208036028, 0x0, 0x0)
    /usr/local/go/src/net/http/server.go:1728 +0x92
net/http.Serve(0x7f0373698290, 0xc208036028, 0x7f037369e9d0, 0xc208112d90, 0x0, 0x0)
    /usr/local/go/src/net/http/server.go:1606 +0xa1
github.com/influxdb/influxdb/services/admin.(*Service).serve(0xc2080c3a40)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/admin/service.go:71 +0x147
created by github.com/influxdb/influxdb/services/admin.(*Service).Open
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/admin/service.go:39 +0xd9

goroutine 25 [select]:
github.com/influxdb/influxdb/services/continuous_querier.(*Service).backgroundLoop(0xc20800c310)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/continuous_querier/service.go:151 +0x301
created by github.com/influxdb/influxdb/services/continuous_querier.(*Service).Open
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/continuous_querier/service.go:87 +0x1ed

goroutine 26 [IO wait]:
net.(*pollDesc).Wait(0xc208217170, 0x72, 0x0, 0x0)
    /usr/local/go/src/net/fd_poll_runtime.go:84 +0x47
net.(*pollDesc).WaitRead(0xc208217170, 0x0, 0x0)
    /usr/local/go/src/net/fd_poll_runtime.go:89 +0x43
net.(*netFD).accept(0xc208217110, 0x0, 0x7f0373696cc8, 0xc2082c4758)
    /usr/local/go/src/net/fd_unix.go:419 +0x40b
net.(*TCPListener).AcceptTCP(0xc208036030, 0xc208062dc8, 0x0, 0x0)
    /usr/local/go/src/net/tcpsock_posix.go:234 +0x4e
net.(*TCPListener).Accept(0xc208036030, 0x0, 0x0, 0x0, 0x0)
    /usr/local/go/src/net/tcpsock_posix.go:244 +0x4c
net/http.(*Server).Serve(0xc208194960, 0x7f0373698290, 0xc208036030, 0x0, 0x0)
    /usr/local/go/src/net/http/server.go:1728 +0x92
net/http.Serve(0x7f0373698290, 0xc208036030, 0x7f037369e9f8, 0xc20800c380, 0x0, 0x0)
    /usr/local/go/src/net/http/server.go:1606 +0xa1
github.com/influxdb/influxdb/services/httpd.(*Service).serve(0xc208091780)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/httpd/service.go:83 +0x79
created by github.com/influxdb/influxdb/services/httpd.(*Service).Open
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/httpd/service.go:51 +0x283

goroutine 62 [select]:
github.com/influxdb/influxdb/services/retention.(*Service).deleteShards(0xc2080449c0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/retention/service.go:101 +0x821
created by github.com/influxdb/influxdb/services/retention.(*Service).Open
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/retention/service.go:45 +0x81

goroutine 58 [select]:
github.com/influxdb/influxdb/tsdb.func·002()
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/tsdb/batcher.go:69 +0x51f
created by github.com/influxdb/influxdb/tsdb.(*PointBatcher).Start
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/tsdb/batcher.go:104 +0x29a

goroutine 61 [select]:
github.com/influxdb/influxdb/services/retention.(*Service).deleteShardGroups(0xc2080449c0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/retention/service.go:67 +0x433
created by github.com/influxdb/influxdb/services/retention.(*Service).Open
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/retention/service.go:44 +0x67

goroutine 60 [select]:
github.com/influxdb/influxdb/services/collectd.(*Service).writePoints(0xc2080aca80)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/collectd/service.go:210 +0x3d3
created by github.com/influxdb/influxdb/services/collectd.(*Service).Open
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/collectd/service.go:111 +0xc45

goroutine 59 [IO wait]:
net.(*pollDesc).Wait(0xc208180ca0, 0x72, 0x0, 0x0)
    /usr/local/go/src/net/fd_poll_runtime.go:84 +0x47
net.(*pollDesc).WaitRead(0xc208180ca0, 0x0, 0x0)
    /usr/local/go/src/net/fd_poll_runtime.go:89 +0x43
net.(*netFD).readFrom(0xc208180c40, 0xc208336000, 0x5ac, 0x5ac, 0x0, 0x0, 0x0, 0x7f0373696cc8, 0xc20862fbe8)
    /usr/local/go/src/net/fd_unix.go:269 +0x4a1
net.(*UDPConn).ReadFromUDP(0xc208036fe8, 0xc208336000, 0x5ac, 0x5ac, 0x538, 0x0, 0x0, 0x0)
    /usr/local/go/src/net/udpsock_posix.go:67 +0x124
github.com/influxdb/influxdb/services/collectd.(*Service).serve(0xc2080aca80)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/collectd/service.go:181 +0x113
created by github.com/influxdb/influxdb/services/collectd.(*Service).Open
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/collectd/service.go:110 +0xc28

goroutine 64 [select]:
github.com/influxdb/influxdb/cmd/influxd/run.(*Command).monitorServerErrors(0xc2080443c0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/cmd/influxd/run/command.go:121 +0x2da
created by github.com/influxdb/influxdb/cmd/influxd/run.(*Command).Run
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/cmd/influxd/run/command.go:105 +0xbb4

goroutine 140 [IO wait]:
net.(*pollDesc).Wait(0xc2082db090, 0x72, 0x0, 0x0)
    /usr/local/go/src/net/fd_poll_runtime.go:84 +0x47
net.(*pollDesc).WaitRead(0xc2082db090, 0x0, 0x0)
    /usr/local/go/src/net/fd_poll_runtime.go:89 +0x43
net.(*netFD).Read(0xc2082db030, 0xc2081ae000, 0x1000, 0x1000, 0x0, 0x7f0373696cc8, 0xc2082c3d40)
    /usr/local/go/src/net/fd_unix.go:242 +0x40f
net.(*conn).Read(0xc2082523c8, 0xc2081ae000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
    /usr/local/go/src/net/net.go:121 +0xdc
net/http.(*liveSwitchReader).Read(0xc208070548, 0xc2081ae000, 0x1000, 0x1000, 0xc207fd9ac7, 0x0, 0x0)
    /usr/local/go/src/net/http/server.go:214 +0xab
io.(*LimitedReader).Read(0xc2082643e0, 0xc2081ae000, 0x1000, 0x1000, 0xc2082c3a10, 0x0, 0x0)
    /usr/local/go/src/io/io.go:408 +0xce
bufio.(*Reader).fill(0xc208242a20)
    /usr/local/go/src/bufio/bufio.go:97 +0x1ce
bufio.(*Reader).ReadSlice(0xc208242a20, 0xc055bf892181c60a, 0x0, 0x0, 0x0, 0x0, 0x0)
    /usr/local/go/src/bufio/bufio.go:295 +0x257
bufio.(*Reader).ReadLine(0xc208242a20, 0x0, 0x0, 0x0, 0xc207fe6e00, 0x0, 0x0)
    /usr/local/go/src/bufio/bufio.go:324 +0x62
net/textproto.(*Reader).readLineSlice(0xc2081915f0, 0x0, 0x0, 0x0, 0x0, 0x0)
    /usr/local/go/src/net/textproto/reader.go:55 +0x9e
net/textproto.(*Reader).ReadLine(0xc2081915f0, 0x0, 0x0, 0x0, 0x0)
    /usr/local/go/src/net/textproto/reader.go:36 +0x4f
net/http.ReadRequest(0xc208242a20, 0xc208188270, 0x0, 0x0)
    /usr/local/go/src/net/http/request.go:598 +0xcb
net/http.(*conn).readRequest(0xc208070500, 0x0, 0x0, 0x0)
    /usr/local/go/src/net/http/server.go:586 +0x26f
net/http.(*conn).serve(0xc208070500)
    /usr/local/go/src/net/http/server.go:1162 +0x69e
created by net/http.(*Server).Serve
    /usr/local/go/src/net/http/server.go:1751 +0x35e

goroutine 63 [chan receive]:
github.com/influxdb/influxdb/cmd/influxd/run.(*Server).startServerReporting(0xc208032410)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/cmd/influxd/run/server.go:364 +0x18e
created by github.com/influxdb/influxdb/cmd/influxd/run.func·003
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/cmd/influxd/run/server.go:320 +0xdbb

goroutine 68 [chan receive]:
github.com/influxdb/influxdb/services/httpd.(*Handler).serveQuery(0xc20800c380, 0x7f037369ef80, 0xc208636960, 0xc20811c0d0, 0x0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/httpd/handler.go:241 +0x7c4
github.com/influxdb/influxdb/services/httpd.*Handler.(github.com/influxdb/influxdb/services/httpd.serveQuery)·fm(0x7f037369ef80, 0xc208636960, 0xc20811c0d0, 0x0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/httpd/handler.go:90 +0x4f
github.com/influxdb/influxdb/services/httpd.func·001(0x7f037369ef80, 0xc208636960, 0xc20811c0d0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/httpd/handler.go:602 +0x78
net/http.HandlerFunc.ServeHTTP(0xc20808d640, 0x7f037369ef80, 0xc208636960, 0xc20811c0d0)
    /usr/local/go/src/net/http/server.go:1265 +0x41
github.com/influxdb/influxdb/services/httpd.func·002(0x7f037369eea8, 0xc2086368c0, 0xc20811c0d0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/httpd/handler.go:660 +0x288
net/http.HandlerFunc.ServeHTTP(0xc208029f20, 0x7f037369eea8, 0xc2086368c0, 0xc20811c0d0)
    /usr/local/go/src/net/http/server.go:1265 +0x41
github.com/influxdb/influxdb/services/httpd.func·003(0x7f037369eea8, 0xc2086368c0, 0xc20811c0d0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/httpd/handler.go:669 +0xba
net/http.HandlerFunc.ServeHTTP(0xc20808d660, 0x7f037369eea8, 0xc2086368c0, 0xc20811c0d0)
    /usr/local/go/src/net/http/server.go:1265 +0x41
github.com/influxdb/influxdb/services/httpd.func·004(0x7f037369eea8, 0xc2086368c0, 0xc20811c0d0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/httpd/handler.go:702 +0x31a
net/http.HandlerFunc.ServeHTTP(0xc208029f80, 0x7f037369eea8, 0xc2086368c0, 0xc20811c0d0)
    /usr/local/go/src/net/http/server.go:1265 +0x41
github.com/influxdb/influxdb/services/httpd.func·005(0x7f037369eea8, 0xc2086368c0, 0xc20811c0d0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/httpd/handler.go:712 +0x179
net/http.HandlerFunc.ServeHTTP(0xc208029fb0, 0x7f037369eea8, 0xc2086368c0, 0xc20811c0d0)
    /usr/local/go/src/net/http/server.go:1265 +0x41
github.com/influxdb/influxdb/services/httpd.func·006(0x7f037369eea8, 0xc2086368a0, 0xc20811c0d0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/httpd/handler.go:720 +0x123
net/http.HandlerFunc.ServeHTTP(0xc20808d680, 0x7f037369eea8, 0xc2086368a0, 0xc20811c0d0)
    /usr/local/go/src/net/http/server.go:1265 +0x41
github.com/influxdb/influxdb/services/httpd.func·007(0x7f037369ee70, 0xc2080708c0, 0xc20811c0d0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/httpd/handler.go:730 +0x12c
net/http.HandlerFunc.ServeHTTP(0xc20808d6a0, 0x7f037369ee70, 0xc2080708c0, 0xc20811c0d0)
    /usr/local/go/src/net/http/server.go:1265 +0x41
github.com/bmizerany/pat.(*PatternServeMux).ServeHTTP(0xc208036948, 0x7f037369ee70, 0xc2080708c0, 0xc20811c0d0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/bmizerany/pat/mux.go:109 +0x21c
github.com/influxdb/influxdb/services/httpd.(*Handler).ServeHTTP(0xc20800c380, 0x7f037369ee70, 0xc2080708c0, 0xc20811c0d0)
    /tmp/tmp.LbwxI0GfS9/src/github.com/influxdb/influxdb/services/httpd/handler.go:166 +0x256
net/http.serverHandler.ServeHTTP(0xc208194960, 0x7f037369ee70, 0xc2080708c0, 0xc20811c0d0)
    /usr/local/go/src/net/http/server.go:1703 +0x19a
net/http.(*conn).serve(0xc2080712c0)
    /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

goroutine 84 [IO wait]:
net.(*pollDesc).Wait(0xc20829d480, 0x72, 0x0, 0x0)
    /usr/local/go/src/net/fd_poll_runtime.go:84 +0x47
net.(*pollDesc).WaitRead(0xc20829d480, 0x0, 0x0)
    /usr/local/go/src/net/fd_poll_runtime.go:89 +0x43
net.(*netFD).Read(0xc20829d420, 0xc20829b000, 0x1000, 0x1000, 0x0, 0x7f0373696cc8, 0xc208159420)
    /usr/local/go/src/net/fd_unix.go:242 +0x40f
net.(*conn).Read(0xc208036128, 0xc20829b000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
    /usr/local/go/src/net/net.go:121 +0xdc
net/http.(*liveSwitchReader).Read(0xc2080709a8, 0xc20829b000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
    /usr/local/go/src/net/http/server.go:214 +0xab
io.(*LimitedReader).Read(0xc2080e3120, 0xc20829b000, 0x1000, 0x1000, 0xc2080a7940, 0x0, 0x0)
    /usr/local/go/src/io/io.go:408 +0xce
bufio.(*Reader).fill(0xc208194a20)
    /usr/local/go/src/bufio/bufio.go:97 +0x1ce
bufio.(*Reader).ReadSlice(0xc208194a20, 0xa, 0x0, 0x0, 0x0, 0x0, 0x0)
    /usr/local/go/src/bufio/bufio.go:295 +0x257
bufio.(*Reader).ReadLine(0xc208194a20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
    /usr/local/go/src/bufio/bufio.go:324 +0x62
net/textproto.(*Reader).readLineSlice(0xc208190db0, 0x0, 0x0, 0x0, 0x0, 0x0)
    /usr/local/go/src/net/textproto/reader.go:55 +0x9e
net/textproto.(*Reader).ReadLine(0xc208190db0, 0x0, 0x0, 0x0, 0x0)
    /usr/local/go/src/net/textproto/reader.go:36 +0x4f
net/http.ReadRequest(0xc208194a20, 0xc20811c270, 0x0, 0x0)
    /usr/local/go/src/net/http/request.go:598 +0xcb
net/http.(*conn).readRequest(0xc208070960, 0x0, 0x0, 0x0)
    /usr/local/go/src/net/http/server.go:586 +0x26f
net/http.(*conn).serve(0xc208070960)
    /usr/local/go/src/net/http/server.go:1162 +0x69e
created by net/http.(*Server).Serve
    /usr/local/go/src/net/http/server.go:1751 +0x35e
@andrewpwade andrewpwade changed the title WHERE regex with strings causes "runtime error: invalid memory address or nil pointer dereference" WHERE regex with quotes causes "runtime error: invalid memory address or nil pointer dereference" Jul 13, 2015
@beckettsean
Copy link
Contributor

@andrewpwade In your schema, is instance a tag or a field?

If you remove the single quotes you said it doesn't crash. What does it return?

@beckettsean beckettsean changed the title WHERE regex with quotes causes "runtime error: invalid memory address or nil pointer dereference" [0.9.1-2] WHERE regex with quotes causes "runtime error: invalid memory address or nil pointer dereference" Jul 14, 2015
@andrewpwade
Copy link
Author

Without the single quotes, I belive rows with the expected data were returned. This was on a VM I don't have access to right now to check.

I don't understand Influxdb enough to say whether it's a tag vs a field, sorry. If it helps, the schema comes from collectd's network plugin writing to Influxdb's collectd plugin.

@beckettsean
Copy link
Contributor

Adding single quotes around the regex renders it a simple string, not a regular expression. It's not acceptable that the db panicked but bad syntax can do that.

It doesn't appear to crash in 0.9.1, this might be new behavior in the 0.9.2 pre-release nightlies:

> select * from "hello spaces my oldfriend" where foo =~ /b/
name: hello spaces my oldfriend
tags: foo=bar
time                value
----                -----
2015-07-14T00:27:16.15776629Z   3

> select * from "hello spaces my oldfriend" where foo =~ '/b/'
ERR: error parsing query: found /b/, expected SELECT, DELETE, SHOW, CREATE, DROP, GRANT, REVOKE, ALTER, SET at line 1, char 55

@beckettsean beckettsean changed the title [0.9.1-2] WHERE regex with quotes causes "runtime error: invalid memory address or nil pointer dereference" [0.9.1-2] (regression) WHERE regex within single quotes causes panic Jul 14, 2015
@beckettsean beckettsean added this to the 0.9.2 milestone Jul 14, 2015
@rnubel
Copy link
Contributor

rnubel commented Jul 16, 2015

I'm able to reproduce this, but a key element of the problem is that the improper string literal needs to be followed by the LIMIT clause (or something along those lines -- I haven't exhaustively tested what works and what doesn't). That is, only the last of these queries causes the panic:

> SELECT * FROM cpu WHERE value = 0 AND region =~ 'adf';
ERR: error parsing query: found adf, expected SELECT, DELETE, SHOW, CREATE, DROP, GRANT, REVOKE, ALTER, SET at line 1, char 48
> SELECT * FROM cpu WHERE value = 0 AND region =~ 'adf' AND region=2;
ERR: error parsing query: found 2, expected SELECT, DELETE, SHOW, CREATE, DROP, GRANT, REVOKE, ALTER, SET at line 1, char 66
> SELECT * FROM cpu WHERE value = 0 AND region =~ 'adf' LIMIT 2;
ERR: Get http://localhost:8086/query?db=mydb&q=SELECT+%2A+FROM+cpu+WHERE+value+%3D+0+AND+region+%3D~+%27adf%27+LIMIT+2%3B: EOF

Also, I can reproduce the above failure on v0.9.1 as well as HEAD. I'm going to take a stab at writing a test and a fix for this.

@beckettsean
Copy link
Contributor

Excellent sleuthing @rnubel! It does seem like a well-bounded problem, we eagerly await your PR.

@beckettsean beckettsean changed the title [0.9.1-2] (regression) WHERE regex within single quotes causes panic [0.9.1-2] (regression) WHERE regex within single quotes followed by LIMIT causes panic Jul 16, 2015
@beckettsean beckettsean changed the title [0.9.1-2] (regression) WHERE regex within single quotes followed by LIMIT causes panic [0.9.1-2] WHERE regex within single quotes followed by LIMIT causes panic Jul 16, 2015
@rnubel
Copy link
Contributor

rnubel commented Jul 16, 2015

#3351 contains my fix 😄

@otoolep
Copy link
Contributor

otoolep commented Jul 21, 2015

Confirmed, I can't repro this on master. Appears fixed by #3351

Thanks again @rnubel.

@otoolep otoolep closed this as completed Jul 21, 2015
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

4 participants