成功创建 MUC 后 Ejabberd 服务器崩溃

Ejabberd server crashing after successful MUC creation

我正在使用 xmpp.js 库创建一个简单的 XMPP 客户端和 Ejabberd 服务器 (ejabberd/ecs:最新 - docker 图片)。当我创建 MUC 时,它创建成功,我什至从服务器收到此成功消息:

<iq xmlns="jabber:client" xml:lang="en" to="admin@localhost/113578534561979249915762" 
  from="room167@conference.localhost" type="result" id="createGroup"/>

这是我的 MUC 创建代码:

xml("iq",{id:"createGroup",type:"set",to:`${id}@conference.localhost`},xml(
            "query",{xmlns:"http://jabber.org/protocol/muc#owner"},xml(
                "x",{xmlns:"jabber:x:data",type:"submit"},[
                    xml("field",{var:"muc#roomconfig_roomname"},xml("value",{},name)),
                    xml("field",{var:"muc#roomconfig_roomdesc"},xml("value",{},description))
                ]
            )
        ));

但是一旦创建了 MUC 并且我尝试查看 MUC,Ejabberd 服务器就会关闭并显示崩溃报告。

这是我的 Ejabberd 服务器 muc_mod 的配置:

mod_muc:
    access:
      - allow
    access_admin:
      - allow: admin
    access_create: muc_create
    access_persistent: muc_create
    access_mam:
      - allow
    default_room_options:
      allow_subscription: true
      mam: true
mod_muc_admin: {}

这是我收到的崩溃报告:

xmpp-server    | 2022-01-21 11:25:08.712377+00:00 [error] CRASH REPORT:
xmpp-server    |   crasher:
xmpp-server    |     initial call: ejabberd_http:init/3
xmpp-server    |     pid: <0.1407.0>
xmpp-server    |     registered_name: []
xmpp-server    |     exception error: undefined function lib:format_exception/6
xmpp-server    |       in function  ejabberd_hooks:safe_apply/4 (src/ejabberd_hooks.erl, line 247)
xmpp-server    |       in call from ejabberd_hooks:run_fold1/4 (src/ejabberd_hooks.erl, line 217)
xmpp-server    |       in call from ejabberd_web_admin:process_admin/3 (src/ejabberd_web_admin.erl, line 548)
xmpp-server    |       in call from ejabberd_http:process/2 (src/ejabberd_http.erl, line 373)
xmpp-server    |       in call from ejabberd_http:process_request/1 (src/ejabberd_http.erl, line 496)
xmpp-server    |       in call from ejabberd_http:process_header/2 (src/ejabberd_http.erl, line 293)
xmpp-server    |       in call from ejabberd_http:parse_headers/1 (src/ejabberd_http.erl, line 218)
xmpp-server    |     ancestors: [ejabberd_http_sup,ejabberd_sup,<0.184.0>]
xmpp-server    |     message_queue_len: 0
xmpp-server    |     messages: []
xmpp-server    |     links: [<0.720.0>,#Port<0.3190>]
xmpp-server    |     dictionary: []
xmpp-server    |     trap_exit: false
xmpp-server    |     status: running
xmpp-server    |     heap_size: 2586
xmpp-server    |     stack_size: 27
xmpp-server    |     reductions: 10478
xmpp-server    |   neighbours:
xmpp-server    |
xmpp-server    | 2022-01-21 11:25:08.716445+00:00 [error] SUPERVISOR REPORT:
xmpp-server    |     supervisor: {local,ejabberd_http_sup}
xmpp-server    |     errorContext: child_terminated
xmpp-server    |     reason: {undef,
xmpp-server    |                 [{lib,format_exception,
xmpp-server    |                      [2,error,
xmpp-server    |                       {badmatch,{error,timeout}},
xmpp-server    |                       [{mod_muc_admin,get_room_config,1,
xmpp-server    |                            [{file,"src/mod_muc_admin.erl"},{line,891}]},
xmpp-server    |                        {mod_muc_admin,build_info_room,1,
xmpp-server    |                            [{file,"src/mod_muc_admin.erl"},{line,603}]},
xmpp-server    |                        {mod_muc_admin,'-build_info_rooms/1-lc$^0/1-0-',1,
xmpp-server    |                            [{file,"src/mod_muc_admin.erl"},{line,600}]},
xmpp-server    |                        {mod_muc_admin,make_rooms_page,3,
xmpp-server    |                            [{file,"src/mod_muc_admin.erl"},{line,551}]},
xmpp-server    |                        {mod_muc_admin,web_page_main,2,
xmpp-server    |                            [{file,"src/mod_muc_admin.erl"},{line,518}]},
xmpp-server    |                        {ejabberd_hooks,safe_apply,4,
xmpp-server    |                            [{file,"src/ejabberd_hooks.erl"},{line,236}]},
xmpp-server    |                        {ejabberd_hooks,run_fold1,4,
xmpp-server    |                            [{file,"src/ejabberd_hooks.erl"},{line,217}]},
xmpp-server    |                        {ejabberd_web_admin,process_admin,3,
xmpp-server    |                            [{file,"src/ejabberd_web_admin.erl"},{line,548}]}],
xmpp-server    |                       #Fun<misc.6.25947704>,#Fun<misc.7.25947704>],
xmpp-server    |                      []},
xmpp-server    |                  {ejabberd_hooks,safe_apply,4,
xmpp-server    |                      [{file,"src/ejabberd_hooks.erl"},{line,247}]},
xmpp-server    |                  {ejabberd_hooks,run_fold1,4,
xmpp-server    |                      [{file,"src/ejabberd_hooks.erl"},{line,217}]},
xmpp-server    |                  {ejabberd_web_admin,process_admin,3,
xmpp-server    |                      [{file,"src/ejabberd_web_admin.erl"},{line,548}]},
xmpp-server    |                  {ejabberd_http,process,2,
xmpp-server    |                      [{file,"src/ejabberd_http.erl"},{line,373}]},
xmpp-server    |                  {ejabberd_http,process_request,1,
xmpp-server    |                      [{file,"src/ejabberd_http.erl"},{line,496}]},
xmpp-server    |                  {ejabberd_http,process_header,2,
xmpp-server    |                      [{file,"src/ejabberd_http.erl"},{line,293}]},
xmpp-server    |                  {ejabberd_http,parse_headers,1,
xmpp-server    |                      [{file,"src/ejabberd_http.erl"},{line,218}]}]}
xmpp-server    |     offender: [{pid,<0.1407.0>},
xmpp-server    |                {id,undefined},
xmpp-server    |                {mfargs,{ejabberd_http,start_link,undefined}},
xmpp-server    |                {restart_type,temporary},
xmpp-server    |                {shutdown,5000},
xmpp-server    |                {child_type,worker}]

我试过几次重启服务器都没有用。

首先:你没有提到你使用的是哪个版本的ejabberd。也许这是最近版本中修复的错误?

您使用自定义 XMPP 客户端创建了一个新房间。为什么错误消息会提到 ejabberd_httpejabberd_web_admin?当您尝试在 WebAdmin -> MUC 页面中查看房间详细信息时,可能会出现该错误消息?

有一个 {error, timeout} 然后会触发其他错误。我想只有你知道那里发生了什么......因为这个日志提到了你没有提到的东西。

尝试使用 well-known XMPP 客户端(例如 Gajim 或 Psi)创建房间。 WebAdmin 页面是否正常工作?那么问题出在您的客户端中。

使用 XMPP 客户端创建一个房间,然后使用您的客户端创建另一个房间。然后查看存储在muc_online_room mnesia table中的信息(WebAdmin -> Nodes -> your node -> Database。你看到一些奇怪的区别了吗?

设置persistent: true创建新房间并检查muc_roomtable的内容。现在有什么奇怪的区别吗?