Crash if uniform_bin MaxSize is not greater than MinSize#118
Merged
slfritchie merged 1 commit intomasterfrom Apr 23, 2014
Merged
Crash if uniform_bin MaxSize is not greater than MinSize#118slfritchie merged 1 commit intomasterfrom
slfritchie merged 1 commit intomasterfrom
Conversation
This makes the crashing easier to diagnose, as it will indicated an invalid generator was passed in. It's not 100% ideal, but most generators are complex and simple static validation is not enough. We can do a lot better but would probably require quite a bit more work
Contributor
|
@aggress I made some simple changes to improve in the situation for some generators that can be easily validated. I tried to do as much as I could without going into any major architectural changes, as general validation of functional values would take some time to get right. With this, these validators with simple numeric parameters will fail early with an "invalid generator" message pointing out the invalid value (though without a long explanation as to why it was incorrect). |
Contributor
|
Sorry this sat unattended for so long. +1, thanks! |
slfritchie
added a commit
that referenced
this pull request
Apr 23, 2014
Crash if uniform_bin MaxSize is not greater than MinSize
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If you try to run with {value_generator, {uniform_bin, 5000000, 5000000}}.
The following happens:
13:46:56.762 [debug] Driver basho_bench_driver_riakc_pb crashed: {function_clause,[{random,uniform,[0],[{file,"random.erl"},{line,111}]},{basho_bench_valgen,'-new/2-fun-5-',3,[{file,"src/basho_bench_valgen.erl"},{line,47}]},{basho_bench_driver_riakc_pb,run,4,[{file,"src/basho_bench_driver_riakc_pb.erl"},{line,170}]},{basho_bench_worker,worker_next_op2,2,[{file,"src/basho_bench_worker.erl"},{line,233}]},{basho_bench_worker,worker_next_op,1,[{file,"src/basho_bench_worker.erl"},{line,239}]},{basho_bench_worker,rate_worker_run_loop,2,[{file,"src/basho_bench_worker.erl"},{line,330}]}]}
13:46:56.762 [error] Worker <0.111.0> exited with crash
Suggest validating it before execution and warning end user