satori-com / mzbench

MZ Benchmarking
BSD 3-Clause "New" or "Revised" License
271 stars 78 forks source link

Parse Error #151

Open keerthana07 opened 5 years ago

keerthana07 commented 5 years ago

Hello,

just started working with mzbench. I can run an example scenario but when I run my scenario I see the following error Parse error: Expected "%", ".", [0-9a-zA-Z_], or [\t\n\r ] but "(" found. Line:1 Column:13

Server Internal Error: {parse_error,{2,erl_parse, ["syntax error before: ","pool"]}} Req: {http_req,#Port<0.3535>,ranch_tcp,keepalive,<0.366.0>,<<"POST">>, 'HTTP/1.1', {{172,17,0,1},40150}, <<"localhost">>,undefined,4800,<<"/typecheck">>,undefined, <<"benchmark_name=kee&cloud=local&exclusive=&nodes=1&loop_rate=1">>, [], [{<<"host">>,<<"localhost:4800">>}, {<<"connection">>,<<"keep-alive">>}, {<<"content-length">>,<<"1355">>}, {<<"accept">>,<<"/">>}, {<<"origin">>,<<"http://localhost:4800">>}, {<<"x-requested-with">>,<<"XMLHttpRequest">>}, {<<"user-agent">>, <<"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36">>}, {<<"content-type">>, <<"multipart/form-data; boundary=----WebKitFormBoundarynIFXaxbSbn7qqk0O">>}, {<<"referer">>,<<"http://localhost:4800/">>}, {<<"accept-encoding">>,<<"gzip, deflate, br">>}, {<<"accept-language">>,<<"en-US,en;q=0.9,de;q=0.8">>}], [],waiting,<<>>,undefined,false,waiting,[],<<>>,undefined} Stacktrace: [{mzbl_script,parse,1, [{file, "/home/ridrisov/mzbench/server/_build/default/deps/mzbench_language/src/mzbl_script.erl"}, {line,94}]}, {mzbl_script,read_from_string,1, [{file, "/home/ridrisov/mzbench/server/_build/default/deps/mzbench_language/src/mzbl_script.erl"}, {line,56}]}, {mzb_api_endpoints,handle,4, [{file, "/home/ridrisov/mzbench/server/_build/default/deps/mzbench_api/src/mzb_api_endpoints.erl"}, {line,153}]}, {mzb_api_endpoints,init,2, [{file, "/home/ridrisov/mzbench/server/_build/default/deps/mzbench_api/src/mzb_api_endpoints.erl"}, {line,15}]}, {cowboy_handler,execute,2, [{file, "/home/ridrisov/mzbench/server/_build/default/deps/cowboy/src/cowboy_handler.erl"}, {line,39}]}, {cowboy_protocol,execute,4, [{file, "/home/ridrisov/mzbench/server/_build/default/deps/cowboy/src/cowboy_protocol.erl"}, {line,462}]}]

Here is my code : host and a few others are hidden as I am working on a company project.

`make_install(git = "https://github.com/erlio/vmq_mzbench.git",branch = "master") pool(size = 1, worker_type = mqtt_worker): connect([t(host, "mqtt2.kuka-atx.com"), t(port,8883), t(client,"subscriber1"), t(clean_session,true), t(keepalive_interval,60), t(proto_version,4), t(reconnect_timeout,4) ]) wait(1 sec) subscribe("/", 0)

pool(size = 1000, worker_type = mqtt_worker, worker_start = poisson(1000 rps)): connect([t(host, ".com"), t(port,8883), t(client,fixed_client_id("pool1", worker_id())), t(clean_session,true), t(keepalive_interval,60), t(proto_version,4), t(reconnect_timeout,4) ]) set_signal(connect1, 1) wait_signal(connect1, 1000) wait(4 sec) loop(time = 5 min, rate = 1 rps): publish_to_self("/***", random_binary(150), 0) disconnect()'

Working on a Mac:

Please let me know what I might be missing.

Earlier had OTP version 21, now downgraded it by $brew install erlang@20

parsifal-47 commented 5 years ago

Hi, it looks like you miss "#!benchDL" at the beginning of your script.

MZBench supports two languages: eDSL based on erlang terms (default) and benchDL, to let it know that you use second option you need to specify this at the very beginning. For example: https://github.com/satori-com/mzbench/blob/master/examples.bdl/assertions.bdl

keerthana07 commented 5 years ago

@parsifal-47 thank you, I realised it after posting it.

akefirad commented 5 years ago

@keerthana07 is the issue resolved? If so, would you mind closing it?

ammma commented 4 years ago

Hi, I'm having same issue. This script is taken from: https://vernemq.com/blog/2016/08/26/loadtesting-mqtt-brokers.html

I've just copied it with no changes: image here is the result: image

@parsifal-47 trying to use example from link you provided: https://github.com/satori-com/mzbench/blob/master/examples.bdl/assertions.bdl image

Funny thing is when i click 'New' and run default simple example it works. But if i copy\paste other example an error comes. So as workaround i've just modified simple example script.

parsifal-47 commented 4 years ago

It says parse error before exclamation sign, I see only one at the very beginning. Could you please double-check that you have complete shebang "#!benchDL"? From the error it looks like you have hash (#) missing

ammma commented 4 years ago

Thank you for a quick answer. As you can see from screenshot all scripts have "#!benchDL" in first string. And i've double checked this. Steps to reproduce: docker run -d -p 4800:80 --name mzbench_server docker.io/ridrisov/mzbench go to http://localhost:4800/ (Browser: Chrome\Firefox latest versions) Copy\paste scenario from here https://github.com/satori-com/mzbench/blob/master/examples.bdl/assertions.bdl

Also got another issue, seems to be related to docker image: line make_install(git = "https://github.com/erlio/vmq_mzbench.git", branch = "master") is producing an error ...bash: git: command not found\n... Looks like git is not installed there.

parsifal-47 commented 4 years ago

I see, this is a very old docker image. However, the syntax hasn't changed much since. Need to check what is the best way to fix it.

By the way, if you have helm and kube, you may try recipes from here: https://github.com/mzbench/mzbench

ghost commented 3 years ago

Has this ever be fixed?

If I try to start a scenario using the API with following command I'm getting the same error. Doesn't matter whether I use a bdl file from the examples folder or my own one.

Command: curl -XPOST --form bench=@loop.bdl http://localhost:4800/start

loop.bdl:

#!benchDL
# the simplest example
pool(size = 3, # three execution "threads"
     worker_type = dummy_worker):
        loop(time = 5 min, # total loop time
             rate = 1 rps): # one rps for every worker, 3 rps totally
            print("FOO") # this operation prints "FOO" to console

bdl file is from here

Started mzbench using this command: docker run -d -p 4800:80 --name mzbench_server docker.io/ridrisov/mzbench

I'm really need to use the API.

ghost commented 3 years ago

I've tried to run the exact same curl command from above on an mzbench instance which is compiled from source on Ubuntu 20.

The Api is working and no error is thrown.

parsifal-47 commented 3 years ago

unfortunately this docker image wasn't updated for a long time, I forgot a password from this docker account and email no longer exists. In addition to that, I have no access to write to this fork since 2018 :( this fork has some more recent activity: https://github.com/mzbench/mzbench

ghost commented 3 years ago

Thanks @parsifal-47 for the clarification