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: division by zero #542

Closed
tamsky opened this issue May 15, 2014 · 8 comments
Closed

runtime error: division by zero #542

tamsky opened this issue May 15, 2014 · 8 comments
Milestone

Comments

@tamsky
Copy link

tamsky commented May 15, 2014

Running influxdb-0.6.3-1.x86_64.rpm in a single node configuration.

[2014/05/14 20:09:34 EDT] [INFO] (coordinator.(*CoordinatorImpl).RunQuery:69) Query: db: mondemand, u: root, q: SELECT blank_response.value / request.value FROM blank_response INNER JOIN request LIMIT 10
********************************BUG********************************
Database: mondemand
Query: [select blank_response.value / request.value from blank_response inner join request limit 10]
Error: runtime error: integer divide by zero. Stacktrace: goroutine 3795 [running]:
common.RecoverFunc(0xc218219146, 0x9, 0xc21eb9cb60, 0x67, 0x7faac4f92e78)
        /home/vagrant/influxdb/src/common/recover.go:13 +0x106
runtime.panic(0x889520, 0x100ae7d)
        /home/vagrant/bin/go/src/pkg/runtime/panic.c:248 +0x106
engine.DivideOperator(0xc2157ebd10, 0x2, 0x2, 0xc2200e4100, 0x2, ...)
        /home/vagrant/influxdb/src/engine/arithmetic.go:127 +0x21a
engine.GetValue(0xc214b87550, 0xc2200e4100, 0x2, 0x2, 0xc214dca100, ...)
        /home/vagrant/influxdb/src/engine/arithmetic.go:37 +0x538
engine.func·012(0xc220395af0, 0xc220395af0, 0xc220395af0)
        /home/vagrant/influxdb/src/engine/engine.go:644 +0x376
engine.func·014(0xc220395aa0, 0xc220eefe00, 0x1)
        /home/vagrant/influxdb/src/engine/merge.go:57 +0x8cb
engine.(*mergeState).yieldNextPoints(0xc21c759630, 0xc214b87870, 0x0, 0x0)
        /home/vagrant/influxdb/src/engine/merge.go:193 +0x23d
engine.func·016(0xc218fe78c0, 0x7c9d80, 0xc21c759570)
        /home/vagrant/influxdb/src/engine/merge.go:279 +0x9c
engine.(*QueryEngine).yieldSeriesData(0xc2126dc460, 0xc2
[2014/05/14 20:09:34 EDT] [EROR] (coordinator.(*CoordinatorImpl).readFromResponseChannels:345) Error while executing query: Internal Error
[2014/05/14 20:09:39 EDT] [INFO] (wal.(*WAL).RecoverServerFromRequestNumber:197) /opt/influxdb/shared/data/wal/log.6780002 yielded 10000 requests
[2014/05/14 20:09:39 EDT] [INFO] (wal.(*WAL).RecoverServerFromRequestNumber:191) Replaying from /opt/influxdb/shared/data/wal/log.6790002:-1
[2014/05/14 20:09:39 EDT] [INFO] (wal.(*log).replayFromFileLocation:227) replaying from file location 0
[2014/05/14 20:09:39 EDT] [INFO] (wal.(*WAL).processCommitEntry:344) Deleting /opt/influxdb/shared/data/wal/log.6780002

Possibly related #413 but not sure.

@jvshahid
Copy link
Contributor

It's not really clear whether this is a data issue or a bug. I also don't think it's related to #413, you are doing division in the query which could cause a divide by zero error. You should be able to do select blank_response.value / request.value from blank_response inner join request where request.value <> 0 limit 10 once #524 is fixed. This will filter out 0 values from the denominator

@tamsky
Copy link
Author

tamsky commented May 15, 2014

What math library does influxdb use?

Instead of forcing the query side to work harder,
any chance we can support division-by-zero using IEEE-754 style ±Infinity?

How does influx currently handle

  • results that overflow?
  • invalid results; eg. sqrt(-1) == ±NaN ?

@jvshahid
Copy link
Contributor

Even if that was possible, json doesn't support infinity or nan, at least not in a standard way

@tamsky
Copy link
Author

tamsky commented May 16, 2014

For the moment, assume I use your approach, filter zero values from the denominator at query time.
Will I see a result for time windows where there is a non-zero numerator and a filtered-away denominator?

Perhaps this could be a configurable command line parameter/value that allows users to declare a (text) substitute for the output of division by zero?

("1.0e5000" would appear to overflow even an implementation that uses 128bit float.) [1]

[1] http://stackoverflow.com/questions/1423081/json-left-out-infinity-and-nan-json-status-in-ecmascript#comment17240692_9356535

@jvshahid jvshahid added this to the 0.7.0 milestone May 20, 2014
@jvshahid
Copy link
Contributor

Closing this issue since #524 is closed. The fix will be included in the next release.

@tamsky
Copy link
Author

tamsky commented May 20, 2014

If my questions are not appropriate to discuss here, a better venue is...

@damm
Copy link

damm commented May 21, 2014

@tamsky I think https://groups.google.com/forum/#!forum/influxdb works (or irc)

@tamsky
Copy link
Author

tamsky commented May 23, 2014

@pauldix - Can we output null as the result of division-by-zero ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants