erwa
erwa copied to clipboard
When simple_client start to connect server, errors in server side.
Server side errors:
7:31:33.335 [info] Application lager started on node '[email protected]'
17:31:33.338 [info] Application cowboy started on node '[email protected]'
17:31:33.372 [info] Application erwa started on node '[email protected]'
Eshell V7.3 (abort with ^G)
([email protected])1> 17:33:54.251 [warning] lager_error_logger_h dropped 65 messages in the last second that exceeded the limit of 50 messages/sec
17:33:54.251 [error] gen_server <0.248.0> terminated with reason: bad argument in call to erlang:bit_size(none) in erwa_broker:realm_to_db_name/1 line 271
17:33:54.255 [error] CRASH REPORT Process <0.248.0> with 0 neighbours exited with reason: bad argument in call to erlang:bit_size(none) in erwa_broker:realm_to_db_name/1 line 271
17:33:54.255 [error] Ranch listener erwa_tcp terminated with reason: bad argument in call to erlang:bit_size(none) in erwa_broker:realm_to_db_name/1 line 271
Client side:
Erlang/OTP 18 [erts-7.3] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
starting client ... done.
connecting to realm <<"ws.wamp.test">> at "localhost":5555 ...
=INFO REPORT==== 31-May-2016::17:33:59 ===
application: simple_client
exited: {{timeout,
{gen_server,call,
[<0.65.0>,
{awre_call,
{connect,"localhost",5555,<<"ws.wamp.test">>,
msgpack}}]}},
{simple_client_app,start,[normal,[]]}}
type: permanent
Eshell V7.3 (abort with ^G)
([email protected])1> {"Kernel pid terminated",application_controller,"{application_start_failure,simple_client,{{timeout,{gen_server,call,[<0.65.0>,{awre_call,{connect,\"localhost\",5555,<<\"ws.wamp.test\">>,msgpack}}]}},{simple_client_app,start,[normal,[]]}}}"}
Crash dump is being written to: erl_crash.dump...done
Kernel pid terminated (application_controller) ({application_start_failure,simple_client,{{timeout,{gen_server,call,[<0.65.0>,{awre_call,{connect,"localhost",5555,<<"ws.wamp.test">>,msgpack}}]}},{si
Seems like the realm_to_db_name function could not get the Realm argument in erwa_broker module on line number 271:
https://github.com/bwegh/erwa/blob/master/src/erwa_broker.erl#L271
realm_to_db_name(Realm) ->
Prefix = <<"erwa_subscription_">>,
binary_to_atom(<< Prefix/binary, Realm/binary >>, utf8 ).
And why the function get a none argument when simple_client connect to it?
could you please describe what you are doing? so I can see where the issue is coming from, thanks
Env
OS X El Capitan 10.11.2
➜ simple_client git:(master) ✗ which iex
/Users/hezhiqiang/.kiex/elixirs/elixir-1.2.5/bin/iex
➜ simple_client git:(master) ✗ which erl
/Users/hezhiqiang/.kerl/installs/18.3_dtrace/bin/erl
➜ simple_client git:(master) ✗ rebar3 -v
rebar 3.1.1 on Erlang/OTP 18 Erts 7.3
Rourter
git clone https://github.com/bwegh/erwa.git
cd erwa/examples/simple_router
➜ simple_router git:(master) ✗ make
CC=cc mkdir -p ebin
===> Starting relx build process ...
===> Resolving OTP Applications from directories:
/Users/hezhiqiang/ElixirProjects/WAMP/erwa/examples/simple_router/ebin
/Users/hezhiqiang/ElixirProjects/WAMP/erwa/examples/simple_router/deps
/Users/hezhiqiang/.kerl/installs/18.3_dtrace/lib
/Users/hezhiqiang/ElixirProjects/WAMP/erwa/examples/simple_router/apps
/Users/hezhiqiang/ElixirProjects/WAMP/erwa/examples/simple_router/_rel
===> Resolved simple_router_release-1
===> Including Erts from /Users/hezhiqiang/.kerl/installs/18.3_dtrace
===> release successfully created!
Run:
./_rel/simple_router_release/bin/simple_router_release console
The error:
10:25:59.518 [error] CRASH REPORT Process <0.126.0> with 0 neighbours exited with reason: call to undefined function elogger_config:set_loglevel(debug) in gen_server:init_it/6 line 352
And comment the line 23 in simple_router.erl, and make, and re-run it, it's ok
10:28:35.116 [info] Application lager started on node '[email protected]'
10:28:35.119 [info] Application cowboy started on node '[email protected]'
10:28:35.148 [info] Application erwa started on node '[email protected]'
Eshell V7.3 (abort with ^G)
([email protected])1>
Client (Pub/Sub)
git clone https://github.com/bwegh/awre.git
cd awre/examples/simple_client
➜ simple_client git:(master) ✗ make
DEP jsx
./bootstrap
Recompile: src/rebar
Recompile: src/rebar_abnfc_compiler
Recompile: src/rebar_app_utils
Recompile: src/rebar_appups
Recompile: src/rebar_asn1_compiler
Recompile: src/rebar_base_compiler
Recompile: src/rebar_cleaner
Recompile: src/rebar_config
Recompile: src/rebar_core
Recompile: src/rebar_cover_utils
Recompile: src/rebar_ct
Recompile: src/rebar_deps
Recompile: src/rebar_dia_compiler
Recompile: src/rebar_edoc
Recompile: src/rebar_erlc_compiler
Recompile: src/rebar_erlydtl_compiler
Recompile: src/rebar_escripter
Recompile: src/rebar_eunit
Recompile: src/rebar_file_utils
Recompile: src/rebar_getopt
Recompile: src/rebar_lfe_compiler
Recompile: src/rebar_log
Recompile: src/rebar_metacmds
Recompile: src/rebar_mustache
Recompile: src/rebar_neotoma_compiler
Recompile: src/rebar_otp_app
Recompile: src/rebar_otp_appup
Recompile: src/rebar_port_compiler
Recompile: src/rebar_proto_compiler
Recompile: src/rebar_proto_gpb_compiler
Recompile: src/rebar_protobuffs_compiler
Recompile: src/rebar_qc
Recompile: src/rebar_rel_utils
Recompile: src/rebar_reltool
Recompile: src/rebar_require_vsn
Recompile: src/rebar_shell
Recompile: src/rebar_subdirs
Recompile: src/rebar_templater
Recompile: src/rebar_upgrade
Recompile: src/rebar_utils
Recompile: src/rebar_xref
==> rebar (compile)
==> rebar (escriptize)
Congratulations! You now have a self-contained script called "rebar" in
your current working directory. Place this script anywhere in your path
and you can use rebar to build OTP-compliant apps.
/Users/hezhiqiang/ElixirProjects/WAMP/awre/examples/simple_client/deps/wamper
DEP msgpack
DEP pbkdf2
ERLC jsx.erl jsx_config.erl jsx_consult.erl jsx_decoder.erl jsx_encoder.erl jsx_parser.erl jsx_to_json.erl jsx_to_term.erl jsx_verify.erl
Old inliner: threshold=0 functions=[{doublequote,5},
{singlequote,5},
{maybe_replace,2},
{format_number,1},
{handle_event,3}]
APP jsx.app.src
ERLC msgpack.erl msgpack_ext.erl msgpack_packer.erl msgpack_term.erl msgpack_unpacker.erl
APP msgpack.app.src
CC=cc mkdir -p ebin
ERLC pbkdf2.erl
APP pbkdf2.app.src
ERLC wamper_auth.erl wamper_converter.erl wamper_protocol.erl wamper_validator.erl
APP wamper.app.src
ERLC awre.erl awre_app.erl awre_con.erl awre_sup.erl awre_trans_local.erl awre_trans_tcp.erl awre_transport.erl
APP awre.app.src
ERLC simple_client.erl simple_client_app.erl simple_client_sup.erl
APP simple_client.app.src
GEN distclean-relx-rel
===> Starting relx build process ...
===> Resolving OTP Applications from directories:
/Users/hezhiqiang/ElixirProjects/WAMP/awre/examples/simple_client/ebin
/Users/hezhiqiang/ElixirProjects/WAMP/awre/examples/simple_client/deps
/Users/hezhiqiang/.kerl/installs/18.3_dtrace/lib
===> Resolving available OTP Releases from directories:
/Users/hezhiqiang/ElixirProjects/WAMP/awre/examples/simple_client/ebin
/Users/hezhiqiang/ElixirProjects/WAMP/awre/examples/simple_client/deps
/Users/hezhiqiang/.kerl/installs/18.3_dtrace/lib
===> Resolved simple_client-1
===> Including Erts from /Users/hezhiqiang/.kerl/installs/18.3_dtrace
===> release successfully created!
and run the client with command:
./_rel/simple_client/bin/simple_client console
errors like this:
Exec: /Users/hezhiqiang/ElixirProjects/WAMP/awre/examples/simple_client/_rel/simple_client/erts-7.3/bin/erlexec -boot /Users/hezhiqiang/ElixirProjects/WAMP/awre/examples/simple_client/_rel/simple_client/releases/1/simple_client -env ERL_LIBS /Users/hezhiqiang/ElixirProjects/WAMP/awre/examples/simple_client/_rel/simple_client/releases/1/lib -config /Users/hezhiqiang/ElixirProjects/WAMP/awre/examples/simple_client/_rel/simple_client/releases/1/sys.config -args_file /Users/hezhiqiang/ElixirProjects/WAMP/awre/examples/simple_client/_rel/simple_client/releases/1/vm.args -- console
Root: /Users/hezhiqiang/ElixirProjects/WAMP/awre/examples/simple_client/_rel/simple_client
/Users/hezhiqiang/ElixirProjects/WAMP/awre/examples/simple_client/_rel/simple_client
Erlang/OTP 18 [erts-7.3] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
starting client ... done.
connecting to realm <<"ws.wamp.test">> at "localhost":5555 ...
=INFO REPORT==== 2-Jun-2016::10:58:28 ===
application: simple_client
exited: {{timeout,
{gen_server,call,
[<0.65.0>,
{awre_call,
{connect,"localhost",5555,<<"ws.wamp.test">>,
msgpack}}]}},
{simple_client_app,start,[normal,[]]}}
type: permanent
Eshell V7.3 (abort with ^G)
([email protected])1> {"Kernel pid terminated",application_controller,"{application_start_failure,simple_client,{{timeout,{gen_server,call,[<0.65.0>,{awre_call,{connect,\"localhost\",5555,<<\"ws.wamp.test\">>,msgpack}}]}},{simple_client_app,start,[normal,[]]}}}"}
Crash dump is being written to: erl_crash.dump...done
Kernel pid terminated (application_controller) ({application_start_failure,simple_client,{{timeout,{gen_server,call,[<0.65.0>,{awre_call,{connect,"localhost",5555,<<"ws.wamp.test">>,msgpack}}]}},{si
and in the router console, output like this:
([email protected])1> 10:58:24.014 [warning] lager_error_logger_h dropped 20 messages in the last second that exceeded the limit of 50 messages/sec
10:58:24.014 [error] gen_server <0.256.0> terminated with reason: bad argument in call to erlang:bit_size(none) in erwa_broker:realm_to_db_name/1 line 271
10:58:24.019 [error] CRASH REPORT Process <0.256.0> with 0 neighbours exited with reason: bad argument in call to erlang:bit_size(none) in erwa_broker:realm_to_db_name/1 line 271
10:58:24.019 [error] Ranch listener erwa_tcp terminated with reason: bad argument in call to erlang:bit_size(none) in erwa_broker:realm_to_db_name/1 line 271