Coder Social home page Coder Social logo

esl / mongooseim Goto Github PK

View Code? Open in Web Editor NEW
1.6K 101.0 420.0 63.68 MB

MongooseIM is Erlang Solutions' robust, scalable and efficient XMPP server, aimed at large installations. Specifically designed for enterprise purposes, it is fault-tolerant and can utilise the resources of multiple clustered machines.

License: Other

C 0.10% Erlang 96.18% Makefile 0.11% Shell 1.89% Python 1.12% JavaScript 0.19% HTML 0.06% C++ 0.02% PLpgSQL 0.01% Dockerfile 0.04% TSQL 0.26% Mustache 0.02%
mongooseim erlang xmpp jabber messaging chat hacktoberfest

mongooseim's Introduction

MongooseIM platform

GitHub release CircleCI Codecov GitHub Actions Coveralls

Get to know MongooseIM

MongooseIM is a robust, scalable and efficient XMPP server at the core of an Instant Messaging platform aimed at large installations.

MongooseIM platform's logo

Designed for enterprise, it is fault-tolerant, can utilise the resources of multiple clustered machines, and easily scales for more capacity by simply adding a box or a VM.

MongooseIM can accept client sessions over vanilla XMPP, REST API and SSE, as well as Websockets, and BOSH (HTTP long-polling).

As a platform, MongooseIM includes several server-side (backend) and client-side (frontend) components.

We provide a test suite, metrics, a load testing platform, and a monitoring server. We recommend third-party, open source client libraries for XMPP and REST API.

It is brought to you by Erlang Solutions.

MongooseIM platform components:

MongooseIM platform schema

Learn more:

Download packages

For a quick start just download:

Public testing

Check out our test results:

Documentation

See the documentation for the latest releases:

MongooseIM documentation highlights:

When developing new features/modules, please make sure you add basic documentation to the 'doc' directory, and add a link to your document in 'mkdocs.yml'.

Participate!

Suggestions, questions, thoughts? Contact us directly:

mongooseim's People

Contributors

aleklisi avatar alexeyshch avatar alipiec avatar arcusfelis avatar badlop avatar bartekgorny avatar chrzaszcz avatar denysgonchar avatar erszcz avatar fenek avatar goddammit avatar gustawlippa avatar jacekwegr avatar janciesla8818 avatar januszjakubiec avatar kamilwaz avatar kzemek avatar leszke avatar ludwikbukowski avatar michalwski avatar mremond avatar nelsonvides avatar nyco avatar paulgray avatar pawlooss1 avatar premwoik avatar rslota avatar vkatsuba avatar zinid avatar zofpolkowska avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mongooseim's Issues

versioning scheme

All @esl libraries used by MongooseIM should follow this versioning scheme: http://semver.org/

Additionally 3rd party dependencies described in rebar.config should use concreate version or at least commit.

mod_bosh timeout error when trying to connect

When trying to connect to MongooseIM (v1.2.2) with the Strophe Javascript client, I am getting many timeout errors in mod_bosh which will (sometimes) eventually connect after multiple attempts. Other times, the client will simple give up after retrying approximately 5 times (this is the client).

The following is the debug output when the connection is attempted:

2013-10-17 09:03:50.685 [debug] <0.667.0>@mod_bosh:init:120 New request
2013-10-17 09:03:50.686 [debug] <0.667.0>@mod_bosh:info:155 forward_body: {http_req,#Port<0.4031>,ranch_tcp,keepalive,<0.667.0>,<<"POST">>,{1,1},{{127,0,0,1},55037},<<"localhost">>,undefined,5280,<<"/http-bind">>,undefined,<<>>,undefined,<<>>,[],[{<<"host">>,<<"localhost:5280">>},{<<"user-agent">>,<<"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/536.30.1 (KHTML, like Gecko) Version/6.0.5 Safari/536.30.1">>},{<<"content-length">>,<<"219">>},{<<"accept">>,<<"*/*">>},{<<"origin">>,<<"file://">>},{<<"content-type">>,<<"application/xml">>},{<<"accept-language">>,<<"en-us">>},{<<"accept-encoding">>,<<"gzip, deflate">>},{<<"cookie">>,<<"m=34e2:|2a03:t|77cb:t|47ba:t|18c3:t|4a01:t|2c69:t|ca3:t|1d98:t|5cf4:t">>},{<<"connection">>,<<"keep-alive">>}],[{<<"connection">>,[<<"keep-alive">>]}],undefined,[],waiting,undefined,<<>>,false,waiting,[],<<>>,undefined}
2013-10-17 09:03:55.687 [error] <0.667.0> Cowboy handler mod_bosh terminated in mod_bosh:info/3 with reason: no match of right hand value {error,timeout} in mod_bosh:info/3 line 156

This is the XML being sent by the client:

SENT: <body rid='2130351368' xmlns='http://jabber.org/protocol/httpbind' to='localhost' xml:lang='en' wait='60' hold='1' content='text/xml; charset=utf-8' ver='1.6' xmpp:version='1.0' xmlns:xmpp='urn:xmpp:xbosh'/>

I've tried to narrow down why and where this is happening, but I haven't had enough time to dig through the cowboy handlers in any meaningful way. I am not sure if anyone is seeing this.

If I find what's causing it and fix it, I will submit a pull request.

documentation current list of support xmpp standard

Hi

As mentioned in project page this is a fork of 2.1.8 fron processone, since then they have also undergone changes, refactoring optimization and adding xep. Just wondering are there any new addition to xep support at yours too?

thanks

The status of the branch mod_distributed_room

I understand that the purpose of mod_distributed_room is to create a fully cluster-able version of mod_muc which help distribute participants of a single room across several physical servers in a cluster.

I just asked Mickaรซl the founder of ejabberd about MUC clustering and he said that feature is supported in commercial version only. So I am really interested in mod_distributed_room. Is is finished or not ready to merge into the ESL master branch ?

Thanks

[Bug] Multiple hosts on one node with odbc

When ejabberd is configured to run more than on host on one node there is no way to register 2 different users with the same name. For example, we have two hosts A and B, we can register user a@A but when we are trying to register a@B there is conflict because of users table schema. I found out that in new ejabberd version from proccessone it will be corrected.

Streamline release generation process

Right now there's a release generated for each predefined configuration set. That's unnecessary and unwanted because of the time needed to generate a release.

However, reltool includes a templating support for files going into the release which is used for generating corresponding ejabberd.cfg files. That's convenient.

Solution:

  • generate the release once to cut down build time,
  • use mustache (or something similar) to generate customised ejabberd.cfg variants.

External authentication

Hi,

I find that external authentication that is implemented in ejabberd is rather inefficient, inflexible. The reason is

  1. The number of CGI processes (authentication script) is fixed when ejabberd starts. It can not be extended if the traffic is higher than planned
  2. ejabberd distributes authentication requests across CGI processes in a round robin manner without concerning if the CGI process is busy or not. External authentication script is implemented in blocking mode, that accepts a single request at a time, making it less scalable. No such thing like backlog queue.
  3. External authentication script locates in the same machine as ejabberd. They must share system resource with each other. If ejabberd is overloaded, their CGI processes will be affected
  4. Local external authentication script in a ejabberd box makes it harder to implement proper security model and deployment. External authentication script is written in a different language, requires different settings and access rules, libraries

I don't know if MongooseIM has implemented an alternative solution. E.x: do authentication via a webservice using a restful API call (isuser, auth)

PS: eJabberd's authentication engine is hard to debug

mod_snmp only initializes ejabberd hooks for the first virtual host

If the node has multiple virtual hosts configured, then SNMP counters will be updated only for events related to the first configured virtual host. This can be solved by moving hooks initialization out from init_snmp. Patch is something like this:

diff --git a/apps/ejabberd/src/mod_snmp.erl b/apps/ejabberd/src/mod_snmp.erl
index f36d60b..1798043 100644
--- a/apps/ejabberd/src/mod_snmp.erl
+++ b/apps/ejabberd/src/mod_snmp.erl
@@ -14,10 +14,7 @@
 -include("jlib.hrl").
 -include("EJABBERD-MIB.hrl").

 -export([start/2, stop/1]).
-
 -export([handle_entry/2, handle_entry/4]).

 -spec(start/2 :: (binary(), list()) -> ok).
@@ -26,17 +23,17 @@ start(Host, Opts) ->
         true ->
             ok;
         false ->
-            init_snmp(Host, Opts)
-    end.
+            init_snmp(Opts)
+    end,
+    snmp_hooks(add, Host).

 -spec(stop/1 :: (binary()) -> ok).
 stop(Host) ->
     ejabberd_snmp_core:stop(),
     snmp_hooks(delete, Host).

--spec(init_snmp/2 :: (binary(), list()) -> ok).
-init_snmp(Host, Opts) ->
+-spec(init_snmp/1 :: (list()) -> ok).
+init_snmp(Opts) ->
     Mods = case gen_mod:get_opt(modules, Opts, none) of
                none ->
                    [];
@@ -46,24 +43,9 @@ init_snmp(Host, Opts) ->
     RtInterval = gen_mod:get_opt(rt_count_interval, Opts, undefined),
     WInterval = gen_mod:get_opt(w_count_interval, Opts, undefined),
     RtEnabled = gen_mod:get_opt(rt_enabled, Opts, false),

     ok = ejabberd_snmp_core:start(Mods),
     ejabberd_snmp_rt:start_link(RtEnabled, RtInterval, WInterval),
-
-    snmp_hooks(add, Host),

infinite loop in bounce_messages() if JID contains uppercase letters

In ejabberd_sm:close_session the USR tuple is not made lowercase before passing to sm backend's get_sessions and delete_session. This leads to orhpaned sessions left in the DB, and a possible infinite loop of messages, causing the C2S process deadlock inside bounce_messages() function. Issue appeared while using the Redis session backend. Proposed patch below.

diff --git a/apps/ejabberd/src/ejabberd_sm.erl b/apps/ejabberd/src/ejabberd_sm.erl
index e1e173e..c760075 100644
--- a/apps/ejabberd/src/ejabberd_sm.erl
+++ b/apps/ejabberd/src/ejabberd_sm.erl
@@ -90,6 +90,8 @@ route(From, To, Packet) ->
     end.

 open_session(SID, User, Server, Resource, Info) ->
+    %% inside set_session() and check_for_sessions_to_replace()
+    %% USR is translated to lower case, so no need here
     set_session(SID, User, Server, Resource, undefined, Info),
     check_for_sessions_to_replace(User, Server, Resource),
     JID = jlib:make_jid(User, Server, Resource),
@@ -97,13 +99,16 @@ open_session(SID, User, Server, Resource, Info) ->
                        [SID, JID, Info]).

 close_session(SID, User, Server, Resource) ->
-    Info = case ?SM_BACKEND:get_sessions(User, Server, Resource) of
+    LUser = jlib:nodeprep(User),
+    LServer = jlib:nameprep(Server),
+    LResource = jlib:resourceprep(Resource),
+    Info = case ?SM_BACKEND:get_sessions(LUser, LServer, LResource) of
                [Session] ->
                    Session#session.info;
                _ ->
                    []
            end,
-    ?SM_BACKEND:delete_session(SID, User, Server, Resource),
+    ?SM_BACKEND:delete_session(SID, LUser, LServer, LResource),
     JID = jlib:make_jid(User, Server, Resource),
     ejabberd_hooks:run(sm_remove_connection_hook, JID#jid.lserver,
                        [SID, JID, Info]).

Persist messages when MUC room stored

Currently message history in persistent room are discarded when the room is saved in DB. XEP-0045 states that persistent rooms cannot be destroyed when everyone leave it. Deleting message history might be considered a kind of partial room destruction. Changing current behaviour and storing message history should be discussed.

modules with mnesia and odbc backends unifications

All modules storing data in mnesia or odbc have two version now (named with _odbc suffix or without). The common logic of these modules should be left in the original module and all backend related operations like read/write/update should be moved to some backend modules. Good example of similar solution are session backends (mnesia and redis).

Candidates for such a unification:

  • mod_private(_odbc)
  • mod_vcard(_odbc)
  • mod_roster(_odbc)
  • mod_offline(_odbc)
  • mod_last(_odbc)
  • mod_privacy(_odbc)

ejabberd_logger_h - remove or not?

The logging mechanism in ejabberd is quirky.

There's the custom ejabberd_logger_h handler written, but before f7e1914 (branch improve-coverage) ejabberd_app.erl contained commented out lines adding it as an error_logger handler. Because of that the coverage report for ejabberd_logger_h was 0%.

To increase that coverage, the comment was removed in the mentioned commit. An ejabberd.log file is now created being the target of logs from ejabberd_logger_h, no matter whether the server runs in live or daemonised mode.

However, it also turned out that a logging mechanism creating files according to pattern erlang.log.N and run_erl.log exists and was working all the time (no matter whether ejabberd_logger_h was on or off), but it doesn't log to those files when the server is started in live mode (thus I didn't notice they actually are created and made the "fixing" commit). The logs are all textual and human-readable (unlike the sasl logs).

The question is why does ejabberd_logger_h even exist if there's a text logging mechanism in place? Is it a leftover from some Erlang version when error_logger with textual logging didn't exist yet? Isn't it wise to remove it completely?

binary matching issue?

I've created a user admin on a node running on localmac (which points to localhost). When I connect to the XMMP server, I get the following clause error, which seems to be related to work done to 'binarize' ejabberd.

It looks like that this might be related to s2s communication, maybe due to localmac not being a proper and valid domain name?

=INFO REPORT==== 2-Jun-2012::14:01:27 ===
I(<0.338.0>:ejabberd_listener:281) : (#Port<0.3517>) Accepted connection {{127,0,0,1},51318} -> {{127,0,0,1},5222}

=INFO REPORT==== 2-Jun-2012::14:01:27 ===
I(<0.346.0>:ejabberd_c2s:769) : ({socket_state,gen_tcp,#Port<0.3517>,<0.345.0>}) Accepted authentication for admin by ejabberd_auth_odbc

=INFO REPORT==== 2-Jun-2012::14:01:27 ===
I(<0.346.0>:ejabberd_c2s:892) : ({socket_state,gen_tcp,#Port<0.3517>,<0.345.0>}) Opened session for admin@localmac/Robertos-Mac

=ERROR REPORT==== 2-Jun-2012::14:01:28 ===
E(<0.346.0>:ejabberd_s2s:76) : {function_clause,
                               [{string,tokens1,
                                 [<<"proxy.eu.jabber.org">>,".",[]],
                                 [{file,"string.erl"},{line,202}]},
                                {ejabberd_s2s,parent_domains,1,
                                 [{file,"src/ejabberd_s2s.erl"},{line,426}]},
                                {ejabberd_s2s,is_service,2,
                                 [{file,"src/ejabberd_s2s.erl"},{line,417}]},
                                {ejabberd_s2s,find_connection,2,
                                 [{file,"src/ejabberd_s2s.erl"},{line,295}]},
                                {ejabberd_s2s,do_route,3,
                                 [{file,"src/ejabberd_s2s.erl"},{line,254}]},
                                {ejabberd_s2s,route,3,
                                 [{file,"src/ejabberd_s2s.erl"},{line,74}]},
                                {ejabberd_router,route,3,
                                 [{file,"src/ejabberd_router.erl"},
                                  {line,68}]},
                                {ejabberd_c2s,session_established2,2,
                                 [{file,"src/ejabberd_c2s.erl"},
                                  {line,1066}]}]}
when processing: {{jid,<<"admin">>,<<"localmac">>,<<"Robertos-Mac">>,
                     <<"admin">>,<<"localmac">>,<<"Robertos-Mac">>},
                 {jid,<<>>,<<"proxy.eu.jabber.org">>,<<>>,<<>>,
                     <<"proxy.eu.jabber.org">>,<<>>},
                 {xmlelement,<<"iq">>,
                     [{<<"xml:lang">>,<<>>},
                      {<<"type">>,<<"get">>},
                      {<<"id">>,<<"purpledfb32023">>},
                      {<<"to">>,<<"proxy.eu.jabber.org">>}],
                     [{xmlelement,<<"query">>,
                          [{<<"xmlns">>,
                            <<"http://jabber.org/protocol/bytestreams">>}],
                          []}]}}

mod_websocket peername/1 return value

Should'nt mod_websocket:peername return {ok, PeerName} instead of just PeerName? This would match the inet:peername() and seems to fix an undefined IP being returned from ejabberd_c2s:peerip which results in the IP not getting set in the session state.

Application ejabberd exited with reason: {driver_loading_failed,expat_erl,{open_error,-10}}

2013-04-27 16:00:25.128 [info] <0.7.0> Application lager started on node ejabberd@localhost
2013-04-27 16:00:25.138 [info] <0.7.0> Application sasl started on node ejabberd@localhost
2013-04-27 16:00:25.183 [info] <0.7.0> Application mnesia started on node ejabberd@localhost
2013-04-27 16:00:25.183 [info] <0.7.0> Application public_key started on node ejabberd@localhost
2013-04-27 16:00:25.188 [info] <0.7.0> Application ssl started on node ejabberd@localhost
2013-04-27 16:00:25.191 [info] <0.7.0> Application stringprep started on node ejabberd@localhost
2013-04-27 16:00:25.206 [info] <0.7.0> Application inets started on node ejabberd@localhost
2013-04-27 16:00:25.207 [info] <0.7.0> Application exml started on node ejabberd@localhost
2013-04-27 16:00:25.210 [info] <0.7.0> Application ranch started on node ejabberd@localhost
2013-04-27 16:00:25.213 [info] <0.7.0> Application cowboy started on node ejabberd@localhost
2013-04-27 16:00:25.225 [notice] <0.48.0> Changed loglevel of log/ejabberd.log to info
2013-04-27 16:00:25.248 [info] <0.7.0> Application mnesia exited with reason: stopped
2013-04-27 16:00:25.560 [info] <0.7.0> Application mnesia started on node ejabberd@localhost
2013-04-27 16:00:25.565 [critical] <0.117.0>@ejabberd_app:load_drivers:225 unable to load driver 'expat_erl': dlopen(/Users/abhinavsingh/Dev/esl-ejabberd/rel/ejabberd/lib/ejabberd-2.1.8/priv/lib/expat_erl.so, 2): Symbol not found: _ei_x_append
  Referenced from: /Users/abhinavsingh/Dev/esl-ejabberd/rel/ejabberd/lib/ejabberd-2.1.8/priv/lib/expat_erl.so
  Expected in: flat namespace
 in /Users/abhinavsingh/Dev/esl-ejabberd/rel/ejabberd/lib/ejabberd-2.1.8/priv/lib/expat_erl.so
2013-04-27 16:00:25.570 [error] <0.116.0> CRASH REPORT Process <0.116.0> with 0 neighbours exited with reason: {driver_loading_failed,expat_erl,{open_error,-10}} in application_master:init/4 line 138
2013-04-27 16:00:25.571 [info] <0.7.0> Application ejabberd exited with reason: {driver_loading_failed,expat_erl,{open_error,-10}}

on OSX Version 10.8.3 using R15B03

$ uname -a
Darwin Abhinavs-iMac.local 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan  6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64

Several questions about features

  1. Is there a list of supported XEPS? like http://www.ejabberd.im/protocols
  2. Does it supports all the XEPS and features ejabberd2 supports?
  3. Is there a shared roster support? http://www.ejabberd.im/screenshots-shared-roster-groups
  4. Is there a list of supported events and hooks? http://www.ejabberd.im/Events%20and%20hooks
  5. Is it possible to add virtual hosts dynamically while the server is running?
  6. Is there a mailing list or IRC channel?
  7. Is there a guide for writing modules?

Thanks

Wildcards don't work in jabber:iq:search?

I'm using 1.2.2 release for this test, excuse me if this is fixed in the repo. When I query the jabber:iq:search service I get instructions suggesting to use * as a wildcard:

<iq from='vjud.servidor.com' to='[email protected]/4644872771383133120881004' id='search1' type='result'>
    <query xmlns='jabber:iq:search'>
        <instructions>You need an x:data capable client to search</instructions>
        <x xmlns='jabber:x:data' type='form'>
            <title>Search users in vjud.servidor.com</title>
            <instructions>Fill in the form to search for any matching Jabber User (Add * to the end of field to match substring)</instructions>
            ...
        </x>
    </query>
</iq>

However when I use * I get no result:

<iq type="set" to="vjud.servidor.com" id="usernameSearch" xml:lang="en">
    <query xmlns="jabber:iq:search">
        <x xmlns="jabber:x:data" type="submit">
            <field type="hidden" var="FORM_TYPE">
                <value>jabber:iq:search</value>
            </field>
            <field var="first">
                <value>ivan*</value>
            </field>
        </x>
    </query>
</iq>

<iq from='vjud.servidor.com' to='[email protected]/4644872771383133120881004' id='usernameSearch' type='result'>
    <query xmlns='jabber:iq:search'>
        <x xmlns='jabber:x:data' type='result'>
            <title>Search Results for vjud.servidor.com</title>
            <reported>
                <field type='jid-single' label='Jabber ID' var='jid'/>
                <field type='text-single' label='Full Name' var='fn'/>
                ...
            </reported>
        </x>
    </query>
</iq>

In the other side, when I remove the * from the query above, I get several users named "ivan":

<iq from='vjud.servidor.com' to='[email protected]/4644872771383133120881004' id='usernameSearch' type='result'>
    <query xmlns='jabber:iq:search'>
        <x xmlns='jabber:x:data' type='result'>
            <title>Search Results for vjud.servidor.com</title>
            <reported>
                <field type='jid-single' label='Jabber ID' var='jid'/>
                <field type='text-single' label='Full Name' var='fn'/>
                ...
            </reported>
            <item>
                ...
            </item>
            <item>
                ...
            </item>
            ...
        </x>
    </query>
</iq>

Am I doing the query wrong or something?

Replace list_to_binary with binary catenation

In some places such as jlib the list_to_binary just produces binary from list of binaries.
As every data comes form user is a binary string now we can safely replace list_to_binary with more efficient binary catenation.

Folsom metrics

Use folsom to collect various metrics.

These metrics should be separated by virtual hostname.
Name convention:

{<<"virutal_hostname">>, metricName}

An error happened while running websocket example with latest version of cowboy

I just cloned the code and "make rel" and ran ejabberd in live mode. An error happend when I trying to login the server in the websocket example "simpleclient.html".

[error] emulator Error in process <0.648.0> on node 'ejabberd@localhost' with exit value: {{badmatch,false},[{cowboy_router,execute,2,[{file,"src/cowboy_router.erl"},{line,37}]},{cowboy_protocol,execute,4,[{file,"src/cowboy_protocol.erl"},{line,494}]}]}

[error] <0.432.0> Supervisor ranch_conns_sup had child ranch_conns_sup started with {ranch_conns_sup,start_protocol,undefined} at <0.648.0> exit with reason no match of right hand value false in cowboy_router:execute/2 line 37 in context child_terminated

After tracing the code, I think the problem is cowboy has changed the ProtocolOpts settings spec, so I do the following fix, it seems ok now.

--- a/apps/ejabberd/src/mod_websockets.erl
+++ b/apps/ejabberd/src/mod_websockets.erl
@@ -59,7 +59,7 @@ start(_Host, Opts) ->
     NumAcceptors = gen_mod:get_opt(num_acceptors, Opts, 100),
     Port = gen_mod:get_opt(port, Opts, ?DEFAULT_PORT),
     TransportOpts = [{port, Port}],
-    ProtocolOpts = [{dispatch, FullDispatch}],
+    ProtocolOpts = [{env,[{dispatch, FullDispatch}]}],
     cowboy:start_http(?LISTENER, NumAcceptors,
                       TransportOpts, ProtocolOpts).

New BOSH open issues and status

Open issues

  • traffic shaping
  • accumulation tuning (see below)
  • HTTP-level compression
  • remote c2s spawning (seems easy, though not very important right now)
  • process hibernation to conserve memory
  • logging verbosity and levels (some harmless things are logged as errors or warnings, some logs are redundant)

Status

Implementation is working.
Testing was carried out with JSJaC used from mobile (Android 2.3) and desktop browsers (Firefox, Chromium).
There's also an automatic test suite available for some corner cases which might be hard to come by when testing manually.

Accumulation tuning

  • should be disabled unless tuned properly, as it may degrade performance as well as improve it
  • accumulation period length(s) must be estimated based on profiling data
  • events triggering the accumulation state need to be determined based on connection negotiation steps (i.e. when to accumulate: after opening <stream:stream>, after stream restart, after sending initial presence?)

Change default config table location

Currently by default config and local_config table locations are set to disc_copies. As a consequence although some configuration parameters are deleted from the .cfg file (e.g. odbc_server) though they remain in Mnesia.

On the other hand there is no need to persist them, as the configuration file is read on startup every time ejabberd is spin up.

Binary strings in odbc layer

There is still plenty of strings based on lists in odbc layer.
All queries should be changed into binary strings. It my however produce some crashes in ejabberd_odbc module and probably in some other odbc related places.

Hosts and mod_muc

There are two entities with different meaning in this module:

  • ServerHost ("localhost") - where settings are from;
  • Host or MyHost ("muc.localhost") - a part of a room's name. It is used in routing.

While it is hard to implement, it will be better to use only one host everywhere (i.e. "muc.localhost").

xmlelement to xmlel

Change record xmlelement to xmlel.

Remember about escalus and ejabberd_tests. They also use this record.

Mixed auth method for several hosts

When default auth method is odbc, but one host is configured to use internal authentication, ejabberd_snmp_backend asks only for register users count from default auth method (in this case it is odbc).

Wrong string type when notifying a new registration

Notifying a new registration produces the following error:

(ejabberd@localhost)1> 2013-10-30 12:49:02.304 [error] <0.453.0>@ejabberd_hooks:run_fold1:335 {function_clause,[{jlib,binary_to_jid1,["admin1@localhost",<<>>],[{file,"src/jlib.erl"},{line,230}]},{mod_register,'-send_registration_notifications/2-fun-0-',3,[{file,"src/mod_register.erl"},{line,332}]},{lists,foreach,2,[{file,"lists.erl"},{line,1323}]},{mod_register,try_register,5,[{file,"src/mod_register.erl"},{line,273}]},{mod_register,try_register_or_set_password,8,[{file,"src/mod_register.erl"},{line,212}]},{mod_register,unauthenticated_iq_register,4,[{file,"src/mod_register.erl"},{line,78}]},{ejabberd_hooks,run_fold1,4,[{file,"src/ejabberd_hooks.erl"},{line,331}]},{ejabberd_c2s,process_unauthenticated_stanza,2,[{file,"src/ejabberd_c2s.erl"},{line,2127}]}]}
running hook: {c2s_unauthenticated_iq,[<<"localhost">>,{iq,<<"purple2e36f063">>,set,<<"jabber:iq:register">>,<<>>,{xmlel,<<"query">>,[{<<"xmlns">>,<<"jabber:iq:register">>}],[{xmlel,<<"username">>,[],[{xmlcdata,<<"admin">>}]},{xmlel,<<"password">>,[],[{xmlcdata,<<"admin">>}]}]}},{{127,0,0,1},42419}]}

Notice this part of the error:

{jlib,binary_to_jid1,["admin1@localhost",<<>>],[{file,"src/jlib.erl"},{line,230}]}

Changing the registration_watchers to binary string in ejabberd.cfg avoids the error:

{registration_watchers, [<<"admin1@localhost">>]},

The code is missing a conversion from the file's list string to binary string somewhere.

Remove is_list guards

In many places there are is_list guards. They have been introduced while changing list strings to binary strings but they are not used any more (as everything read from a socket is a binary).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.