processone / processone/ejabberd
Weird behavior of mod_privilege
Nobody has claimed this yet.
- Dominant language
- Erlang
- Stars
- 6.7k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
Environment
- ejabberd version: all over the past few years
- OS: Linux (Debian 12, 13)
- Installed from: official deb
May be related to #4472
Bug description
With turned on mod_privilege i see periodic (~1 per minute) crashes in logs.
I see random components in the logs, not only mentioned rss.JW (and they don't use mod_privilege).
Configuration
Related part:
mod_privilege:
iq:
http://jabber.org/protocol/pubsub:
both: slidge_rule
http://jabber.org/protocol/pubsub#owner:
both: slidge_rule
http://jabber.org/protocol/pubsub#publish-options:
both: slidge_rule
roster:
both: slidge_rule
presence:
roster: slidge_rule
message:
outgoing: slidge_rule
Errors from system log
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: 2026-08-20 13:11:45.979 [error] Hook :component_send_packet crashed when running :mod_privilege::component_send_packet/1:
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: ** exception error: no function clause matching
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: mod_privilege:get_iq_encapsulated_details({iq,
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: <<"keepalive:2026-08-20T13:11:45Z">>,
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: result,<<>>,
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: {jid,<<>>,
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: <<"rss.jabberworld.info">>,
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: <<>>,<<>>,
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: <<"rss.jabberworld.info">>,
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: <<>>},
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: {jid,<<>>,
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: <<"jabbers.one">>,
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: <<>>,<<>>,
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: <<"jabbers.one">>,
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: <<>>},
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: [],
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: #{ip =>
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: {127,0,0,1}}}) (src/mod_privilege.erl:571)
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: in function mod_privilege:component_send_packet/1 (src/mod_privilege.erl:274)
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: in call from ejabberd_hooks:safe_apply/4 (src/ejabberd_hooks.erl:457)
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: in call from ejabberd_hooks:run_fold1/4 (src/ejabberd_hooks.erl:404)
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: in call from ejabberd_service:handle_authenticated_packet/2 (src/ejabberd_service.erl:210)
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: in call from xmpp_stream_in:process_authenticated_packet/2 (/home/runner/work/ejabberd/ejabberd/deps/xmpp/src/xmpp_stream_in.erl:791)
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: in call from xmpp_stream_in:handle_info/2 (/home/runner/work/ejabberd/ejabberd/deps/xmpp/src/xmpp_stream_in.erl:434)
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: in call from p1_server:handle_msg/8 (/home/runner/work/ejabberd/ejabberd/deps/p1_utils/src/p1_server.erl:718)
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: ** Arg 1 = {{:iq, "keepalive:2026-08-20T13:11:45Z", :result, "",
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: {:jid, "", "rss.jabberworld.info", "", "", "rss.jabberworld.info", ""},
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: {:jid, "", "jabbers.one", "", "", "jabbers.one", ""}, [],
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: %{ip: {127, 0, 0, 1}}},
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: %{
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: access: :all,
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: owner: #PID<0.515942.0>,
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: user: "",
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: socket: {:socket_state, :gen_tcp, #Port<0.629675>, :infinity, :infinity,
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: #Reference<0.439526923.3498704897.72219>, :none, :none, :none},
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: ip: {{127, 0, 0, 1}, 34892},
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: mod: :ejabberd_service,
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: server: "jabberworld.info",
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: resource: "",
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: lserver: "",
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: codec_options: [:ignore_els],
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: lang: "ru",
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: tls_options: [:compression_none],
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: stream_encrypted: false,
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: remote_server: "rss.jabberworld.info",
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: xmlns: "jabber:component:accept",
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: check_from: true,
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: global_routes: true,
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: host_opts: %{"rss.jabberworld.info" => "SECRET"},
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: stream_version: :undefined,
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: routes: ["rss.jabberworld.info"],
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: stream_id: "4373975191512974842",
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: stream_state: :established,
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: stream_authenticated: true,
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: stream_timeout: :infinity,
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: stream_direction: :in,
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: stream_restarted: false,
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: socket_monitor: #Reference<0.439526923.3498573825.72220>,
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: stream_header_sent: true,
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: stream_compressed: false
Aug 20 13:11:45 vps1nl ejabberdctl[9076]: }}
Aug 20 13:11:55 vps1nl ejabberdctl[9076]: 2026-08-20 13:11:55.865 [info] IQ not forwarded: Component seems disconnected
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/mod_privilege.erl at component_send_packet/1 and get_iq_encapsulated_details/1, using the reported stack trace as the entry point. Reproduce or trace the component_send_packet hook with the shown result IQ and mod_privilege configuration. Done means the packet no longer causes a function-clause crash and the related behavior is covered by an appropriate regression check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- erlang
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 48/100