Skip to content

mod_event_pusher_rabbit errors with user messages #4551

@hpedrorodrigues

Description

@hpedrorodrigues

MongooseIM version: 6.4.0
Installed from: image
Erlang/OTP version: 27


Hey 👋🏻

After updating MongooseIM to the latest version (6.4.0), I noticed a few error logs related to mod_event_pusher_hook_translator.

logs
{
  "jsonPayload": {
    "class": "error",
    "stacktrace_args": "[undefined]",
    "text": "Error running hook",
    "what": "hook_failed",
    "meta": {
      "line": "257",
      "file": "/home/circleci/project/src/gen_hook.erl",
      "mfa": "{gen_hook,error_running_hook,5}",
      "pid": "<0.1040396.0>"
    },
    "origin_pid": "<0.1040396.0>",
    "acc_timestamp": "2025-07-23T17:48:33.736397+00:00",
    "stacktrace": "exml_query:cdata/1:244 mod_event_pusher_rabbit:handle_user_chat_event/2:124 mod_event_pusher_rabbit:push_event/2:94 lists:foldl/3:2146 mod_event_pusher_hook_translator:push_chat_event/4:110 mod_event_pusher_hook_translator:user_send_message/3:65 gen_hook:apply_hook_function/3:254 gen_hook:run_hook/4:240",
    "packet": "<message from='6849c597ea5d634c11d5c763@localhost' id='wuG3zjy7SM8Zr6RTcwnt7' to='bc4c0916-14c7-4f9c-90cd-61255cd9104b@conference.localhost' type='groupchat' xmlns='jabber:client'><displayed id='aS9DH8h2ANUr0ltOF31oV' xmlns='urn:xmpp:chat-markers:0'/></message>",
    "key": "{user_send_message,<<\"localhost\">>}",
    "handler": "{hook_handler,90,fun mod_event_pusher_hook_translator:user_send_message/3,#{host_type => <<\"localhost\">>,hook_name => user_send_message,hook_tag => <<\"localhost\">>}}",
    "params": {
      "event_content": "{xmlel,<<\"message\">>,#{<<\"from\">> => <<\"6849c597ea5d634c11d5c763@localhost\">>,<<\"id\">> => <<\"wuG3zjy7SM8Zr6RTcwnt7\">>,<<\"to\">> => <<\"bc4c0916-14c7-4f9c-90cd-61255cd9104b@conference.localhost\">>,<<\"type\">> => <<\"groupchat\">>,<<\"xmlns\">> => <<\"jabber:client\">>},[{xmlel,<<\"displayed\">>,#{<<\"id\">> => <<\"aS9DH8h2ANUr0ltOF31oV\">>,<<\"xmlns\">> => <<\"urn:xmpp:chat-markers:0\">>},[]}]}",
      "event_type": "internal",
      "reason": "undefined",
      "c2s_state": "session_established",
      "c2s_data": "{c2s_data,<<\"localhost\">>,<<\"localhost\">>,<<\"en\">>,{1753292863806892,<0.1040396.0>},<<\"559a3c8e583dc592\">>,{jid,<<\"6849c597ea5d634c11d5c763\">>,<<\"localhost\">>,<<\"1753-292433-375691-395a30ac9f66ad4c\">>},{xmpp_socket,mod_websockets,{websocket,<0.1040394.0>,{{10,66,210,3},54004},undefined},c2s,{{10,66,210,3},54004}},{parser,#Ref<0.1126533968.3428974594.202399>,[]},none,#{access => all,module => ejabberd_cowboy,port => 5280,hibernate_after => 0,state_timeout => 5000,shaper => none,connection_type => c2s,ip_address => \"0.0.0.0\",ip_tuple => {0,0,0,0},ip_version => inet,max_stanza_size => 0,backwards_compatible_session => true,proto => tcp},#{mod_stream_management => {sm_state,[],0,8,178,10000,never,{sid,{1753292801312400,<19692.990564.0>}}}},#{ip => {{10,66,210,3},54004},auth_module => mod_auth_token,conn => tcp}}"
    },
    "when": "2025-07-23T17:48:33.736536+00:00",
    "reason": "function_clause",
    "to_jid": "bc4c0916-14c7-4f9c-90cd-61255cd9104b@conference.localhost",
    "from_jid": "6849c597ea5d634c11d5c763@localhost/1753-292433-375691-395a30ac9f66ad4c",
    "level": "error"
  }
}
{
  "jsonPayload": {
    "reason": "function_clause",
    "class": "error",
    "when": "2025-07-23T17:48:33.737042+00:00",
    "level": "error",
    "stacktrace_args": "[undefined]",
    "params": {},
    "handler": "{hook_handler,80,fun mod_event_pusher_hook_translator:filter_local_packet/3,#{host_type => <<\"localhost\">>,hook_name => filter_local_packet,hook_tag => <<\"localhost\">>}}",
    "key": "{filter_local_packet,<<\"localhost\">>}",
    "stacktrace": "exml_query:cdata/1:244 mod_event_pusher_rabbit:handle_user_chat_event/2:124 mod_event_pusher_rabbit:push_event/2:94 lists:foldl/3:2146 mod_event_pusher_hook_translator:push_chat_event/4:110 mod_event_pusher_hook_translator:filter_local_packet/3:53 gen_hook:apply_hook_function/3:254 gen_hook:run_hook/4:240",
    "text": "Error running hook",
    "what": "hook_failed",
    "meta": {
      "mfa": "{gen_hook,error_running_hook,5}",
      "line": "257",
      "pid": "<0.1040396.0>",
      "file": "/home/circleci/project/src/gen_hook.erl"
    }
  }
}

mongooseim-logs.json

Based on the logs, it seems related to user events (message stanzas) but I could not figure out yet what exactly causes this issue.

For context:

  • RabbitMQ cluster is healthy (and no errors in the logs)
  • Tested sending a few messages and it worked fine
mongooseim.toml
# https://esl.github.io/MongooseDocs/latest/configuration/general
[general]
loglevel = "info"
language = "en"
hosts = ["localhost"]
default_server_domain = "localhost"
registration_timeout = "infinity"
rdbms_server_type = "pgsql"
sm_backend = "redis"

[instrumentation.prometheus]

# https://esl.github.io/MongooseDocs/latest/listeners/listen-http/#example-7-prometheus
# Prometheus
[[listen.http]]
port = 9091

[[listen.http.handlers.mongoose_prometheus_handler]]
host = "_"
path = "/metrics"

# https://esl.github.io/MongooseDocs/latest/configuration/listen/
# BOSH (Bidirectional-streams Over Synchronous HTTP | HTTP long-polling) and WebSockets
[[listen.http]]
ip_address = "0.0.0.0"
port = 5280
transport.num_acceptors = 10
transport.max_connections = 1024

[[listen.http.handlers.mod_bosh]]
host = "_"
path = "/http-bind"

[[listen.http.handlers.mod_websockets]]
host = "_"
path = "/ws-xmpp"

# REST client port: https://esl.github.io/MongooseDocs/latest/rest-api/Client-frontend/
[[listen.http]]
ip_address = "0.0.0.0"
port = 8088
transport.num_acceptors = 10
transport.max_connections = 1024
protocol.compress = true

[[listen.http.handlers.mongoose_client_api]]
host = "_"
path = "/api"

[[listen.http.handlers.mongoose_graphql_handler]]
host = "_"
path = "/api/graphql"
schema_endpoint = "user"

# REST admin port: https://esl.github.io/MongooseDocs/latest/rest-api/Administration-backend/
[[listen.http]]
ip_address = "0.0.0.0"
port = 8089
transport.num_acceptors = 10
transport.max_connections = 1024
protocol.compress = true

[[listen.http.handlers.mod_websockets]]
host = "_"
path = "/ws-xmpp"

[[listen.http.handlers.mongoose_admin_api]]
host = "_"
path = "/api"
username = "[redacted]"
password = "[redacted]"

[[listen.http.handlers.mongoose_graphql_handler]]
host = "_"
path = "/api/graphql"
schema_endpoint = "admin"
username = "[redacted]"
password = "[redacted]"

# Client-to-server connections
[[listen.c2s]]
port = 5222
access = "c2s"
shaper = "normal"
max_stanza_size = 65536

[auth]
methods = ["rdbms"]
sasl_external = ["standard"]

[auth.rdbms]
users_number_estimate = true

[outgoing_pools.redis.default]
scope = "global"

[outgoing_pools.redis.default.connection]
host = "[redacted]"
port = 6379
database = 0

[outgoing_pools.rdbms.default]
scope = "global"

[outgoing_pools.rdbms.default.connection]
driver = "pgsql"
host = "[redacted]"
port = 5432
database = "[redacted]"
username = "[redacted]"
password = "[redacted]"

[modules.mod_adhoc]

[modules.mod_disco]
users_can_see_hidden_services = false

[modules.mod_cache_users]

[modules.mod_ping]

[modules.mod_muc_log]

[modules.mod_muc_light]
host = "conference.@HOST@"
backend = "rdbms"
legacy_mode = false
equal_occupants = false
all_can_configure = false
all_can_invite = false
max_occupants = 100
rooms_in_rosters = false

[modules.mod_presence]

[modules.mod_mam]
muc.backend = "rdbms" # enables MUC support and overrides its backend
backend = "rdbms"
no_stanzaid_element = true
pm.user_prefs_store = "rdbms"
archive_chat_markers = true
max_result_limit = 1000
pm.archive_groupchats = false

[modules.mod_inbox]
backend = "rdbms_async"
reset_markers = ["displayed"]
groupchat = ["muclight"]
aff_changes = false
remove_on_kicked = true

[modules.mod_stream_management]
buffer_max = 10000
ack = false

[modules.mod_last]
backend = "rdbms"

[modules.mod_roster]
backend = "rdbms"

[modules.mod_private]
backend = "rdbms"

[modules.mod_caps]
cache_size = 2000
cache_life_time = 10_000

[modules.mod_event_pusher.rabbit]
presence_exchange.name = "presence"
presence_exchange.type = "topic"
chat_msg_exchange.name = "chat_msg"
chat_msg_exchange.sent_topic = "mongooseim_chat_msg_sent"
chat_msg_exchange.recv_topic = "mongooseim_chat_msg_recv"
groupchat_msg_exchange.name = "groupchat_msg"
groupchat_msg_exchange.sent_topic = "mongooseim_groupchat_msg_sent"
groupchat_msg_exchange.recv_topic = "mongooseim_groupchat_msg_recv"

[outgoing_pools.rabbit.event_pusher.connection]
host = "[redacted]"
port = 5672
username = "[redacted]"
password = "[redacted]"
confirms_enabled = false
max_worker_queue_len = 1000

[modules.mod_offline_stub]

[modules.mod_sic]

[modules.mod_vcard]
host = "vjud.@HOST@"
backend = "rdbms"

[modules.mod_auth_token]
backend = "rdbms"
iqdisc.type = "queues"
iqdisc.workers = 20
validity_period.access = {value = 7, unit = "days"}
validity_period.refresh = {value = 25, unit = "days"}

[modules.mod_keystore]
keys = [{name = "token_secret", type = "ram"}]

[shaper.normal]
max_rate = 1000

[shaper.fast]
max_rate = 50_000

[shaper.mam_shaper]
max_rate = 1

[shaper.mam_global_shaper]
max_rate = 1000

[acl]
local = [{}]

[access]
max_user_sessions = [
  {acl = "all", value = 10}
]

max_user_offline_messages = [
  {acl = "admin", value = 5000},
  {acl = "all", value = 100}
]

local = [
  {acl = "local", value = "allow"}
]

c2s = [
  {acl = "blocked", value = "deny"},
  {acl = "all", value = "allow"}
]

muc_admin = [
  {acl = "admin", value = "allow"}
]

muc_create = [
  {acl = "local", value = "allow"}
]

muc = [
  {acl = "all", value = "allow"}
]

mam_set_prefs = [
  {acl = "all", value = "default"}
]

mam_get_prefs = [
  {acl = "all", value = "default"}
]

mam_lookup_messages = [
  {acl = "all", value = "default"}
]

mam_set_prefs_shaper = [
  {acl = "all", value = "mam_shaper"}
]

mam_get_prefs_shaper = [
  {acl = "all", value = "mam_shaper"}
]

mam_lookup_messages_shaper = [
  {acl = "all", value = "mam_shaper"}
]

mam_set_prefs_global_shaper = [
  {acl = "all", value = "mam_global_shaper"}
]

mam_get_prefs_global_shaper = [
  {acl = "all", value = "mam_global_shaper"}
]

mam_lookup_messages_global_shaper = [
  {acl = "all", value = "mam_global_shaper"}
]

[[host_config]]
host = "anonymous.localhost"

[host_config.auth.anonymous]
allow_multiple_connections = true
protocol = "both"

Not sure if I'm missing something here. Any help will be appreciated! Thanks. 🙏🏻

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions