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

Trying to insert a number larger than the largest signed 64-bit number kills influxd #3127

Closed
desa opened this issue Jun 24, 2015 · 2 comments · Fixed by #3140
Closed

Trying to insert a number larger than the largest signed 64-bit number kills influxd #3127

desa opened this issue Jun 24, 2015 · 2 comments · Fixed by #3140
Assignees

Comments

@desa
Copy link
Contributor

desa commented Jun 24, 2015

On OSX with influx version 0.9 built from source

Running the command

curl -i -XPOST 'http://localhost:8086/write?db=mydb' -d 'test value=9223372036854775808'

kills influxd

@beckettsean
Copy link
Contributor

@mjdesa what's the actual panic message in the logs?

Seems like the database should issue an error on the write that some values are out of bounds. @dgnorton @otoolep do we not have boundary checks on writes?

@desa
Copy link
Contributor Author

desa commented Jun 24, 2015

@beckettsean

panic: unable to parse number value '9223372036854775808': strconv.ParseInt: parsing "9223372036854775808": value out of range

@jwilder jwilder self-assigned this Jun 24, 2015
jwilder added a commit that referenced this issue Jun 25, 2015
Field values that were out of range for the type would panic the database
when being inserted because the parser would allow them as valid points.
This change prevents those invalid values from being parsed and instead
returns an error.

An alternative fix considered was to handle the error and clamp the value
to the min/max value for the type.  This would treat numeric range errors
slightly differently than other type erros which might lead to confusion.

The simplest fix with the current parser would be to just convert each field
to the type at parse time.  Unfortunately, this adds extra memory allocations
and lowers throughput significantly.  Since out of range values are less common
than in-range values, some heuristics are used to determine when the more
expensive type parsing and range checking is performed.  Essentially, we only
do the slow path when we cannot determine that the value is in an acceptable
type range.

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

Successfully merging a pull request may close this issue.

3 participants