Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

message not inserting in DB and my erlang.log file says following:: #13

Open
pratik1230 opened this issue Dec 26, 2014 · 27 comments
Open

Comments

@pratik1230
Copy link

My:::: Emakefile:::::

{'../ejabberd-dev/src/gen_mod',
[{outdir, "/opt/ejabberd-13.12/lib/ejabberd-13.12/ebin"},{i,"/opt/ejabberd-13.12/lib/ejabberd-13.12/include"}]}.
{'src/*', [{outdir, "ebin"},{i,"/opt/ejabberd-13.12/lib/ejabberd-13.12/include"}]}.

after compiling i copied .beam file into
/opt/ejabberd-13.12/lib/ejabberd-13.12/ebin

also copied /Emysql/ebin/* to /opt/ejabberd-13.12/lib/ejabberd-13.12/ebin

then restart ejabberd no error but erlang.log file says as follow:

=CRASH REPORT==== 26-Dec-2014::09:55:53 ===
crasher:
initial call: mod_log_chat_mysql5:init/1
pid: <0.402.0>
registered_name: []
exception exit: {badarg,
[{emysql,config_ok,1,[{file,"emysql.erl"},{line,247}]},
{emysql,add_pool,1,[{file,"emysql.erl"},{line,276}]},
{mod_log_chat_mysql5,init,1,
[{file,"src/mod_log_chat_mysql5.erl"},{line,76}]},
{gen_server,init_it,6,
[{file,"gen_server.erl"},{line,304}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,239}]}]}
in function gen_server:init_it/6 (gen_server.erl, line 328)
ancestors: [ejabberd_sup,<0.38.0>]
messages: []
links: [<0.299.0>]
dictionary: []
trap_exit: false
status: running
heap_size: 1598
stack_size: 27
reductions: 342
neighbours:

@mweibel
Copy link
Member

mweibel commented Jan 3, 2015

Hi,

hmm yeah might be that emysql has changed a bit since I created this module. Maybe I'll find time to figure this out, otherwise you're more than welcome to figure out what happens :)

Best,
Michael

@mweibel
Copy link
Member

mweibel commented Jan 3, 2015

Ah, could you show us how you configured the module (the MySQL settings)? Please replace any sensitive info with something else but in similar form...

@pratik1230
Copy link
Author

Hi,

Here is my config file settings for this module

{mod_log_chat_mysql5, [{server, "localhost"}, {db, "xyz"}, {user, "user"}, {password, "pass"}, {pool_size, 1}, {encoding, utf8}]},

and one more thing i forgot to tell you, from read me file i confused in following point

Copy all the Emysql files to your ejabberd system ebin folder as well. (Emysql/ebin/*)

i copied all .beam file from Emysql/ebin/ is anything else i have to copied from Emysql to my ejabberd root directory ?

i am using ubuntu and i installed ejabberd from .run file so tell me where exactly i have to copy emysql files if any.

@mweibel
Copy link
Member

mweibel commented Jan 5, 2015

Hi,
as far as I can tell the config looks ok.

The ebin files you should copy to the folder within ejabberd where ejabberd's ebin files are. Don't really know where they are within your installation, but you might want to take a look at the installation folder of ejabberd.

@pratik1230
Copy link
Author

hi,

i copied all ebin files to my installation thats ok. other then this need to copy any files from emysql src ?

@mweibel
Copy link
Member

mweibel commented Jan 5, 2015

Probably the .app file as well, did you copy it?

@pratik1230
Copy link
Author

hi,

yes i copied emysql.app file where all beam file presents

@mweibel
Copy link
Member

mweibel commented Jan 6, 2015

Ok, thanks. Taking a look as soon as possible now.

@pratik1230
Copy link
Author

okay

@mweibel
Copy link
Member

mweibel commented Jan 6, 2015

when starting the server, do you have in ejabberd.log also the following info logs?

2015-01-06 07:49:55.208 [info] <0.442.0>@ejabberd_config:prepare_opt_val:582 Configuration problem:
** Option: server
** Invalid value: "localhost"
** Using as fallback: undefined
2015-01-06 07:49:55.208 [info] <0.7.0> Application emysql started on node ejabberd@localhost
2015-01-06 07:49:55.209 [info] <0.442.0>@ejabberd_config:prepare_opt_val:582 Configuration problem:
** Option: db
** Invalid value: "ejabberd"
** Using as fallback: undefined
2015-01-06 07:49:55.209 [info] <0.442.0>@ejabberd_config:prepare_opt_val:582 Configuration problem:
** Option: user
** Invalid value: "root"
** Using as fallback: undefined
2015-01-06 07:49:55.209 [info] <0.442.0>@ejabberd_config:prepare_opt_val:582 Configuration problem:
** Option: password
** Invalid value: ""
** Using as fallback: undefined
2015-01-06 07:49:55.209 [info] <0.442.0>@ejabberd_config:prepare_opt_val:582 Configuration problem:
** Option: pool_size
** Invalid value: 1
** Using as fallback: undefined
2015-01-06 07:49:55.209 [info] <0.442.0>@ejabberd_config:prepare_opt_val:582 Configuration problem:
** Option: encoding
** Invalid value: utf8
** Using as fallback: undefined

(you might need to increase the loglevel for that)

@pratik1230
Copy link
Author

hi,

yes i found same log

+++++++++
2015-01-06 07:06:00.637 [info] <0.7.0> Application p1_mysql started on node '[email protected]'
2015-01-06 07:06:00.688 [info] <0.38.0>@cyrsasl_digest:start:58 FQDN used to check DIGEST-MD5 SASL authentication: ip-172-31-49-108.ec2.internal
2015-01-06 07:06:00.741 [info] <0.405.0>@ejabberd_config:prepare_opt_val:574 Configuration problem:
** Option: server
** Invalid value: "localhost"
** Using as fallback: undefined
2015-01-06 07:06:00.741 [info] <0.405.0>@ejabberd_config:prepare_opt_val:574 Configuration problem:
** Option: db
** Invalid value: "xyz"
** Using as fallback: undefined
2015-01-06 07:06:00.742 [info] <0.405.0>@ejabberd_config:prepare_opt_val:574 Configuration problem:
** Option: user
** Invalid value: "root"
** Using as fallback: undefined
2015-01-06 07:06:00.742 [info] <0.405.0>@ejabberd_config:prepare_opt_val:574 Configuration problem:
** Option: password
** Invalid value: "xyz"
** Using as fallback: undefined
2015-01-06 07:06:00.742 [info] <0.405.0>@ejabberd_config:prepare_opt_val:574 Configuration problem:
** Option: pool_size
** Invalid value: 1
** Using as fallback: undefined
2015-01-06 07:06:00.742 [info] <0.405.0>@ejabberd_config:prepare_opt_val:574 Configuration problem:
** Option: encoding
** Invalid value: utf8

@mweibel
Copy link
Member

mweibel commented Jan 6, 2015

yeah well, then I know what the problem is. the module was created for an older version of ejabberd and in the newer ones they changed some APIs, e.g. the one for getting options.
Trying now to make it work again, can't guarantee anything though.

@pratik1230
Copy link
Author

Okay thanks i am using ejabberd 13.12 and 14.12

@mweibel
Copy link
Member

mweibel commented Jan 6, 2015

hey,

I commited a fix: 12d7460

should work now, even though logging doesn't seem to work because of some stupid stuff going on. Anyway. To compile you can follow the same steps as before, except that you need to copy ejabberd.hrl and logger.hrl from the current ejabberd source into the include directory of the mentioned ejabberd-dev/trunk directory.

@pratik1230
Copy link
Author

Hi,

Thanks for update ,

I do compile and restart ejabberd and got this error

2015-01-07 05:50:31.843 [warning] <0.6.0> lager_error_logger_h dropped 1 messages in the last second that exceeded the limit of 50 messages/sec
2015-01-07 05:50:31.843 [error] <0.401.0> gen_server 'mod_log_chat_mysql5_54.172.112.105' terminated with reason: pool_not_found
2015-01-07 05:50:31.845 [error] <0.401.0> CRASH REPORT Process 'mod_log_chat_mysql5_54.172.112.105' with 0 neighbours exited with reason: pool_not_found in gen_server:terminate/6 line 722
2015-01-07 05:50:31.849 [error] <0.298.0> Supervisor ejabberd_sup had child 'mod_log_chat_mysql5_54.172.112.105' started with mod_log_chat_mysql5:start_link(<<"54.172.112.105">>, [{server,<<"localhost">>},{db,<<"xyz">>},{user,<<"root">>},{password,<<"xyz">>},{pool_size,1},...]) at <0.401.0> exit with reason pool_not_found in context child_terminated

is pool_size necessary ?

@mweibel
Copy link
Member

mweibel commented Jan 7, 2015

I guess this is from stopping ejabberd, no? Can you show when starting it?

@pratik1230
Copy link
Author

Actually suddenly something goes wrong and i am getting this

Crash dump was written to: /opt/ejabberd-13.12/logs/erl_crash_20150107-074812.dump
Kernel pid terminated (application_controller) ({application_start_failure,kernel,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,net_kernel,{'EXIT',nodistribution}}}}},{k

please tell me if you know abuot this , i am not able to start ejabberd only.

once this one is fixed i can check this module.

@pratik1230
Copy link
Author

Hi,

ejabberd started now i recompile module all fine but no entries in DB

starting erlang.log as below

=PROGRESS REPORT==== 7-Jan-2015::09:31:12 ===
supervisor: {local,ejabberd_sup}
started: [{pid,<0.401.0>},
{name,'mod_log_chat_mysql5_54.172.112.106'},
{mfargs,
{mod_log_chat_mysql5,start_link,
[<<"54.172.112.106">>,
[{server,<<"localhost">>},
{db,<<"xyz">>},
{user,<<"root">>},
{password,<<"xyz">>},
{pool_size,1},
{encoding,utf8}]]}},
{restart_type,transient},
{shutdown,50},
{child_type,worker}]

@pratik1230
Copy link
Author

Hi,

something wrong please consider this scenario.

when i compile your module copy beam file to ejabberd and start ejabberd its work.
but now if i stop ejabberd once and trying to start its crash and give this error

Crash dump was written to: /opt/ejabberd-13.12/logs/erl_crash_20150107-074812.dump
Kernel pid terminated (application_controller) ({application_start_failure,kernel,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,net_kernel,{'EXIT',nodistribution}}}}},{k

now if i reboot my entire server and start ejabberd then it get started and again i do stop ejabberd same thing happening.

also at the end no messages in DB.

@mweibel
Copy link
Member

mweibel commented Jan 7, 2015

I think this has something to do with your setup itself, and not with the module. Could you please double-check and if it doesn't work please post more logs

@sawantuday
Copy link

I am facing the same problem. ejabberd version 14.07. compiled from source on ubuntu 14.04.
everything works fine but no logs in db. plus no errors in ejabberd logs too.
Also sometimes module gets stuck saying exit with reason pool_not_found in context child_terminated. Following are the logs

2015-01-13 02:16:57.499 [error] <0.2212.0> gen_server mod_log_chat_mysql5_localhost terminated with reason: poo
l_not_found
2015-01-13 02:16:57.499 [error] <0.2212.0> CRASH REPORT Process mod_log_chat_mysql5_localhost with 0 neighbours
 exited with reason: pool_not_found in gen_server:terminate/6 line 722
2015-01-13 02:16:57.499 [error] <0.1897.0>@gen_mod:stop_module_keep_config:126 {pool_not_found,{gen_server,call
,[mod_log_chat_mysql5_localhost,stop]}}
2015-01-13 02:16:57.499 [error] <0.2166.0> Supervisor ejabberd_sup had child mod_log_chat_mysql5_localhost star
ted with mod_log_chat_mysql5:start_link(<<"localhost">>, [{server,<<"localhost">>},{db,<<"ejabberd">>},{user,<<
"root">>},{password,<<"password">>}]) at <0.2212.0> exit with reason pool_not_found in context child_terminated

@mweibel
Copy link
Member

mweibel commented Jan 15, 2015

Is this happening right on startup or when stopping ejabberd?

@pratik1230
Copy link
Author

hi,

As i told you before after you updated this module according new version same issue coming.

and this is happend when we stop ejabberd and again if tried to start ejaaberd same error occurce and ejabberd crashed.

once i remove .beam file of this module ejabberd get started.

@sawantuday
Copy link

It happens right at start. but not the first start after adding module.

  1. When theres no BEAM process is running ejabberd starts normal with mod_log_chat_mysql5, but no logs in DB
  2. When I stop (ejabberdctl stop) the server and start (ejabberdctl start) it again, it starts complaining Pool not found leaving the server in terminated state. Here I have to disable the mod_log_chat_mysql5 module and start the server again.
  3. The error Pool not found does not occur when I restart (ejabberdctl restart) server rather than stop it and then start. But still no logs in DB.

@mweibel
Copy link
Member

mweibel commented Jan 19, 2015

if you comment out

emysql:remove_pool(mod_log_chat_mysql5_db),
does that make a difference?

@gotamafandy
Copy link

for those who have error "pool_not_found", try to change the code to:
emysql:add_pool(mod_log_chat_mysql5_db, [PoolSize, User, Password, Server, Port, DB, Encoding]),

in line 78. The error will gone, but still not be able to save the message.

@kishoreacesurf
Copy link

anybody got the solution?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants