bwegh / erwa

Please use https://github.com/CargoTube/cargotube or https://github.com/CargoTube/ct_erwa_api instead.
MIT License
57 stars 16 forks source link

Erwa crash when try register a procedure via awre when that is already registered #35

Open ethrbh opened 8 years ago

ethrbh commented 8 years ago

hello,

Here is another crash issue. This comes when I try register a procedure what is already registered.

Here is the Erlang comamnds line-by-line for reproduce the issue:

application:ensure_all_started(cowboy).
application:ensure_all_started(erwa).
application:ensure_all_started(awre).

AppName = igs.
Realm = erlang:list_to_binary("igs_realm_tmp").
RegisteredRpcUrl = erlang:list_to_binary("ws.wamp.igs.rpc.tmp").

Dispatch = cowboy_router:compile([{'_', [{"/igs", erwa_in_ws, []},{"/", cowboy_static, {priv_file, AppName, "index.html"}},{"/static/[...]", cowboy_static, {priv_dir, AppName, "static"}},{"/[...]", cowboy_static, {priv_dir, AppName, ""}}]}]).

{ok, HttpPid} = cowboy:start_http(http, 100, [{port, 8081}],[{env, [{dispatch, Dispatch}]}]).

PrivDir = code:priv_dir(AppName).
{ok, HttpsPid} = cowboy:start_https(https, 100, [{port, 8082},{cacertfile, PrivDir ++ "/ssl/cowboy-ca.crt"},{certfile, PrivDir ++ "/ssl/server.crt"},{keyfile, PrivDir ++ "/ssl/server.key"}], [{env, [{dispatch, Dispatch}]}]).

{ok, RanchChild} = ranch:start_listener(erwa_tcp, 5, ranch_tcp, [{port, 5555}], erwa_in_tcp, []).
ok = erwa:start_realm(Realm).

{ok,Con} = awre:start_client().
{ok,SessionId,RouterDetails} = awre:connect(Con,"localhost",5555,Realm,json).
{ok,RegisteredRpcId_Dummy} = awre:register(Con, [], RegisteredRpcUrl).

{ok,RegisteredRpcId_Dummy2} = awre:register(Con, [], RegisteredRpcUrl).

And here is the full Erlang shall log

pi@raspberrypi:~/ethrbh/igs(master)> make igs_console_clean
_rel/igs//bin//igs console_clean
Exec: /home/pi/ethrbh/igs/_rel/igs/erts-7.3/bin/erlexec -boot /home/pi/ethrbh/igs/_rel/igs/bin/start_clean -boot_var ERTS_LIB_DIR /home/pi/ethrbh/igs/_rel/igs/erts-7.3/../lib -env ERL_LIBS /home/pi/ethrbh/igs/_rel/igs/releases/0.1.1/lib -config /home/pi/ethrbh/igs/_rel/igs/releases/0.1.1/sys.config -args_file /home/pi/ethrbh/igs/_rel/igs/releases/0.1.1/vm.args -- console_clean
Root: /home/pi/ethrbh/igs/_rel/igs
/home/pi/ethrbh/igs/_rel/igs
heart_beat_kill_pid = 23652
Erlang/OTP 18 [erts-7.3] [source] [smp:4:4] [async-threads:10] [kernel-poll:false]

Eshell V7.3  (abort with ^G)
(igs@raspberrypi)1> 
(igs@raspberrypi)1> 
(igs@raspberrypi)1> application:ensure_
ensure_all_started/1  ensure_all_started/2  ensure_started/1      
ensure_started/2      
(igs@raspberrypi)1> application:ensure_all_started(cowboy).
{ok,[crypto,asn1,public_key,ssl,ranch,cowlib,cowboy]}
(igs@raspberrypi)2> application:ensure_all_started(erwa).  
10:25:18.255 [info] Application lager started on node igs@raspberrypi
{ok,[jsx,msgpack,pbkdf2,wamper,mnesia,syntax_tools,compiler,
     goldrush,lager,erwa]}
10:25:18.723 [info] Application erwa started on node igs@raspberrypi
(igs@raspberrypi)3> application:ensure_all_started(awre).
10:25:22.766 [info] Application awre started on node igs@raspberrypi
{ok,[awre]}
(igs@raspberrypi)4> AppName = igs.
igs
(igs@raspberrypi)5> Realm = erlang:list_to_binary("igs_realm_tmp").
<<"igs_realm_tmp">>
(igs@raspberrypi)6> RegisteredRpcUrl = erlang:list_to_binary("ws.wamp.igs.rpc.tmp").
<<"ws.wamp.igs.rpc.tmp">>
(igs@raspberrypi)7> 
(igs@raspberrypi)7> Dispatch = cowboy_router:compile([{'_', [{"/igs", erwa_in_ws, []},{"/", cowboy_static, {priv_file, AppName, "index.html"}},{"/static/[...]", cowboy_static, {priv_dir, AppName, "static"}},{"/[...]", cowboy_static, {priv_dir, AppName, ""}}]}]).
[{'_',[],
      [{[<<"igs">>],[],erwa_in_ws,[]},
       {[],[],cowboy_static,{priv_file,igs,"index.html"}},
       {[<<"static">>,'...'],
        [],cowboy_static,
        {priv_dir,igs,"static"}},
       {['...'],[],cowboy_static,{priv_dir,igs,[]}}]}]
(igs@raspberrypi)8> {ok, HttpPid} = cowboy:start_http(http, 100, [{port, 8081}],[{env, [{dispatch, Dispatch}]}]).
{ok,<0.221.0>}
(igs@raspberrypi)9> 
(igs@raspberrypi)9> PrivDir = code:priv_dir(AppName).
"/home/pi/ethrbh/igs/_rel/igs/lib/igs-0.1.1/priv"
(igs@raspberrypi)10> {ok, HttpsPid} = cowboy:start_https(https, 100, [{port, 8082},{cacertfile, PrivDir ++ "/ssl/cowboy-ca.crt"},{certfile, PrivDir ++ "/ssl/server.crt"},{keyfile, PrivDir ++ "/ssl/server.key"}], [{env, [{dispatch, Dispatch}]}]).
{ok,<0.326.0>}
(igs@raspberrypi)11> {ok, RanchChild} = ranch:start_listener(erwa_tcp, 5, ranch_tcp, [{port, 5555}], erwa_in_tcp, []).
{ok,<0.432.0>}
(igs@raspberrypi)12> ok = erwa:start_realm(Realm).
ok
(igs@raspberrypi)13> 
(igs@raspberrypi)13> {ok,Con} = awre:start_client().
{ok,<0.503.0>}
(igs@raspberrypi)14> {ok,SessionId,RouterDetails} = awre:connect(Con,"localhost",5555,Realm,json).
{ok,5262025106483998,
    #{agent => <<"Erwa-1.2.1">>,
      roles => #{broker => #{features => #{event_history => false,
            partitioned_pubsub => false,
            pattern_based_subscription => false,
            publication_trustlevels => false,
            publisher_exclusion => true,
            publisher_identification => true,
            subscriber_blackwhite_listing => true,
            subscriber_list => false,
            subscriber_metaevents => false}},
        dealer => #{features => #{call_canceling => true,
            call_timeout => true,
            call_trustlevels => false,
            callee_blackwhite_listing => false,
            caller_exclusion => false,
            caller_identification => false,
            partitioned_rpc => false,
            pattern_based_registration => false,
            progressive_call_results => true,
            shared_registration => true}}}}}
(igs@raspberrypi)15> 
(igs@raspberrypi)15> 
(igs@raspberrypi)15> {ok,RegisteredRpcId_Dummy} = awre:register(Con, [], RegisteredRpcUrl).
{ok,1214119529082202}
(igs@raspberrypi)16> 
(igs@raspberrypi)16> 
(igs@raspberrypi)16> 
(igs@raspberrypi)16> {ok,RegisteredRpcId_Dummy2} = awre:register(Con, [], RegisteredRpcUrl).
10:27:34.249 [error] gen_server <0.507.0> terminated with reason: no function clause matching erwa_dealer:send_metaevents({error,procedure_already_exists}) line 120
10:27:34.281 [error] CRASH REPORT Process <0.507.0> with 0 neighbours exited with reason: no function clause matching erwa_dealer:send_metaevents({error,procedure_already_exists}) line 120 in gen_server:terminate/7 line 826
10:27:34.284 [error] Ranch listener erwa_tcp terminated with reason: no function clause matching erwa_dealer:send_metaevents({error,procedure_already_exists}) line 120
** exception exit: {timeout,
                       {gen_server,call,
                           [<0.503.0>,
                            {awre_call,
                                {register,[],<<"ws.wamp.igs.rpc.tmp">>,
                                    undefined}}]}}
     in function  gen_server:call/2 (gen_server.erl, line 204)
(igs@raspberrypi)17> 
(igs@raspberrypi)17> 

thanks for your help, /Robi

ethrbh commented 8 years ago

hello Bas,

Sorry for disturbing you, but I would like to ask you, do you have some nes regarding to this issue?

thanks, /Robi