basho / basho_bench

A load-generation and testing tool for basically whatever you can write a returning Erlang function for.
Apache License 2.0
311 stars 197 forks source link

Fixing the bad argument error in basho_bench_valgen.erl #181

Closed l1x closed 9 years ago

l1x commented 9 years ago

I am not sure what was the intention here but when I checkout master and start up a http test I got the following:

21:06:26.020 [error] Failed to initialize driver basho_bench_driver_http: {'EXIT',{badarg,[{ets,new
,[valgen_bin_tab,[public,named_table]],[]},{basho_bench_valgen,init_source,2,[{file,"src/basho_bench_valgen.erl"},{line,93}]},{basho_be
nch_valgen,new,2,[{file,"src/basho_bench_valgen.erl"},{line,35}]},{basho_bench_driver_http,build_generators,3,[{file,"src/basho_bench_d
river_http.erl"},{line,147}]},{basho_bench_driver_http,new,1,[{file,"src/basho_bench_driver_http.erl"},{line,69}]},{basho_bench_worker,
worker_idle_loop,1,[{file,"src/basho_bench_worker.erl"},{line,222}]}]}}

I replaced the ets:new() with

    case ets:info(?TAB) of
      undefined  -> ets:new(?TAB, [public, named_table]);
      _ -> ok
    end,

The problem went away.

Am I doing something crazy in my http config to trigger this? I use a simple http with a simple get.

l1x commented 9 years ago

Additional info:

Config:

{mode, max}.
{duration, 1}.
{concurrent, 1}.
{driver, basho_bench_driver_http}.
{key_generator, {int_to_str, {partitioned_sequential_int, 50000}}}.
{value_generator, {fixed_bin, 10000}}.
{generators, [
              {string_g, {key_generator, {int_to_str, {uniform_int, 50000}}}},
              {binstring_g, {value_generator, {fixed_bin, 100}}}
             ]}.
{values, [
          {json_v, {"{\"this\":\"is_json_~s\"}", [string_g]}},
          {xml_v, {"<?xml version=\"1.0\"?><catalog><book><author>~s</author></book></catalog>", [binstring_g]}},
          {plainstring_v, "hello"},
          {smallbin_v, binstring_g},
          {largebin_v, value_generator}
         ]}.
{headers, [
           {json_h, [{'Content-Type', 'application/json'}, {'Accept', 'application/json'}]},
           {xml_h, [{'Content-Type', 'application/xml'}]},
           {binary_h, [{'Content-Type', 'application/octet-stream'}]},
           {empty_h, []}
          ]}.
{targets, [
           {base_uri_t, {"localhost", 8080, "/echo"}},
           {multi_base_uri_t, [{"localhost", 4567, "/"},{"localhost", 4568, "/"}]},
           {with_key_t, {"localhost", 4567, {"/~s", [key_generator]}}},
           {multi_with_key_t, [{"localhost", 4567, {"/~s", [key_generator]}},{"localhost", 4568, {"/~s", [key_generator]}}]},
           {with_another_key_t, {"localhost", 4567, {"/another/~s", [string_g]}}},
           {smallbin_t, {"localhost", 4567, {"/smallbin/~s", [key_generator]}}},
           {upload_t, {"localhost", 4567, {"/upload/~s", [key_generator]}}}
          ]}.
{operations, [
              {{get, base_uri_t}, 1}
             ]}.

Running basho_bench:

./basho_bench configs/http.config
slfritchie commented 9 years ago

Hi, sorry, your bug was probably already fixed by https://github.com/basho/basho_bench/pull/168, which didn't garner a quick internal Basho review. I merged it without review. If it addresses your problem, then my apologies for the hassle!

l1x commented 9 years ago

Thanks I guess it fixes it.