influxdb/influxdb — pull request #413 by jvshahid (2014-04-08 20:06:44+00:00)
Title:  runtime error: integer divide by zero.

After creating a lot of continues queries, I keep getting lots of "divide by zero" messages.

```
********************************BUG********************************
Database: tracking
Query: [SELECT MEDIAN(total) as total, MEDIAN(total_kB) as total_kB, MEDIAN(uptime) as uptime, MEDIAN(reqs) as reqs, MEDIAN(bytes_per_sec) as bytes_per_sec, MEDIAN(bytes_per_req) as bytes_per_req, MEDIAN(busy_workers) as busy_workers, MEDIAN(idle_workers) as idle_workers FROM /^project.(\d+)\.apache\.16.*/ GROUP BY time(1440) where time > 1396863886702460u and time < 1396863887702444u]
Error: runtime error: integer divide by zero. Stacktrace: goroutine 18 [running]:
common.RecoverFunc(0xc222cd7aa0, 0x8, 0xc212ff5000, 0x17b, 0x0)
/home/vagrant/influxdb/src/common/recover.go:13 +0x106
runtime.panic(0x884c40, 0x1004a9d)
/home/vagrant/bin/go/src/pkg/runtime/panic.c:248 +0x106
cluster.(*ShardData).QueryResponseBufferSize(0xc210134460, 0xc21064eaa0, 0x64, 0x0)
/home/vagrant/influxdb/src/cluster/shard.go:361 +0x12d
coordinator.(*CoordinatorImpl).queryShards(0xc2100c88c0, 0xc21064eaa0, 0xc2209d20f0, 0x1, 0x1, ...)
/home/vagrant/influxdb/src/coordinator/coordinator.go:374 +0x111
coordinator.(*CoordinatorImpl).runQuerySpec(0xc2100c88c0, 0xc21064eaa0, 0x7fc57c0a7678, 0xc22dd08fc8, 0x0, ...)
/home/vagrant/influxdb/src/coordinator/coordinator.go:414 +0x440
coordinator.(*CoordinatorImpl).runQuery(0xc2100c88c0, 0xc21cf602c0, 0x7fc57c0a7620, 0xc2100d8000, 0xc222cd7aa0, ...)
/home/vagrant/influxdb/src/coordinator/coordinator.go:146 +0xdb
coordinator.(*CoordinatorImpl).RunQuery(0xc2100c88c0, 0x7fc57c0a7620, 0xc2100d8000, 0xc222cd7aa0, 0x8, ...)
/home/vagrant
```

I suspect the query doesn't return any data, hence some calculactions afterwards seem to fail.