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

Database failure on Pubsub node configuration #4011

Closed edhelas closed 1 year ago

edhelas commented 1 year ago

Environment

XMPP logs

<iq xmlns="jabber:client" from="miho@movim.eu/moviml8gk8A" to="miho@movim.eu" type="get" id="nWZxZL">
    <pubsub xmlns="http://jabber.org/protocol/pubsub#owner">
        <configure node="urn:xmpp:microblog:0"/>
    </pubsub>
</iq>
<iq xml:lang='en' to='miho@movim.eu/moviml8gk8A' from='miho@movim.eu' type='error' id='nWZxZL'>
    <pubsub xmlns='http://jabber.org/protocol/pubsub#owner'>
        <configure node='urn:xmpp:microblog:0'/>
    </pubsub>
    <error type='wait'>
        <internal-server-error xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        <text xml:lang='en'
            xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>Database failure</text>
    </error>
</iq>

ejabberd error.log

2023-03-20 08:29:57.399802+01:00 [error] <0.14044.77>@mod_pubsub:get_transaction_response/1:3959 Transaction aborted:
** exception error: no function clause matching 
                  xmpp_util:encode_limit(infinity) (xmpp_util.erl, line 86)
   in function  pubsub_node_config:encode_max_items/3 (pubsub_node_config.erl, line 1854)
   in call from pubsub_node_config:'-encode/3-lc$^0/1-0-'/3 (pubsub_node_config.erl, line 313)
   in call from pubsub_node_config:'-encode/3-lc$^0/1-0-'/3 (pubsub_node_config.erl, line 423)
   in call from pubsub_node_config:encode/3 (pubsub_node_config.erl, line 423)
   in call from mod_pubsub:'-get_configure/5-fun-0-'/6 (mod_pubsub.erl, line 3326)
   in call from mod_pubsub:'-transaction/4-fun-0-'/3 (mod_pubsub.erl, line 3898)
   in call from mod_pubsub:'-do_transaction/4-fun-0-'/3 (mod_pubsub.erl, line 3920)
prefiks commented 1 year ago

Looks like there is a mismatch when disabling limits of items, one side want to use 'infinity' for that where other expect 'max'. Will try to fix this.

prefiks commented 1 year ago

Added change 3c97775573d672f185a3d5839ec82e5fb3debbc5 that i think should fix this.

badlop commented 1 year ago

@edhelas If you don't compile ejabberd yourself, you can find binary packages of ejabberd with that fix on the bottom of page https://github.com/processone/ejabberd/actions/runs/4480250617

Probably you can simply extract one of them and copy mod_pubsub.beam to replace the one in your deployment. (Keep a backup of the old beam file, in case ejabberd cannot start)

edhelas commented 1 year ago
<iq to='miho@movim.eu' type='get' id='nWfZxZL'>
    <pubsub xmlns='http://jabber.org/protocol/pubsub#owner'>
        <configure node='urn:xmpp:microblog:0'/>
    </pubsub>
</iq>
<iq lang='en' to='miho@movim.eu/6916870486585674733994' from='miho@movim.eu' type='result' id='nWfZxZL'>
        <pubsub xmlns='http://jabber.org/protocol/pubsub#owner'>
        <configure node='urn:xmpp:microblog:0'>
            <x xmlns='jabber:x:data' type='form'>
...
            </x>
        </configure>
    </pubsub>
</iq>

I replaced mod_pubsub.beam looks good now :+1: