boundary / folsom

Expose Erlang Events and Metrics
Apache License 2.0
586 stars 166 forks source link

Folsom fails to start for host in MongooseIM #84

Open kjw1 opened 9 years ago

kjw1 commented 9 years ago

I'm not sure if this is an issue with MongooseIM or folsom, but I get this error when running master, whereas I don't get it when running tag 0.8.1. I don't have any more info than that, unfortunately.

2014-08-29 22:03:55.473 [critical] <0.138.0>@gen_mod:start_module:84 Problem starting the module mod_metrics for host <<"admin">>
 options: []
 error: badarg
[{ets,member,[folsom,{<<"admin">>,sessionSuccessfulLogins}],[]},
 {folsom_ets,handler_exists,1,[{file,"src/folsom_ets.erl"},{line,96}]},
 {folsom_ets,add_handler,2,[{file,"src/folsom_ets.erl"},{line,64}]},
 {mod_metrics,'-init_folsom/1-fun-0-',2,
              [{file,"src/mod_metrics.erl"},{line,36}]},
 {lists,foreach,2,[{file,"lists.erl"},{line,1323}]},
 {mod_metrics,init_folsom,1,[{file,"src/mod_metrics.erl"},{line,35}]},
 {mod_metrics,start,2,[{file,"src/mod_metrics.erl"},{line,22}]},
 {gen_mod,start_module,3,[{file,"src/gen_mod.erl"},{line,73}]}]
2014-08-29 22:03:55.473 [critical] <0.138.0>@gen_mod:start_module:89 ejabberd initialization was aborted because a module start failed.
The trace is [{ets,member,[folsom,{<<"admin">>,sessionSuccessfulLogins}],[]},{folsom_ets,handler_exists,1,[{file,"src/folsom_ets.erl"},{line,96}]},{folsom_ets,add_handler,2,[{file,"src/folsom_ets.erl"},{line,64}]},{mod_metrics,'-init_folsom/1-fun-0-',2,[{file,"src/mod_metrics.erl"},{line,36}]},{lists,foreach,2,[{file,"lists.erl"},{line,1323}]},{mod_metrics,init_folsom,1,[{file,"src/mod_metrics.erl"},{line,35}]},{mod_metrics,start,2,[{file,"src/mod_metrics.erl"},{line,22}]},{gen_mod,start_module,3,[{file,"src/gen_mod.erl"},{line,73}]}].
linearregression commented 9 years ago

hi, mod_metrics is part of mongooseIm

kjw1 commented 9 years ago

I guess there must be some API incompatibility, though, otherwise changing the version of folsom I was using wouldn't have made a difference. If that's expected, all well and good, just wanted to report it in case that wasn't intentional.

linearregression commented 9 years ago

Hi, Would be nice of more info is provided other than just the error What is version of MongooseIM? Had that work before but not anymore after any version change on either Folsom and/or MongooseIM? If so, the versions? Associated Configs for set? Steps to reproduce?

hspecter commented 9 years ago

I have the same problem, version of MongooseIM is HEAD, actually I tryed to start MongooseIM 1.3.2 and 1.4.0 versions of server and got ->

2014-09-24 11:25:00.526 [critical] <0.134.0>@gen_mod:start_module:92 Problem starting the module mod_metrics for host <<"localhost">>
options: []
error: badarg
[{ets,member,[folsom,{<<"localhost">>,sessionSuccessfulLogins}],[]},
{folsom_ets,handler_exists,1,[{file,"src/folsom_ets.erl"},{line,96}]},
{folsom_ets,add_handler,2,[{file,"src/folsom_ets.erl"},{line,64}]},
{mod_metrics,'-init_folsom/1-fun-0-',2,
[{file,"src/mod_metrics.erl"},{line,43}]},
{lists,foreach,2,[{file,"lists.erl"},{line,1323}]},
{mod_metrics,init_folsom,1,[{file,"src/mod_metrics.erl"},{line,42}]},
{mod_metrics,start,2,[{file,"src/mod_metrics.erl"},{line,28}]},
{gen_mod,start_module,3,[{file,"src/gen_mod.erl"},{line,81}]}]
2014-09-24 11:25:00.526 [critical] <0.134.0>@gen_mod:start_module:97 ejabberd initialization was aborted because a module start failed.
The trace is [{ets,member,[folsom,{<<"localhost">>,sessionSuccessfulLogins}],[]}, {folsom_ets,handler_exists,1,[{file,"src/folsom_ets.erl"},{line,96}]},{folsom_ets,add_handler,2, [{file,"src/folsom_ets.erl"},{line,64}]},{mod_metrics,'-init_folsom/1-fun-0-',2,[{file,"src/mod_metrics.erl"}, {line,43}]},{lists,foreach,2,[{file,"lists.erl"},{line,1323}]},{mod_metrics,init_folsom,1, [{file,"src/mod_metrics.erl"},{line,42}]},{mod_metrics,start,2,[{file,"src/mod_metrics.erl"},{line,28}]},{gen_mod,start_module,3,[{file,"src/gen_mod.erl"},{line,81}]}].
Crash dump was written to: erl_crash.dump
Problem starting the module mod_metrics for host <<"localhost">>
options: []
error: badarg
[{ets,member,[folsom,{<<"localhost">>,sessionSuccessfulLogins}],[]},
{folsom_ets,handler_exists,1,[{file,

Steps for reproduce are simple: Clone newest version MongooseIM and change $PROJECT/rebar.config from {folsom, ".", {git, "git://github.com/boundary/folsom.git", "4824aec693c7f284363f19d999289952ec4ed586"}}, to {folsom, ".", {git, "git://github.com/boundary/folsom.git", "0.8.1"}}, thats include bear as app and after $ make && make rel start server $ rel/mongooseim/bin/mongooseimctl live

benoitc commented 9 years ago

The issue is due to the way bear is added to the folsom application. it should be really added to the included_applications not applications. A temporary patch for mangooseim is:

--- a/apps/ejabberd/src/mod_metrics.erl
+++ b/apps/ejabberd/src/mod_metrics.erl
@@ -38,7 +38,8 @@ stop(Host) ->

 -spec init_folsom(ejabberd:server()) -> 'ok'.
 init_folsom(Host) ->
-    folsom:start(),
+    application:start(bear),
+    ok = folsom:start(),
     lists:foreach(fun(Name) ->
         folsom_metrics:new_spiral(Name),
         folsom_metrics:tag_metric(Name, Host)
hspecter commented 9 years ago

Hi, Next problem I meet when starting MongooseIM with mod_metrics:


2014-11-21 09:36:31.670 [critical] <0.201.0>@gen_mod:start_module:84 Problem starting the module mod_metrics for host <<"publicname2">>
 options: []
 error: {badmatch,{error,{already_started,folsom}}}
[{mod_metrics,init_folsom,1,[{file,"src/mod_metrics.erl"},{line,35}]},
 {mod_metrics,start,2,[{file,"src/mod_metrics.erl"},{line,22}]},
 {gen_mod,start_module,3,[{file,"src/gen_mod.erl"},{line,73}]},
 {lists,foreach,2,[{file,"lists.erl"},{line,1323}]},
 {ejabberd_app,start,2,[{file,"src/ejabberd_app.erl"},{line,71}]},
 {application_master,start_it_old,4,
                     [{file,"application_master.erl"},{line,269}]}]
2014-11-21 09:36:31.670 [critical] <0.201.0>@gen_mod:start_module:89 ejabberd initialization was aborted because a module start failed.
The trace is [{mod_metrics,init_folsom,1,[{file,"src/mod_metrics.erl"},{line,35}]},{mod_metrics,start,2,[{file,"src/mod_metrics.erl"},{line,22}]},{gen_mod,start_module,3,[{file,"src/gen_mod.erl"},{line,73}]},{lists,foreach,2,[{file,"lists.erl"},{line,1323}]},{ejabberd_app,start,2,[{file,"src/ejabberd_app.erl"},{line,71}]},{application_master,start_it_old,4,[{file,"application_master.erl"},{line,269}]}].

Problem appears when we have in

ejabberd.cfg
that ->


%%%'   SERVED HOSTNAMES
%% hosts: Domains served by ejabberd.
%% You can define one or several, for example:
%% {hosts, ["example.net", "example.com", "example.org"]}.
%%
{hosts, ["publicname", "publicname2"] }.

and disappears when we have ->


%%%'   SERVED HOSTNAMES
%% hosts: Domains served by ejabberd.
%% You can define one or several, for example:
%% {hosts, ["example.net", "example.com", "example.org"]}.
%%
{hosts, ["publicname"] }.

Can anybody help me?

joewilliams commented 8 years ago

Folsom has moved, please resubmit your issue at https://github.com/folsom-project Thanks!