processone / ejabberd

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

mod_offline error - case_clause undefined #2774

Closed gylraj closed 5 years ago

gylraj commented 5 years ago

Environment

Configuration (only if needed): grep -Ev '^$|^\s*#' ejabberd.yml

loglevel: 4
log_rotate_size: 10485760
log_rotate_date: ""
log_rotate_count: 1
log_rate_limit: 100
hosts:
  - "chat.cs.com"
certfiles:
  - "/opt/ejabberd-18.09/conf/server.pem"
ca_file: "/opt/ejabberd-18.09/conf/cacert.pem"
listen:
  -
    port: 5222
    ip: "::"
    module: ejabberd_c2s
    starttls: true
    max_stanza_size: 131072
    shaper: c2s_shaper
    access: c2s
  -
    port: 5269
    ip: "::"
    module: ejabberd_s2s_in
    max_stanza_size: 131072
    shaper: s2s_shaper
  -
    port: 5280
    ip: "::"
    module: ejabberd_http
    request_handlers:
      "/ws": ejabberd_http_ws
      "/bosh": mod_bosh
      "/oauth": ejabberd_oauth
      "/api": mod_http_api
    web_admin: true
    captcha: false
  -
    port: 5282
    ip: "::"
    module: ejabberd_http
    request_handlers:
      "/ws": ejabberd_http_ws
      "/bosh": mod_bosh
      "/oauth": ejabberd_oauth
      "/api": mod_http_api
    web_admin: true
    tls: true
    captcha: false
    http_bind: true
s2s_use_starttls: optional
auth_method: sql
sql_type: mysql
sql_server: "111.11.11.11"
sql_database: "ejabberd"
sql_username: "root"
sql_password: "pass"
new_sql_schema: true
shaper:
  normal: 1000
  fast: 50000
max_fsm_queue: 1000
acl:
  admin:
    user:
      - "admin@chat.cs.com"
  local:
    user_regexp: ""
  loopback:
    ip:
      - "127.0.0.0/8"
      - "::1/128"
      - "::FFFF:127.0.0.1/128"
shaper_rules:
  max_user_sessions: 10
  max_user_offline_messages:
    - 5000: admin
    - infinity
  c2s_shaper:
    - none: admin
    - normal
  s2s_shaper: fast
access_rules:
  local:
    - allow: local
  c2s:
    - deny: blocked
    - allow
  announce:
    - allow: admin
  configure:
    - allow: admin
  muc_create:
    - allow: local
  pubsub_createnode:
    - allow: local
  register:
    - allow
  trusted_network:
    - allow: loopback
api_permissions:
  "console commands":
    from:
      - ejabberd_ctl
    who: all
    what: "*"
  "admin access":
    who: all
    what:
      - "*"
      - "!stop"
      - "!start"
  "public commands":
    who: all
    what:
      - "*"
      - "!stop"
      - "!start"
registration_timeout: infinity

language: "en"
acme:
   contact: "mailto:admin@ip-111-111-111-111.eu-west-3.compute.internal"
   ca_url: "https://acme-v01.api.letsencrypt.org"
modules:
  mod_offline_post:
    auth_token: "secret"
    post_url: "http://api.cs.com/users/push"
    post_url_json: "http://api.cs.com/users/pushjson"
    post_url_read: "http://api.cs.com/users/setmessagestatusxmpp"
  mod_adhoc: {}
  mod_admin_extra: {}
  mod_announce: # recommends mod_adhoc
    access: announce
    db_type: sql
  mod_blocking: {} # requires mod_privacy
  mod_caps: 
    db_type: sql
  mod_carboncopy: {}
  mod_client_state: {}
  mod_configure: {} # requires mod_adhoc
  mod_disco: {}
  mod_bosh: {}
  mod_last:
    db_type: sql
  mod_mam:
    db_type: sql
    use_cache: true
    default: always
    request_activates_archiving: false
    assume_mam_usage: false
  mod_muc:
    db_type: sql
    host: "room.@HOST@"
    access:
      - allow: all
    access_admin: ## all
      - allow: admin
    access_create: all
    access_persistent: all
    max_user_conferences: 3000000
    max_users: 10000
    max_users_admin_threshold: 1000
    default_room_options:
      persistent: true
      allow_subscription: true
      allow_query_users: true
      allow_private_messages: true
      allow_user_invites: true
      allow_visitor_nickchange: true
      anonymous: false
      captcha_protected: false
      mam: true
      members_by_default: true
      members_only: false
      public: true
      public_list: true
  mod_muc_admin: {}
  mod_offline:
    db_type: sql
    access_max_user_messages: max_user_offline_messages
    store_empty_body: unless_chat_state
  mod_ping:
    send_pings: true
    ping_interval: 32
    ping_ack_timeout: 5
    timeout_action: kill
  mod_privacy:
    db_type: sql
  mod_private:
    db_type: sql
  mod_pubsub:
    db_type: sql
    access_createnode: pubsub_createnode
    ignore_pep_from_offline: true
    last_item_cache: false
    max_items_node: 25
    plugins:
      - "flat"
      - "pep" # pep requires mod_caps
    force_node_config:
      "eu.siacs.conversations.axolotl.*":
        access_model: whitelist
      "storage:bookmarks":
        access_model: whitelist
        max_items: 25
      "urn:xmpp:bookmarks:0":
        access_model: whitelist
        max_items: 25
  mod_push: {}
  mod_push_keepalive: {}
  mod_register:
    welcome_message:
      subject: "Welcome!"
      body: |-
        Hi.
        Welcome to this XMPP server.
    ip_access: trusted_network
    access: register
  mod_roster:
    versioning: true
    store_current_id: true
    db_type: sql
  mod_shared_roster: {}
  mod_time: {}
  mod_vcard:
    db_type: sql
    search: true 
  mod_vcard_xupdate: {}
  mod_avatar: {}
  mod_version: {}
  mod_stream_mgmt:
    max_ack_queue: infinity
    resume_timeout: 120
    resend_on_timeout: true
    max_resume_timeout: 120
  mod_s2s_dialback: {}
  mod_http_api: {}
allow_contrib_modules: true

Plz Help 👍

If there's error in my config, please tell me. thanks in advance

Problem:

crash.log
2019-01-21 11:13:35 =SUPERVISOR REPORT====
     Supervisor: {local,ejabberd_sup}
     Context:    shutdown_error
     Reason:     killed
     Offender:   [{pid,<0.468.0>},{id,ejabberd_sm},{mfargs,{ejabberd_sm,start_link,[]}},{restart_type,permanent},{shutdown,30000},{child_type,worker}]

2019-01-21 11:14:07 =SUPERVISOR REPORT====
     Supervisor: {local,ejabberd_listener}
     Context:    start_error
     Reason:     eaddrinuse
     Offender:   [{pid,undefined},{id,{5222,{0,0,0,0,0,0,0,0},tcp}},{mfargs,{ejabberd_listener,start,[{5222,{0,0,0,0,0,0,0,0},tcp},ejabberd_c2s,[{ip,{0,0,0,0,0,0,0,0}},{starttls,true},{max_stanza_size,131072},{shaper,c2s_shaper},{access,c2s}]]}},{restart_type,transient},{shutdown,brutal_kill},{child_type,worker}]

2019-01-21 11:14:07 =SUPERVISOR REPORT====
     Supervisor: {local,ejabberd_sup}
     Context:    start_error
     Reason:     {shutdown,{failed_to_start_child,{5222,{0,0,0,0,0,0,0,0},tcp},eaddrinuse}}
     Offender:   [{pid,undefined},{id,ejabberd_listener},{mfargs,{ejabberd_listener,start_link,[]}},{restart_type,permanent},{shutdown,infinity},{child_type,supervisor}]

2019-01-21 11:14:58 =ERROR REPORT====
** Generic server memsup terminating 
** Last message in was {'EXIT',<0.2766.0>,{port_died,normal}}
** When Server state == [{data,[{"Timeout",60000}]},{items,{"Memory Usage",[{"Allocated",1311633408},{"Total",16333672448}]}},{items,{"Worst Memory User",[{"Pid",<0.2827.0>},{"Memory",7648456}]}}]
** Reason for termination == 
** {port_died,normal}
2019-01-21 11:14:58 =CRASH REPORT====
  crasher:
    initial call: memsup:init/1
    pid: <0.2765.0>
    registered_name: memsup
    exception exit: {{port_died,normal},[{gen_server,handle_common_reply,8,[{file,"gen_server.erl"},{line,751}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]}
    ancestors: [os_mon_sup,<0.2763.0>]
    message_queue_len: 0
    messages: []
    links: [<0.2764.0>]
    dictionary: []
    trap_exit: true
    status: running
    heap_size: 2586
    stack_size: 27
    reductions: 117827
  neighbours:
2019-01-21 11:14:58 =SUPERVISOR REPORT====
     Supervisor: {local,os_mon_sup}
     Context:    child_terminated
     Reason:     {port_died,normal}
     Offender:   [{pid,<0.2765.0>},{id,memsup},{mfargs,{memsup,start_link,[]}},{restart_type,permanent},{shutdown,2000},{child_type,worker}]

error.log

2019-01-21 11:13:35.307 [error] <0.351.0> Supervisor ejabberd_sup had child ejabberd_sm started with ejabberd_sm:start_link() at <0.468.0> exit with reason killed in context shutdown_error
2019-01-21 11:13:36.598 [error] <0.21012.0>@ejabberd_hooks:safe_apply:384 Hook offline_message_hook crashed when running mod_offline:store_packet/1:
** Reason = {error,{case_clause,undefined},[{mod_offline,need_to_store,[{file,"src/mod_offline.erl"},{line,380}],2},{mod_offline,store_packet,[{file,"src/mod_offline.erl"},{line,396}],1},{ejabberd_hooks,safe_apply,[{file,"src/ejabberd_hooks.erl"},{line,380}],4},{ejabberd_hooks,run_fold1,[{file,"src/ejabberd_hooks.erl"},{line,364}],4},{ejabberd_sm,route,[{file,"src/ejabberd_sm.erl"},{line,143}],1},{ejabberd_local,route,[{file,"src/ejabberd_local.erl"},{line,72}],1},{ejabberd_router,do_route,[{file,"src/ejabberd_router.erl"},{line,368}],1},{ejabberd_router,route,[{file,"src/ejabberd_router.erl"},{line,92}],1}]}
** Arguments = [{archived,{message,<<>>,normal,<<>>,{jid,<<"5c45a9029e04c348230940f6">>,<<"room.chat.cs.com">>,<<>>,<<"5c45a9029e04c348230940f6">>,<<"room.chat.cs.com">>,<<>>},{jid,<<"639283241772">>,<<"chat.cs.com">>,<<>>,<<"639283241772">>,<<"chat.cs.com">>,<<>>},[],[{text,<<"en">>,<<"639202233717@chat.cs.com/de0fe295e7806f62 invites you to the room 5c45a9029e04c348230940f6@room.chat.cs.com (Laguna South Secretaries|1548069132456) ">>}],undefined,[{mam_archived,{jid,<<"639283241772">>,<<"chat.cs.com">>,<<>>,<<"639283241772">>,<<"chat.cs.com">>,<<>>},<<"1548069192447984">>},{stanza_id,{jid,<<"639283241772">>,<<"chat.cs.com">>,<<>>,<<"639283241772">>,<<"chat.cs.com">>,<<>>},<<"1548069192447984">>},{muc_user,undefined,undefined,[{muc_invite,<<"Laguna South Secretaries|1548069132456">>,{jid,<<"639202233717">>,<<"chat.cs.com">>,<<"de0fe295e7806f62">>,<<"639202233717">>,<<"chat.cs.com">>,<<"de0fe295e7806f62">>},undefined,undefined}],[],[],undefined},{x_conference,{jid,<<"5c45a9029e04c348230940f6">>,<<"room.chat.cs.com">>,<<>>,<<"5c45a9029e04c348230940f6">>,<<"room.chat.cs.com">>,<<>>},<<>>,<<"Laguna South Secretaries|1548069132456">>,undefined,<<>>}],#{mam_archived => true,stanza_id => 1548069192447984}}}]
2019-01-21 11:13:37.028 [error] <0.2212.0>@ejabberd_hooks:safe_apply:384 Hook offline_message_hook crashed when running mod_offline:store_packet/1:
** Reason = {error,{case_clause,undefined},[{mod_offline,need_to_store,[{file,"src/mod_offline.erl"},{line,380}],2},{mod_offline,store_packet,[{file,"src/mod_offline.erl"},{line,396}],1},{ejabberd_hooks,safe_apply,[{file,"src/ejabberd_hooks.erl"},{line,380}],4},{ejabberd_hooks,run_fold1,[{file,"src/ejabberd_hooks.erl"},{line,364}],4},{ejabberd_sm,route,[{file,"src/ejabberd_sm.erl"},{line,143}],1},{ejabberd_local,route,[{file,"src/ejabberd_local.erl"},{line,72}],1},{ejabberd_router,do_route,[{file,"src/ejabberd_router.erl"},{line,368}],1},{ejabberd_router,route,[{file,"src/ejabberd_router.erl"},{line,92}],1}]}
** Arguments = [{archived,{message,<<>>,normal,<<>>,{jid,<<"5c449a00ad22e000cea9155b">>,<<"room.chat.cs.com">>,<<>>,<<"5c449a00ad22e000cea9155b">>,<<"room.chat.cs.com">>,<<>>},{jid,<<"639178686984">>,<<"chat.cs.com">>,<<>>,<<"639178686984">>,<<"chat.cs.com">>,<<>>},[],[{text,<<"en">>,<<"639338651567@chat.cs.com/304ef179236dfa23 invites you to the room 5c449a00ad22e000cea9155b@room.chat.cs.com (San Lucas|1548069209873|addMember) ">>}],undefined,[{mam_archived,{jid,<<"639178686984">>,<<"chat.cs.com">>,<<>>,<<"639178686984">>,<<"chat.cs.com">>,<<>>},<<"1548069211654124">>},{stanza_id,{jid,<<"639178686984">>,<<"chat.cs.com">>,<<>>,<<"639178686984">>,<<"chat.cs.com">>,<<>>},<<"1548069211654124">>},{muc_user,undefined,undefined,[{muc_invite,<<"San Lucas|1548069209873|addMember">>,{jid,<<"639338651567">>,<<"chat.cs.com">>,<<"304ef179236dfa23">>,<<"639338651567">>,<<"chat.cs.com">>,<<"304ef179236dfa23">>},undefined,undefined}],[],[],undefined},{x_conference,{jid,<<"5c449a00ad22e000cea9155b">>,<<"room.chat.cs.com">>,<<>>,<<"5c449a00ad22e000cea9155b">>,<<"room.chat.cs.com">>,<<>>},<<>>,<<"San Lucas|1548069209873|addMember">>,undefined,<<>>}],#{mam_archived => true,stanza_id => 1548069211654124}}}]
2019-01-21 11:14:07.846 [error] <0.381.0>@ejabberd_listener:report_socket_error:389 Failed to open socket at [::]:5222 for ejabberd_c2s: address already in use
2019-01-21 11:14:07.847 [error] <0.380.0> Supervisor ejabberd_listener had child {5222,{0,0,0,0,0,0,0,0},tcp} started with ejabberd_listener:start({5222,{0,0,0,0,0,0,0,0},tcp}, ejabberd_c2s, [{ip,{0,0,0,0,0,0,0,0}},{starttls,true},{max_stanza_size,131072},{shaper,c2s_shaper},{access,c2s}]) at undefined exit with reason eaddrinuse in context start_error
2019-01-21 11:14:07.847 [error] <0.354.0> Supervisor ejabberd_sup had child ejabberd_listener started with ejabberd_listener:start_link() at undefined exit with reason {shutdown,{failed_to_start_child,{5222,{0,0,0,0,0,0,0,0},tcp},eaddrinuse}} in context start_error
2019-01-21 11:14:07.852 [critical] <0.82.0>@ejabberd_app:start:65 Failed to start ejabberd application: {error,{shutdown,{failed_to_start_child,ejabberd_listener,{shutdown,{failed_to_start_child,{5222,{0,0,0,0,0,0,0,0},tcp},eaddrinuse}}}}}
2019-01-21 11:14:58.633 [error] <0.2765.0> gen_server memsup terminated with reason: {port_died,normal}
2019-01-21 11:14:58.634 [error] <0.2765.0> CRASH REPORT Process memsup with 0 neighbours exited with reason: {port_died,normal} in gen_server:handle_common_reply/8 line 751
2019-01-21 11:14:58.637 [error] <0.2764.0> Supervisor os_mon_sup had child memsup started with memsup:start_link() at <0.2765.0> exit with reason {port_died,normal} in context child_terminated
2019-01-21 11:14:58.655 [error] <0.2937.0>@mod_pubsub:do_transaction:3639 transaction return internal error: {aborted,{{unregistered_route,<<"pubsub.chat.cs.com">>},[{ejabberd_router,host_of_route,1,[{file,"src/ejabberd_router.erl"},{line,283}]},{mod_pubsub,submodule,3,[{file,"src/mod_pubsub.erl"},{line,3449}]},{mod_pubsub,node_call,4,[{file,"src/mod_pubsub.erl"},{line,3571}]},{ejabberd_sql,execute_bloc,1,[{file,"src/ejabberd_sql.erl"},{line,535}]},{ejabberd_sql,run_sql_cmd,4,[{file,"src/ejabberd_sql.erl"},{line,451}]},{p1_fsm,handle_msg,10,[{file,"src/p1_fsm.erl"},{line,582}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]}}
2019-01-21 11:14:58.701 [error] <0.2869.0>@mod_pubsub:do_transaction:3639 transaction return internal error: {aborted,{{unregistered_route,<<"pubsub.chat.cs.com">>},[{ejabberd_router,host_of_route,1,[{file,"src/ejabberd_router.erl"},{line,283}]},{mod_pubsub,submodule,3,[{file,"src/mod_pubsub.erl"},{line,3449}]},{mod_pubsub,node_call,4,[{file,"src/mod_pubsub.erl"},{line,3571}]},{ejabberd_sql,execute_bloc,1,[{file,"src/ejabberd_sql.erl"},{line,535}]},{ejabberd_sql,run_sql_cmd,4,[{file,"src/ejabberd_sql.erl"},{line,451}]},{p1_fsm,handle_msg,10,[{file,"src/p1_fsm.erl"},{line,582}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]}}
2019-01-21 11:14:58.702 [error] <0.2918.0>@ejabberd_hooks:safe_apply:384 Hook c2s_terminated crashed when running mod_pubsub:on_user_offline/2:
** Reason = {error,{badmatch,{error,{stanza_error,wait,500,<<>>,'internal-server-error',[{text,<<"en">>,<<"Database failure">>}],[]}}},[{mod_pubsub,'-purge_offline/1-fun-0-',[{file,"src/mod_pubsub.erl"},{line,3794}],4},{lists,foldl,[{file,"lists.erl"},{line,1263}],3},{mod_pubsub,purge_offline,[{file,"src/mod_pubsub.erl"},{line,3783}],1},{mod_pubsub,on_user_offline,[{file,"src/mod_pubsub.erl"},{line,593}],2},{ejabberd_hooks,safe_apply,[{file,"src/ejabberd_hooks.erl"},{line,380}],4},{ejabberd_hooks,run_fold1,[{file,"src/ejabberd_hooks.erl"},{line,364}],4},{xmpp_stream_in,terminate,[{file,"src/xmpp_stream_in.erl"},{line,390}],2},{xmpp_stream_in,stop,[{file,"src/xmpp_stream_in.erl"},{line,134}],1}]}
** Arguments = [#{pres_timestamp => {1548,69266,701145},mgmt_queue_type => ram,socket_monitor => #Ref<0.3146173192.3538157570.29687>,caps_resources => {1,{{<<"639128238724">>,<<"chat.cs.com">>,<<"5df13a5ea9ad7e3e">>},{caps,<<"http://www.igniterealtime.org/projects/smack">>,<<"NBoGUcJ1ljgBE8BFGCMFmGIhHq4=">>,<<"sha-1">>,[]},nil,nil}},auth_module => ejabberd_auth_sql,ip => {{0,0,0,0,0,65535,52183,31712},49906},mgmt_state => active,mgmt_timeout => 120,lserver => <<"chat.cs.com">>,mgmt_stanzas_in => 14,stream_state => disconnected,tls_enabled => true,stream_direction => in,resource => <<"5df13a5ea9ad7e3e">>,socket => {socket_state,gen_tcp,#Port<0.248>,131072,#Ref<0.3146173192.3538288642.29686>,{state,1000,1000,1000,1548069295997242}},mgmt_stanzas_req => 30,mgmt_stanzas_out => 30,codec_options => [ignore_els],mgmt_max_timeout => 120,mod => ejabberd_c2s,tls_required => false,tls_options => [compression_none],lang => <<"en">>,tls_verify => false,sid => {{1548,69265,4969},<0.2918.0>},stream_header_sent => true,stream_compressed => false,stream_version => {1,0},mgmt_max_queue => infinity,jid => {jid,<<"639128238724">>,<<"chat.cs.com">>,<<"5df13a5ea9ad7e3e">>,<<"639128238724">>,<<"chat.cs.com">>,<<"5df13a5ea9ad7e3e">>},pres_a => {0,nil},owner => <0.2918.0>,stop_reason => {stream,{out,{stream_error,'system-shutdown',[]}}},mgmt_xmlns => <<"urn:xmpp:sm:3">>,server => <<"chat.cs.com">>,zlib => false,xmlns => <<"jabber:client">>,pres_last => {presence,<<"P0eg2-186">>,available,<<"en">>,{jid,<<"639128238724">>,<<"chat.cs.com">>,<<"5df13a5ea9ad7e3e">>,<<"639128238724">>,<<"chat.cs.com">>,<<"5df13a5ea9ad7e3e">>},{jid,<<"639128238724">>,<<"chat.cs.com">>,<<>>,<<"639128238724">>,<<"chat.cs.com">>,<<>>},undefined,[],undefined,[{xmlel,<<"c">>,[{<<"xmlns">>,<<"http://jabber.org/protocol/caps">>},{<<"hash">>,<<"sha-1">>},{<<"node">>,<<"http://www.igniterealtime.org/projects/smack">>},{<<"ver">>,<<"NBoGUcJ1ljgBE8BFGCMFmGIhHq4=">>}],[]},{vcard_xupdate,<<>>}],#{ip => {0,0,0,0,0,65535,52183,31712}}},conn => c2s,csi_state => active,mgmt_queue => {{[],[]},0,unlimited},user => <<"639128238724">>,stream_restarted => true,shaper => c2s_shaper,mgmt_ack_timeout => 60000,access => c2s,mgmt_resend => true,stream_authenticated => true,stream_id => <<"12425302394187590930">>,stream_timeout => infinity,stream_encrypted => false,csi_queue => {0,#{}}},normal]
2019-01-21 11:14:58.703 [error] <0.2783.0>@mod_pubsub:do_transaction:3639 transaction return internal error: {aborted,{{unregistered_route,<<"pubsub.chat.cs.com">>},[{ejabberd_router,host_of_route,1,[{file,"src/ejabberd_router.erl"},{line,283}]},{mod_pubsub,submodule,3,[{file,"src/mod_pubsub.erl"},{line,3449}]},{mod_pubsub,node_call,4,[{file,"src/mod_pubsub.erl"},{line,3571}]},{ejabberd_sql,execute_bloc,1,[{file,"src/ejabberd_sql.erl"},{line,535}]},{ejabberd_sql,run_sql_cmd,4,[{file,"src/ejabberd_sql.erl"},{line,451}]},{p1_fsm,handle_msg,10,[{file,"src/p1_fsm.erl"},{line,582}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]}}
2019-01-21 11:14:58.703 [error] <0.2940.0>@mod_pubsub:do_transaction:3639 transaction return internal error: {aborted,{{unregistered_route,<<"pubsub.chat.cs.com">>},[{ejabberd_router,host_of_route,1,[{file,"src/ejabberd_router.erl"},{line,283}]},{mod_pubsub,submodule,3,[{file,"src/mod_pubsub.erl"},{line,3449}]},{mod_pubsub,node_call,4,[{file,"src/mod_pubsub.erl"},{line,3571}]},{ejabberd_sql,execute_bloc,1,[{file,"src/ejabberd_sql.erl"},{line,535}]},{ejabberd_sql,run_sql_cmd,4,[{file,"src/ejabberd_sql.erl"},{line,451}]},{p1_fsm,handle_msg,10,[{file,"src/p1_fsm.erl"},{line,582}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]}}
2019-01-21 11:14:58.703 [error] <0.2906.0>@mod_pubsub:do_transaction:3639 transaction return internal error: {aborted,{{unregistered_route,<<"pubsub.chat.cs.com">>},[{ejabberd_router,host_of_route,1,[{file,"src/ejabberd_router.erl"},{line,283}]},{mod_pubsub,submodule,3,[{file,"src/mod_pubsub.erl"},{line,3449}]},{mod_pubsub,node_call,4,[{file,"src/mod_pubsub.erl"},{line,3571}]},{ejabberd_sql,execute_bloc,1,[{file,"src/ejabberd_sql.erl"},{line,535}]},{ejabberd_sql,run_sql_cmd,4,[{file,"src/ejabberd_sql.erl"},{line,451}]},{p1_fsm,handle_msg,10,[{file,"src/p1_fsm.erl"},{line,582}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]}}
2019-01-21 11:14:58.703 [error] <0.2868.0>@mod_pubsub:do_transaction:3639 transaction return internal error: {aborted,{{unregistered_route,<<"pubsub.chat.cs.com">>},[{ejabberd_router,host_of_route,1,[{file,"src/ejabberd_router.erl"},{line,283}]},{mod_pubsub,submodule,3,[{file,"src/mod_pubsub.erl"},{line,3449}]},{mod_pubsub,node_call,4,[{file,"src/mod_pubsub.erl"},{line,3571}]},{ejabberd_sql,execute_bloc,1,[{file,"src/ejabberd_sql.erl"},{line,535}]},{ejabberd_sql,run_sql_cmd,4,[{file,"src/ejabberd_sql.erl"},{line,451}]},{p1_fsm,handle_msg,10,[{file,"src/p1_fsm.erl"},{line,582}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]}}
2019-01-21 11:14:58.704 [error] <0.2963.0>@mod_pubsub:do_transaction:3639 transaction return internal error: {aborted,{{unregistered_route,<<"pubsub.chat.cs.com">>},[{ejabberd_router,host_of_route,1,[{file,"src/ejabberd_router.erl"},{line,283}]},{mod_pubsub,submodule,3,[{file,"src/mod_pubsub.erl"},{line,3449}]},{mod_pubsub,node_call,4,[{file,"src/mod_pubsub.erl"},{line,3571}]},{ejabberd_sql,execute_bloc,1,[{file,"src/ejabberd_sql.erl"},{line,535}]},{ejabberd_sql,run_sql_cmd,4,[{file,"src/ejabberd_sql.erl"},{line,451}]},{p1_fsm,handle_msg,10,[{file,"src/p1_fsm.erl"},{line,582}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]}}
2019-01-21 11:14:58.704 [error] <0.2913.0>@mod_pubsub:do_transaction:3639 transaction return internal error: {aborted,{{unregistered_route,<<"pubsub.chat.cs.com">>},[{ejabberd_router,host_of_route,1,[{file,"src/ejabberd_router.erl"},{line,283}]},{mod_pubsub,submodule,3,[{file,"src/mod_pubsub.erl"},{line,3449}]},{mod_pubsub,node_call,4,[{file,"src/mod_pubsub.erl"},{line,3571}]},{ejabberd_sql,execute_bloc,1,[{file,"src/ejabberd_sql.erl"},{line,535}]},{ejabberd_sql,run_sql_cmd,4,[{file,"src/ejabberd_sql.erl"},{line,451}]},{p1_fsm,handle_msg,10,[{file,"src/p1_fsm.erl"},{line,582}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]}}
2019-01-21 11:14:58.704 [error] <0.2786.0>@mod_pubsub:do_transaction:3639 transaction return internal error: {aborted,{{unregistered_route,<<"pubsub.chat.cs.com">>},[{ejabberd_router,host_of_route,1,[{file,"src/ejabberd_router.erl"},{line,283}]},{mod_pubsub,submodule,3,[{file,"src/mod_pubsub.erl"},{line,3449}]},{mod_pubsub,node_call,4,[{file,"src/mod_pubsub.erl"},{line,3571}]},{ejabberd_sql,execute_bloc,1,[{file,"src/ejabberd_sql.erl"},{line,535}]},{ejabberd_sql,run_sql_cmd,4,[{file,"src/ejabberd_sql.erl"},{line,451}]},{p1_fsm,handle_msg,10,[{file,"src/p1_fsm.erl"},{line,582}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]}}
2019-01-21 11:14:58.704 [error] <0.2875.0>@ejabberd_hooks:safe_apply:384 Hook c2s_terminated crashed when running mod_pubsub:on_user_offline/2:
** Reason = {error,{badmatch,{error,{stanza_error,wait,500,<<>>,'internal-server-error',[{text,<<"en">>,<<"Database failure">>}],[]}}},[{mod_pubsub,'-purge_offline/1-fun-0-',[{file,"src/mod_pubsub.erl"},{line,3794}],4},{lists,foldl,[{file,"lists.erl"},{line,1263}],3},{mod_pubsub,purge_offline,[{file,"src/mod_pubsub.erl"},{line,3783}],1},{mod_pubsub,on_user_offline,[{file,"src/mod_pubsub.erl"},{line,593}],2},{ejabberd_hooks,safe_apply,[{file,"src/ejabberd_hooks.erl"},{line,380}],4},{ejabberd_hooks,run_fold1,[{file,"src/ejabberd_hooks.erl"},{line,364}],4},{xmpp_stream_in,terminate,[{file,"src/xmpp_stream_in.erl"},{line,390}],2},{xmpp_stream_in,stop,[{file,"src/xmpp_stream_in.erl"},{line,134}],1}]}
** Arguments = [#{pres_timestamp => {1548,69273,70130},mgmt_queue_type => ram,socket_monitor => #Ref<0.3146173192.3538157570.25793>,caps_resources => {2,{{<<"639223506579">>,<<"chat.cs.com">>,<<"5008dee96b8df77b">>},{caps,<<"http://www.igniterealtime.org/projects/smack">>,<<"NBoGUcJ1ljgBE8BFGCMFmGIhHq4=">>,<<"sha-1">>,[]},nil,{{<<"639435143872">>,<<"chat.cs.com">>,<<"e8ce77227e88b7cb">>},{caps,<<"http://www.igniterealtime.org/projects/smack">>,<<"NBoGUcJ1ljgBE8BFGCMFmGIhHq4=">>,<<"sha-1">>,[]},nil,nil}}},auth_module => ejabberd_auth_sql,ip => {{0,0,0,0,0,65535,31851,49482},2110},mgmt_state => active,mgmt_timeout => 120,lserver => <<"chat.cs.com">>,mgmt_stanzas_in => 179,stream_state => disconnected,tls_enabled => true,stream_direction => in,resource => <<"5008dee96b8df77b">>,socket => {socket_state,gen_tcp,#Port<0.182>,131072,#Ref<0.3146173192.3538288642.25792>,{state,1000,1000,1000,1548069286793069}},mgmt_stanzas_req => 175,mgmt_stanzas_out => 175,codec_options => [ignore_els],mgmt_max_timeout => 120,mod => ejabberd_c2s,tls_required => false,tls_options => [compression_none],lang => <<"en">>,tls_verify => false,sid => {{1548,69251,3073},<0.2875.0>},stream_header_sent => true,stream_compressed => false,stream_version => {1,0},mgmt_max_queue => infinity,jid => {jid,<<"639223506579">>,<<"chat.cs.com">>,<<"5008dee96b8df77b">>,<<"639223506579">>,<<"chat.cs.com">>,<<"5008dee96b8df77b">>},pres_a => {0,nil},owner => <0.2875.0>,stop_reason => {stream,{out,{stream_error,'system-shutdown',[]}}},mgmt_xmlns => <<"urn:xmpp:sm:3">>,server => <<"chat.cs.com">>,zlib => false,xmlns => <<"jabber:client">>,pres_last => {presence,<<"eMesC-975">>,available,<<"en">>,{jid,<<"639223506579">>,<<"chat.cs.com">>,<<"5008dee96b8df77b">>,<<"639223506579">>,<<"chat.cs.com">>,<<"5008dee96b8df77b">>},{jid,<<"639223506579">>,<<"chat.cs.com">>,<<>>,<<"639223506579">>,<<"chat.cs.com">>,<<>>},undefined,[],undefined,[{xmlel,<<"x">>,[{<<"xmlns">>,<<"vcard-temp:x:update">>}],[{xmlel,<<"photo">>,[{<<"thumbnail">>,<<"https://s3.ap-northeast-2.amazonaws.com/cs-cs-s3/9d942882-d29a-4fe3-a656-945d32031f67.jpg">>}],[]}]},{xmlel,<<"c">>,[{<<"xmlns">>,<<"http://jabber.org/protocol/caps">>},{<<"hash">>,<<"sha-1">>},{<<"node">>,<<"http://www.igniterealtime.org/projects/smack">>},{<<"ver">>,<<"NBoGUcJ1ljgBE8BFGCMFmGIhHq4=">>}],[]}],#{ip => {0,0,0,0,0,65535,31851,49482}}},conn => c2s,csi_state => active,mgmt_queue => {{[],[]},0,unlimited},user => <<"639223506579">>,stream_restarted => true,shaper => c2s_shaper,mgmt_ack_timeout => 60000,access => c2s,mgmt_resend => true,stream_authenticated => true,stream_id => <<"15645689511475067441">>,stream_timeout => infinity,stream_encrypted => false,csi_queue => {0,#{}}},normal]
licaon-kter commented 5 years ago

Please use https://gist.github.com to paste these infos and edit your post to have only the links to those gists.

Explain what you want to do, what did you do, how did you do it...

prefiks commented 5 years ago

Hello,

Could you please see if removing "store_empty_body: unless_chat_state" from mod_offline config helps with that crash (this is default value for that option, so it shouldn't change anything)?

It looks like for some reason when offline codes tries to get that value from config, it gets undefined instead of unless_chat_state, but on newer version with your config i am getting correct value, so not sure how that happens.

gylraj commented 5 years ago

@licaon-kter https://gist.github.com/gylraj/abd99b789c9254c4e4092a45764432f2 I want to build a stable server I just follow the documentation

first It works fine then suddenly it stopped working I saw the cpu usage 100%

don't know what had happened, please enlighten me

@prefiks its still the same

mremond commented 5 years ago

How many concurrent users is there on your server ? I see values that are strangely high, like a user can join 300k room and a single room can host 10k users. You can make ejabberd work on large scale with experience, but this is suspiciously high value for a first experience with ejabberd. Can you please share some details on your use case to help us understand how you are using it ?

Thanks !

What the log suggest is that you have a sizing issue, so I expect that you have quite some users and your architecture design is not adequate for your usage.

gylraj commented 5 years ago

Only around 500 concurrent users. will this "user can join 300k room and a single room can host 10k users" affect ejabberd? will it cause crashes?

zinid commented 5 years ago

will this "user can join 300k room and a single room can host 10k users" affect ejabberd?

When you go thousands you can crash ejabberd, yes, especially with bad configuration or hardware.

zinid commented 5 years ago

Also, here again, all your errors were generated at the same time. For me it looks like an artifact of the server shutdown.

mremond commented 5 years ago

I propose to close it for now, as @zinid suggest it may not be a production related issue but only appear during shutdown.

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.