Ejabberd: Bug: import_prosody fails at Prosody's mod_privacy data

Created on 28 Apr 2019  路  4Comments  路  Source: processone/ejabberd

Ejabberd version: 18.12.1
Prosody version: 0.11.2

I tried to import Prosody data into a fresh Ejabberd PostgreSQL database using

ejabberdctl import_prosody /var/lib/prosody/

Unfortunately the import failed:

Problem 'error {case_clause,
                   {error,
                       {{badmatch,{selected,[{1}]}},
                        [{mod_privacy_sql,'-set_lists/1-fun-1-',4,
                             [{file,"src/mod_privacy_sql.erl"},{line,95}]},
                         {lists,foreach,2,[{file,"lists.erl"},{line,1338}]},
                         {ejabberd_sql,outer_transaction,3,
                             [{file,"src/ejabberd_sql.erl"},{line,520}]},
                         {ejabberd_sql,run_sql_cmd,4,
                             [{file,"src/ejabberd_sql.erl"},{line,457}]},
                         {p1_fsm,handle_msg,10,
                             [{file,"src/p1_fsm.erl"},{line,582}]},
                         {proc_lib,init_p_do_apply,3,
                             [{file,"proc_lib.erl"},{line,247}]}]}}}' occurred executing the command.
Stacktrace: [{mod_privacy_sql,transaction,2,
                              [{file,"src/mod_privacy_sql.erl"},{line,257}]},
             {mod_privacy,set_list,1,
                          [{file,"src/mod_privacy.erl"},{line,312}]},
             {lists,foreach,2,[{file,"lists.erl"},{line,1338}]},
             {ejabberd_ctl,call_command,4,
                           [{file,"src/ejabberd_ctl.erl"},{line,352}]},
             {ejabberd_ctl,try_call_command,4,
                           [{file,"src/ejabberd_ctl.erl"},{line,321}]},
             {ejabberd_ctl,process2,4,
                           [{file,"src/ejabberd_ctl.erl"},{line,271}]},
             {ejabberd_ctl,process,2,
                           [{file,"src/ejabberd_ctl.erl"},{line,249}]},
             {rpc,'-handle_call_call/6-fun-0-',5,
                  [{file,"rpc.erl"},{line,187}]}]


2019-04-28 10:37:02.133 [error] <0.475.0>@mod_privacy_sql:-set_lists/1-fun-1-:95 gen_fsm <0.475.0> in state session_established terminated with reason: no match of right hand value {selected,[{1}]} in mod_privacy_sql:'-set_lists/1-fun-1-'/4 line 95
2019-04-28 10:37:02.134 [error] <0.475.0>@mod_privacy_sql:-set_lists/1-fun-1-:95 CRASH REPORT Process <0.475.0> with 0 neighbours exited with reason: no match of right hand value {selected,[{1}]} in mod_privacy_sql:'-set_lists/1-fun-1-'/4 line 95 in p1_fsm:terminate/8 line 760
2019-04-28 10:37:02.134 [error] <0.467.0>@mod_privacy_sql:-set_lists/1-fun-1-:95 Supervisor 'ejabberd_sql_sup_trashserver.net' had child 8 started with ejabberd_sql:start_link(<<"trashserver.net">>, 30000) at <0.475.0> exit with reason no match of right hand value {selected,[{1}]} in mod_privacy_sql:'-set_lists/1-fun-1-'/4 line 95 in context child_terminated

It turned out that the crash is related to (legacy) data of the mod_privacy module. Although not used any more, this data is still present in /var/lib/prosody/[vhost]/privacy. After removing the privacy directory, the import worked as it should :-)

@weiss

Bug Privacy

Most helpful comment

There was a small bug in mod_privacy_sql.erl that should affect other cases, but got unnoticed until you tried to import from Prosody.

All 4 comments

Can you provide some example Prosody files, so the problem can be reproduced?

Hi! I've just sent you an email regarding issue https://github.com/processone/ejabberd/issues/2874 . The email attachment also includes sample data for this issue :-)

There was a small bug in mod_privacy_sql.erl that should affect other cases, but got unnoticed until you tried to import from Prosody.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings