processone / ejabberd

Robust, Ubiquitous and Massively Scalable Messaging Platform (XMPP, MQTT, SIP Server)
https://www.process-one.net/en/ejabberd/
Other
6.03k stars 1.5k forks source link

"error: no function clause matching mod_muc_rtbl:parse_initial_items(timeout)" #4050

Closed raucao closed 1 year ago

raucao commented 1 year ago

Saw this during startup/reloading today.

Environment

Errors from error.log/crash.log

2023-06-21 08:43:31.328556+00:00 [error] Failed to process iq response: timeout
** exception error: no function clause matching
                  mod_muc_rtbl:parse_initial_items(timeout) (src/mod_muc_rtbl.erl, line 76)
   in function  ejabberd_iq:callback/3 (src/ejabberd_iq.erl, line 176)
   in call from ejabberd_iq:clean/1 (src/ejabberd_iq.erl, line 124)
   in call from ejabberd_iq:handle_info/2 (src/ejabberd_iq.erl, line 98)
   in call from gen_server:try_dispatch/4 (gen_server.erl, line 1123)
   in call from gen_server:handle_msg/6 (gen_server.erl, line 1200)
   in call from proc_lib:init_p_do_apply/3 (proc_lib.erl, line 240)

Bug description

No visible side effects (difficult to judge due to the nature or RTBL). I wonder if it's possible to easily verify the currently loaded blocklist.

badlop commented 1 year ago

No visible side effects (difficult to judge due to the nature or RTBL).

That module stores the retrieved list in the mnesia table muc_rtbl, but only in RAM, so I guess it is populated everytime ejabberd starts. And, if it timeouts during startup, then it's empty.

I wonder if it's possible to easily verify the currently loaded blocklist.

You can check some information about the mnesia tables in ejabberd's WebAdmin -> Nodes -> your node -> Database.

no function clause matching mod_muc_rtbl:parse_initial_items(timeout)

It seems there are several error cases and yours is not handled correctly. In my case, the code detects correctly the problem:

2023-06-21 17:10:48.356276+02:00 [warning]
 Fetching initial list failed: <<"Stream closed by peer:
   Attempt to connect from a host we serve (undefined-condition) (remote-server-timeout)">>

Also, when this fails, it fails and doesn't recover, and doesn't try again later. Also there is no way to refresh the list administratively.

badlop commented 1 year ago

To try again to get the list, you can stop and start the module manually:

  1. Open an erlang shell attached to your running ejabberd node. For example, running "ejabberdctl debug"
  2. In that shell, stop the module (replace with your vhost, and notice the dot at the end):
    gen_mod:stop_module(<<"xmpp.example.org">>, mod_muc_rtbl).
  3. Then start the module again:
    gen_mod:start_module(<<"xmpp.example.org">>, mod_muc_rtbl).
  4. Close the erlang shell pressing control+c, control+c
dkliss commented 1 year ago

Same error for me as well, noticed it today only during reinstall (23.04).

When I see web admin node for rtbl. It shows an empty list.

[muc_rtbl]

[] 
2023-07-04 12:45:40.644106+00:00 [error] Failed to process iq response:
timeout
** exception error: no function clause matching 
                  mod_muc_rtbl:parse_initial_items(timeout) (src/mod_muc_rtbl.erl, line 76)
   in function  ejabberd_iq:callback/3 (src/ejabberd_iq.erl, line 176)
   in call from ejabberd_iq:clean/1 (src/ejabberd_iq.erl, line 124)
   in call from ejabberd_iq:handle_info/2 (src/ejabberd_iq.erl, line 98)
   in call from gen_server:try_dispatch/4 (gen_server.erl, line 1123)
   in call from gen_server:handle_msg/6 (gen_server.erl, line 1200)
   in call from proc_lib:init_p_do_apply/3 (proc_lib.erl, line 240)
prefiks commented 1 year ago

This should be fixed by commit 54314e5bb973521a5676c1a802c7163d31db994d