Skip to content

Crash if uniform_bin MaxSize is not greater than MinSize#118

Merged
slfritchie merged 1 commit intomasterfrom
bugfix/validate-early
Apr 23, 2014
Merged

Crash if uniform_bin MaxSize is not greater than MinSize#118
slfritchie merged 1 commit intomasterfrom
bugfix/validate-early

Conversation

@engelsanchez
Copy link
Copy Markdown
Contributor

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

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
@engelsanchez
Copy link
Copy Markdown
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).

@slfritchie
Copy link
Copy Markdown
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
@slfritchie slfritchie merged commit f7cc1d5 into master Apr 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants