Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mongoose c2s #3765

Merged
merged 251 commits into from
Feb 6, 2023
Merged

Mongoose c2s #3765

merged 251 commits into from
Feb 6, 2023

Conversation

NelsonVides
Copy link
Collaborator

@NelsonVides NelsonVides commented Sep 20, 2022

This is a feature branch for the new mongoose_c2s prototype. The goal is to have all of CI re-enabled and green.

Pending are things that were partially inside of the old ejabberd_c2s:

  • Presences: escalus needs them to function.
  • Ping
  • Stream management
  • CSI
  • Privacy lists
  • Last
  • Register

And tests that used to depend on the internals of ejabberd_c2s, ejabberd_c2s_sup, or the older version of ranch:

  • fix new version of ranch
  • Refactor tests using old c2s internals to be compatible with the new one
  • Fix all remaining disabled test suites
  • Verify test coverage does not go down

The flow is as follows:

init casts a `connect` message, to indicate the process that it needs to
establish the tcp connection, outside of the init function that blocks
the supervisor.

Then all states are handled in a single handle_event. The event connect
in state connecting indicates to end negotiating the connection. The
event info with payload from tcp or ssl, regardless of the state, simply
parses the payload using exml_stream, and adds all parsed packets as
internal action events of the OTP's gen_statem behaviour, that is, they
will be processed immediately as the next event in the state machine,
without involved message passing.

Then, as internal events, all packets are processed, according to their
running state machine state. One specific event is expected in that
state, and an appropriate handle_* helper does the work. States can be
compound, so now instead of sticking data of a specific state into the
state-machine memory, we can make it part of the state itself, and it
will be used in the next event in that state, see `{wait_for_feature,
after auth, _}` and `{wait_for_feature, before_auth, _}`.

Code that specifies stanzas is moved to a helper module that construct
all the verbose #xmlel{} packets, to keep the c2s module smaller and
separate protocol from state machine.
As connections are inherently long-lived, we'd want to avoid the
possibility of an attacker opening many connections that then only very
slowly progress, taking ports and memory from the system. If the
connection doesn't make progress fast enough towards the session
establishment, it should be dropped. This, of course, is configurable.
Note that gen_hook type now allows to take the type for the function
handler, in order to specify stronger types. Note that dialyzer might
not be strong enough to identify this polymorphism, but it might
probably be in the future, as well as different tools like Gradualizer.

Also mongoose_acc uses erlang:system_time/1 instead of the os
equivalent, to better resist time warps and also for performance, and
likewise such time is later used to calculate a metric for the time the
message took to be handled.

Now, all c2s handling stanzas will be captured and handled in hooks, and
mongoose_acc will be a universal accumulator.
Set a separate module, with its own edoc comments, all events that are
to be triggered by mongoose_c2s.
The idea is that hooks now can request the gen_statem engine to do
things on return, like putting payloads on the socket to deliver to the
user, adding timeouts to the engine, adding ad-hoc events to be
triggered by the engine (see gen_statem's next_event action), or pushing
a new callback module to take control over the state machine.

This accumulator, specific to the statem engine, is embedded into the
mongoose_acc map, and then parsed and acted upon on all hook and
handle_event returns.
This includes handling fast_tls, cleaning the declared types to avoid
confusion between what is a 'state' and what is 'data' in the context
of a state machine, implementing the language callbacks, bouncing
messages on termination, and adding an interface to handle handlers.
Prepare all knowledge of the tls configuration, whether to use ranch's
reuseport extension, and pass to ranch all other parameters that were
present in the c2s listener config.
chrzaszcz and others added 2 commits January 25, 2023 15:44
C2s/enable all suites

This PR enabled the last test suite: tcp_listener_SUITE.
It was testing an issue with a c2s connection breaking while it was being accepted by mongoose_tcp_listener.
Now c2s connections are handled by the ranch acceptor, which does not seem to have such an issue (I checked the code).

However, s2s and component (service) listeners still might suffer from the issue, so the updated test ensures that both are working correctly.
@mongoose-im

This comment was marked as outdated.

chrzaszcz and others added 8 commits January 26, 2023 12:36
Routing should be done only for stanzas.
Arbitrary messages shouldn't be sent this way - they are already sent
directly in multiple places.
The events are tagged to encourage meaningful and consistent
categories, and prevent evnts like '{item, _, _}' which are hard to debug.
C2s/Do not route broadcast tuples
@mongoose-im

This comment was marked as outdated.

Janusz Jakubiec and others added 2 commits January 27, 2023 14:35
@mongoose-im

This comment was marked as outdated.

chrzaszcz and others added 3 commits January 30, 2023 08:26
This was untested, and actually not working with mongoose_c2s.

Also:
- Do setup/teardown in init/end_per_testcase instead of doing it
in the test case.
- Do not setup/teardown inside parallel tests.
Previously the handlers were installed with the access rules
themselves, what caused:
- Possible duplication of handlers in case of same rules.
- Running all handlers sequentially, effectively performing an
intersection of all rules instead of applying rules for a given
listener.

Now the handlers are installed with the listener ID's,
and for each new session these ID's are compared with the c2s data,
resulting in only the right handler being executed.
The access rules can be just extracted from the c2s data itself.
@mongoose-im

This comment was marked as outdated.

@mongoose-im
Copy link
Collaborator

mongoose-im commented Jan 30, 2023

small_tests_24 / small_tests / 8f20f7f
Reports root / small


small_tests_25 / small_tests / 8f20f7f
Reports root / small


ldap_mnesia_24 / ldap_mnesia / 8f20f7f
Reports root/ big
OK: 2219 / Failed: 0 / User-skipped: 825 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 8f20f7f
Reports root/ big
OK: 4169 / Failed: 0 / User-skipped: 88 / Auto-skipped: 0


ldap_mnesia_25 / ldap_mnesia / 8f20f7f
Reports root/ big
OK: 2219 / Failed: 0 / User-skipped: 825 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 8f20f7f
Reports root/ big
OK: 4169 / Failed: 0 / User-skipped: 88 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / 8f20f7f
Reports root/ big
OK: 4549 / Failed: 0 / User-skipped: 97 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / 8f20f7f
Reports root/ big
OK: 4160 / Failed: 6 / User-skipped: 91 / Auto-skipped: 0

inbox_extensions_SUITE:regular:one_to_one:pagination:max_queries_can_be_limited
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"[email protected]/res1">>,
          escalus_tcp,<0.13130.1>,
          [{event_manager,<0.13086.1>},
           {server,<<"domain.example.com">>},
           {username,<<"bOb_max_queries_can_be_limited_1533">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.13086.1>},
            {server,<<"domain.example.com">>},
            {username,<<"bOb_max_queries_can_be_limited_1533">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,<<"bob_max_queries_can_be_limited_1533">>},
           {server,<<"domain.example.com">>},
           {host,<<"localhost">>},
           {port,5222},
           {auth,{escalus_auth,auth_plain}},
           {wspath,undefined},
           {username,<<"bOb_max_queries_can_be_limited_1533">>},
           {server,<<"domain.example.com">>},
           {host,<<"localhost">>},
           {password,<<"makrolika">>},
           {stream_id,<<"6884d926710fe09c">>}]},
        5000],
       [{file,
          "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {inbox_helper,'-given_conversations_between/2-fun-1-',4,
       [{file,"/home/circleci/project/big_tests/tests/inbox_helper.erl"},
        {line,543}]},
     {lists,foldl,3,[{file,"lists.erl"},{line,1350}]},
     {in...

Report log

inbox_extensions_SUITE:regular:one_to_one:pagination:max_queries_can_fetch_ahead
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"[email protected]/res1">>,
          escalus_tcp,<0.13135.1>,
          [{event_manager,<0.13121.1>},
           {server,<<"domain.example.com">>},
           {username,<<"bOb_max_queries_can_fetch_ahead_1538">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.13121.1>},
            {server,<<"domain.example.com">>},
            {username,<<"bOb_max_queries_can_fetch_ahead_1538">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,<<"bob_max_queries_can_fetch_ahead_1538">>},
           {server,<<"domain.example.com">>},
           {host,<<"localhost">>},
           {port,5222},
           {auth,{escalus_auth,auth_plain}},
           {wspath,undefined},
           {username,<<"bOb_max_queries_can_fetch_ahead_1538">>},
           {server,<<"domain.example.com">>},
           {host,<<"localhost">>},
           {password,<<"makrolika">>},
           {stream_id,<<"cf9b02e86d092d3d">>}]},
        5000],
       [{file,
          "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {inbox_helper,'-given_conversations_between/2-fun-1-',4,
       [{file,"/home/circleci/project/big_tests/tests/inbox_helper.erl"},
        {line,543}]},
     {lists,foldl,3,[{file,"lists.erl"},{line,1350}]},
   ...

Report log

inbox_extensions_SUITE:regular:one_to_one:pagination:can_paginate_backwards
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"[email protected]/res1">>,
          escalus_tcp,<0.13136.1>,
          [{event_manager,<0.13114.1>},
           {server,<<"domain.example.com">>},
           {username,<<"bOb_can_paginate_backwards_1537">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.13114.1>},
            {server,<<"domain.example.com">>},
            {username,<<"bOb_can_paginate_backwards_1537">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,<<"bob_can_paginate_backwards_1537">>},
           {server,<<"domain.example.com">>},
           {host,<<"localhost">>},
           {port,5222},
           {auth,{escalus_auth,auth_plain}},
           {wspath,undefined},
           {username,<<"bOb_can_paginate_backwards_1537">>},
           {server,<<"domain.example.com">>},
           {host,<<"localhost">>},
           {password,<<"makrolika">>},
           {stream_id,<<"fa27760d1865b305">>}]},
        5000],
       [{file,
          "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {inbox_helper,'-given_conversations_between/2-fun-1-',4,
       [{file,"/home/circleci/project/big_tests/tests/inbox_helper.erl"},
        {line,543}]},
     {lists,foldl,3,[{file,"lists.erl"},{line,1350}]},
     {inbox_extensions_SUITE...

Report log

inbox_extensions_SUITE:regular:one_to_one:pagination:pagination_overrides_form
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"[email protected]/res1">>,
          escalus_tcp,<0.13137.1>,
          [{event_manager,<0.13107.1>},
           {server,<<"domain.example.com">>},
           {username,<<"bOb_pagination_overrides_form_1536">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.13107.1>},
            {server,<<"domain.example.com">>},
            {username,<<"bOb_pagination_overrides_form_1536">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,<<"bob_pagination_overrides_form_1536">>},
           {server,<<"domain.example.com">>},
           {host,<<"localhost">>},
           {port,5222},
           {auth,{escalus_auth,auth_plain}},
           {wspath,undefined},
           {username,<<"bOb_pagination_overrides_form_1536">>},
           {server,<<"domain.example.com">>},
           {host,<<"localhost">>},
           {password,<<"makrolika">>},
           {stream_id,<<"6a40f5b74af71f4e">>}]},
        5000],
       [{file,
          "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {inbox_helper,'-given_conversations_between/2-fun-1-',4,
       [{file,"/home/circleci/project/big_tests/tests/inbox_helper.erl"},
        {line,543}]},
     {lists,foldl,3,[{file,"lists.erl"},{line,1350}]},
     {inbox_e...

Report log

inbox_extensions_SUITE:regular:one_to_one:pagination:can_paginate_forwards
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"[email protected]/res1">>,
          escalus_tcp,<0.13139.1>,
          [{event_manager,<0.13093.1>},
           {server,<<"domain.example.com">>},
           {username,<<"kate_can_paginate_forwards_1534">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.13093.1>},
            {server,<<"domain.example.com">>},
            {username,<<"kate_can_paginate_forwards_1534">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,<<"kate_can_paginate_forwards_1534">>},
           {server,<<"domain.example.com">>},
           {host,<<"localhost">>},
           {port,5222},
           {auth,{escalus_auth,auth_plain}},
           {wspath,undefined},
           {username,<<"kate_can_paginate_forwards_1534">>},
           {server,<<"domain.example.com">>},
           {host,<<"localhost">>},
           {password,<<"makrowe;p">>},
           {stream_id,<<"562af4e842958a8e">>}]},
        5000],
       [{file,
          "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {inbox_helper,'-given_conversations_between/2-fun-1-',4,
       [{file,"/home/circleci/project/big_tests/tests/inbox_helper.erl"},
        {line,543}]},
     {lists,foldl_1,3,[{file,"lists.erl"},{line,1355}]},
     {inbox_extensions_SUI...

Report log

muc_SUITE:hibernation:hibernated_room_can_be_queried_for_archive
{error,{{assertion_failed,assert,is_groupchat_message,
              [<<"Restorable message">>],
              undefined,"undefined"},
    [{escalus_new_assert,assert_true,2,
               [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_new_assert.erl"},
                {line,84}]},
     {muc_SUITE,wait_for_mam_result,3,
          [{file,"/home/circleci/project/big_tests/tests/muc_SUITE.erl"},
           {line,4394}]},
     {muc_SUITE,'-hibernated_room_can_be_queried_for_archive/1-fun-0-',3,
          [{file,"/home/circleci/project/big_tests/tests/muc_SUITE.erl"},
           {line,4130}]},
     {escalus_story,story,4,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
             {line,72}]},
     {muc_SUITE,hibernated_room_can_be_queried_for_archive,1,
          [{file,"/home/circleci/project/big_tests/tests/muc_SUITE.erl"},
           {line,4126}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
     {test_server,run_test_case_eval1,6,
            [{file,"test_server.erl"},{line,1291}]},
     {test_server,run_test_case_eval,9,
            [{file,"test_server.erl"},{line,1223}]}]}}

Report log


internal_mnesia_25 / internal_mnesia / 8f20f7f
Reports root/ big
OK: 2361 / Failed: 0 / User-skipped: 683 / Auto-skipped: 0


elasticsearch_and_cassandra_25 / elasticsearch_and_cassandra_mnesia / 8f20f7f
Reports root/ big
OK: 2721 / Failed: 0 / User-skipped: 662 / Auto-skipped: 0


riak_mnesia_24 / riak_mnesia / 8f20f7f
Reports root/ big
OK: 2558 / Failed: 1 / User-skipped: 654 / Auto-skipped: 0

graphql_server_SUITE:admin_http:clustering_http_tests:remove_dead_from_cluster_http
{error,
  {{badrpc,
     {'EXIT',
       {{try_clause,
          {badrpc,{'EXIT',{aborted,{no_exists,node,storage_type}}}}},
        [{mongoose_cluster,table_type,2,
           [{file,"/home/circleci/project/src/mongoose_cluster.erl"},
          {line,158}]},
         {mongoose_cluster,'-unsafe_join/2-lc$^0/1-0-',2,
           [{file,"/home/circleci/project/src/mongoose_cluster.erl"},
          {line,119}]},
         {mongoose_cluster,unsafe_join,2,
           [{file,"/home/circleci/project/src/mongoose_cluster.erl"},
          {line,120}]},
         {mongoose_cluster,with_app_stopped,2,
           [{file,"/home/circleci/project/src/mongoose_cluster.erl"},
          {line,221}]},
         {global,trans,4,[{file,"global.erl"},{line,463}]},
         {mongoose_cluster,join,1,[]}]}}},
   [{distributed_helper,rpc,
      [#{node => mongooseim3@localhost,timeout => 60000},
       mongoose_cluster,join,
       [mongooseim@localhost]],
      [{file,
         "/home/circleci/project/big_tests/tests/distributed_helper.erl"},
       {line,121}]},
    {graphql_server_SUITE,remove_dead_from_cluster_http,1,
      [{file,
         "/home/circleci/project/big_tests/tests/graphql_server_SUITE.erl"},
       {line,247}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_server.erl"},{line,1292}]},
    {test_server,run_test_case_eval,9,
      [{file,"test_server.erl"},{line,1224}]}]}}

Report log


pgsql_mnesia_25 / pgsql_mnesia / 8f20f7f
Reports root/ big
OK: 4549 / Failed: 0 / User-skipped: 97 / Auto-skipped: 0


mysql_redis_25 / mysql_redis / 8f20f7f
Reports root/ big
OK: 4535 / Failed: 0 / User-skipped: 111 / Auto-skipped: 0


mssql_mnesia_25 / odbc_mssql_mnesia / 8f20f7f
Reports root/ big
OK: 4545 / Failed: 1 / User-skipped: 100 / Auto-skipped: 0

inbox_extensions_SUITE:async_pools:one_to_one:mute_muted_entry_gets_unmuted
{error,
  {{assert,
     [{module,inbox_extensions_SUITE},
      {line,882},
      {expression,"escalus_pred : is_message ( Message )"},
      {expected,true},
      {value,false}]},
   [{inbox_extensions_SUITE,check_message_with_properties,4,
      [{file,
         "/home/circleci/project/big_tests/tests/inbox_extensions_SUITE.erl"},
       {line,882}]},
    {inbox_extensions_SUITE,set_inbox_properties,4,
      [{file,
         "/home/circleci/project/big_tests/tests/inbox_extensions_SUITE.erl"},
       {line,876}]},
    {inbox_extensions_SUITE,'-mute_muted_entry_gets_unmuted/1-fun-2-',2,
      [{file,
         "/home/circleci/project/big_tests/tests/inbox_extensions_SUITE.erl"},
       {line,575}]},
    {escalus_story,story,4,
      [{file,
         "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
       {line,72}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_server.erl"},{line,1291}]},
    {test_server,run_test_case_eval,9,
      [{file,"test_server.erl"},{line,1223}]}]}}

Report log


dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / 8f20f7f
Reports root/ big
OK: 4166 / Failed: 0 / User-skipped: 91 / Auto-skipped: 0


mssql_mnesia_25 / odbc_mssql_mnesia / 8f20f7f
Reports root/ big
OK: 4546 / Failed: 0 / User-skipped: 100 / Auto-skipped: 0


riak_mnesia_24 / riak_mnesia / 8f20f7f
Reports root/ big
OK: 2559 / Failed: 0 / User-skipped: 654 / Auto-skipped: 0


riak_mnesia_24 / riak_mnesia / 8f20f7f
Reports root/ big
OK: 2559 / Failed: 0 / User-skipped: 654 / Auto-skipped: 0


riak_mnesia_24 / riak_mnesia / 8f20f7f
Reports root/ big
OK: 1157 / Failed: 4 / User-skipped: 341 / Auto-skipped: 1538

graphql_server_SUITE:admin_http:clustering_http_tests:remove_dead_from_cluster_http
{error,
  {{badrpc,
     {'EXIT',
       {badarg,
         [{persistent_term,get,
            [{mongoose_config,listen}],
            [{error_info,#{module => erl_erts_errors}}]},
          {mongoose_config,get_opt,1,
            [{file,
               "/home/circleci/project/src/config/mongoose_config.erl"},
             {line,118}]}]}}},
   [{distributed_helper,rpc,
      [#{node => mongooseim@localhost},mongoose_config,get_opt,[listen]],
      [{file,
         "/home/circleci/project/big_tests/tests/distributed_helper.erl"},
       {line,121}]},
    {graphql_helper,get_listener_config,2,
      [{file,"/home/circleci/project/big_tests/tests/graphql_helper.erl"},
       {line,143}]},
    {graphql_helper,get_listener_opts,1,
      [{file,"/home/circleci/project/big_tests/tests/graphql_helper.erl"},
       {line,198}]},
    {graphql_helper,make_admin_creds,2,
      [{file,"/home/circleci/project/big_tests/tests/graphql_helper.erl"},
       {line,114}]},
    {graphql_helper,execute_auth,3,
      [{file,"/home/circleci/project/big_tests/tests/graphql_helper.erl"},
       {line,103}]},
    {graphql_server_SUITE,remove_dead_from_cluster_http,1,
      [{file,
         "/home/circleci/project/big_tests/tests/graphql_server_SUITE.erl"},
       {line,251}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_server.erl"},{line,1292}]}]}}

Report log

graphql_server_SUITE:admin_http:clustering_http_tests:remove_alive_from_cluster_http
{error,
  {{badrpc,
     {'EXIT',
       {#{cluster_member => mongooseim@localhost,
        reason => set_extra_db_nodes_failed,
        result => {ok,[]}},
        [{mongoose_cluster,set_extra_db_nodes,1,
           [{file,"/home/circleci/project/src/mongoose_cluster.erl"},
          {line,132}]},
         {mongoose_cluster,unsafe_join,2,
           [{file,"/home/circleci/project/src/mongoose_cluster.erl"},
          {line,116}]},
         {mongoose_cluster,with_app_stopped,2,
           [{file,"/home/circleci/project/src/mongoose_cluster.erl"},
          {line,221}]},
         {global,trans,4,[{file,"global.erl"},{line,463}]},
         {mongoose_cluster,join,1,[]}]}}},
   [{distributed_helper,rpc,
      [#{node => mongooseim2@localhost,timeout => 60000},
       mongoose_cluster,join,
       [mongooseim@localhost]],
      [{file,
         "/home/circleci/project/big_tests/tests/distributed_helper.erl"},
       {line,121}]},
    {graphql_server_SUITE,remove_alive_from_cluster_http,1,
      [{file,
         "/home/circleci/project/big_tests/tests/graphql_server_SUITE.erl"},
       {line,266}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_server.erl"},{line,1292}]},
    {test_server,run_test_case_eval,9,
      [{file,"test_server.erl"},{line,1224}]}]}}

Report log

graphql_server_SUITE:admin_http:clustering_http_tests:remove_node_test
{error,
  {{badrpc,
     {'EXIT',
       {badarg,
         [{persistent_term,get,
            [{mongoose_config,listen}],
            [{error_info,#{module => erl_erts_errors}}]},
          {mongoose_config,get_opt,1,
            [{file,
               "/home/circleci/project/src/config/mongoose_config.erl"},
             {line,118}]}]}}},
   [{distributed_helper,rpc,
      [#{node => mongooseim@localhost},mongoose_config,get_opt,[listen]],
      [{file,
         "/home/circleci/project/big_tests/tests/distributed_helper.erl"},
       {line,121}]},
    {graphql_helper,get_listener_config,2,
      [{file,"/home/circleci/project/big_tests/tests/graphql_helper.erl"},
       {line,143}]},
    {graphql_helper,get_listener_opts,1,
      [{file,"/home/circleci/project/big_tests/tests/graphql_helper.erl"},
       {line,198}]},
    {graphql_helper,make_admin_creds,2,
      [{file,"/home/circleci/project/big_tests/tests/graphql_helper.erl"},
       {line,114}]},
    {graphql_helper,execute_auth,3,
      [{file,"/home/circleci/project/big_tests/tests/graphql_helper.erl"},
       {line,103}]},
    {graphql_server_SUITE,remove_node_test,1,
      [{file,
         "/home/circleci/project/big_tests/tests/graphql_server_SUITE.erl"},
       {line,210}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_server.erl"},{line,1292}]}]}}

Report log

graphql_server_SUITE:admin_http:clustering_http_tests:stop_node_test
{error,
  {{badrpc,
     {'EXIT',
       {badarg,
         [{persistent_term,get,
            [{mongoose_config,listen}],
            [{error_info,#{module => erl_erts_errors}}]},
          {mongoose_config,get_opt,1,
            [{file,
               "/home/circleci/project/src/config/mongoose_config.erl"},
             {line,118}]}]}}},
   [{distributed_helper,rpc,
      [#{node => mongooseim@localhost},mongoose_config,get_opt,[listen]],
      [{file,
         "/home/circleci/project/big_tests/tests/distributed_helper.erl"},
       {line,121}]},
    {graphql_helper,get_listener_config,2,
      [{file,"/home/circleci/project/big_tests/tests/graphql_helper.erl"},
       {line,143}]},
    {graphql_helper,get_listener_opts,1,
      [{file,"/home/circleci/project/big_tests/tests/graphql_helper.erl"},
       {line,198}]},
    {graphql_helper,make_admin_creds,2,
      [{file,"/home/circleci/project/big_tests/tests/graphql_helper.erl"},
       {line,114}]},
    {graphql_helper,execute_auth,3,
      [{file,"/home/circleci/project/big_tests/tests/graphql_helper.erl"},
       {line,103}]},
    {graphql_server_SUITE,stop_node_test,1,
      [{file,
         "/home/circleci/project/big_tests/tests/graphql_server_SUITE.erl"},
       {line,215}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_server.erl"},{line,1292}]}]}}

Report log

graphql_server_SUITE:admin_cli:init_per_group
{'EXIT',
  {{badrpc,
     {'EXIT',
       {noproc,{gen_server,call,[admin_schema_ep,get_endpoint_ctx]}}}},
   [{distributed_helper,rpc,
      [#{node => mongooseim@localhost},
       mongoose_graphql_commands,build_specs,
       [admin]],
      [{file,
         "/home/circleci/project/big_tests/tests/distributed_helper.erl"},
       {line,121}]},
    {graphql_helper,add_specs,1,
      [{file,"/home/circleci/project/big_tests/tests/graphql_helper.erl"},
       {line,181}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_server.erl"},{line,1380}]},
    {test_server,run_test_case_eval,9,
      [{file,"test_server.erl"},{line,1224}]}]}}

Report log

graphql_server_SUITE:end_per_suite
{error,
  {{badrpc,
     {'EXIT',
       {badarg,
         [{persistent_term,get,
            [{mongoose_config,{modules,<<"localhost">>}}],
            [{error_info,#{module => erl_erts_errors}}]},
          {mongoose_config,get_opt,1,
            [{file,
               "/home/circleci/project/src/config/mongoose_config.erl"},
             {line,118}]},
          {gen_mod,loaded_modules_with_opts,1,[]}]}}},
   [{distributed_helper,rpc,
      [#{node => mongooseim@localhost},
       gen_mod,loaded_modules_with_opts,
       [<<"localhost">>]],
      [{file,
         "/home/circleci/project/big_tests/tests/distributed_helper.erl"},
       {line,121}]},
    {dynamic_modules,restore_modules,3,
      [{file,"/home/circleci/project/big_tests/tests/dynamic_modules.erl"},
       {line,50}]},
    {dynamic_modules,'-restore_modules/2-lc$^0/1-0-',2,
      [{file,"/home/circleci/project/big_tests/tests/dynamic_modules.erl"},
       {line,45}]},
    {dynamic_modules,restore_modules,2,
      [{file,"/home/circleci/project/big_tests/tests/dynamic_modules.erl"},
       {line,46}]},
    {graphql_server_SUITE,end_per_suite,1,
      [{file,
         "/home/circleci/project/big_tests/tests/graphql_server_SUITE.erl"},
       {line,76}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_server.erl"},{line,1380}]},
    {test_server,run_test_case_eval,9,
      [{file,"test_server.erl"},{line,1224}]}]}}

Report log

graphql_metric_SUITE:metrics_http:init_per_group
{'EXIT',
  {{badrpc,
     {'EXIT',
       {badarg,
         [{persistent_term,get,
            [{mongoose_config,listen}],
            [{error_info,#{module => erl_erts_errors}}]},
          {mongoose_config,get_opt,1,
            [{file,
               "/home/circleci/project/src/config/mongoose_config.erl"},
             {line,118}]}]}}},
   [{distributed_helper,rpc,
      [#{node => mongooseim@localhost},mongoose_config,get_opt,[listen]],
      [{file,
         "/home/circleci/project/big_tests/tests/distributed_helper.erl"},
       {line,121}]},
    {graphql_helper,get_listener_config,2,
      [{file,"/home/circleci/project/big_tests/tests/graphql_helper.erl"},
       {line,143}]},
    {graphql_helper,get_listener_opts,1,
      [{file,"/home/circleci/project/big_tests/tests/graphql_helper.erl"},
       {line,198}]},
    {graphql_helper,init_admin_handler,1,
      [{file,"/home/circleci/project/big_tests/tests/graphql_helper.erl"},
       {line,150}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_server.erl"},{line,1380}]},
    {test_server,run_test_case_eval,9,
      [{file,"test_server.erl"},{line,1224}]}]}}

Report log

graphql_metric_SUITE:metrics_cli:init_per_group
{'EXIT',
  {{badrpc,
     {'EXIT',
       {noproc,{gen_server,call,[admin_schema_ep,get_endpoint_ctx]}}}},
   [{distributed_helper,rpc,
      [#{node => mongooseim@localhost},
       mongoose_graphql_commands,build_specs,
       [admin]],
      [{file,
         "/home/circleci/project/big_tests/tests/distributed_helper.erl"},
       {line,121}]},
    {graphql_helper,add_specs,1,
      [{file,"/home/circleci/project/big_tests/tests/graphql_helper.erl"},
       {line,181}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_server.erl"},{line,1380}]},
    {test_server,run_test_case_eval,9,
      [{file,"test_server.erl"},{line,1224}]}]}}

Report log

graphql_metric_SUITE:domain_admin_metrics:init_per_group
{'EXIT',
  {{badrpc,
     {'EXIT',
       {badarg,
         [{ets,lookup,
            [mongoose_wpool,{rdbms,<<"localhost">>,default}],
            [{error_info,
               #{cause => id,module => erl_stdlib_errors}}]},
          {mongoose_wpool,get_pool,3,
            [{file,
               "/home/circleci/project/src/wpool/mongoose_wpool.erl"},
             {line,395}]},
          {mongoose_wpool,call,4,
            [{file,
               "/home/circleci/project/src/wpool/mongoose_wpool.erl"},
             {line,259}]},
          {mongoose_rdbms,sql_transaction,2,[]}]}}},
   [{distributed_helper,rpc,
      [#{node => mongooseim@localhost},
       mongoose_rdbms,sql_transaction,
       [<<"localhost">>,fun erlang:yield/0]],
      [{file,
         "/home/circleci/project/big_tests/tests/distributed_helper.erl"},
       {line,121}]},
    {mongoose_helper,is_rdbms_enabled,1,
      [{file,"/home/circleci/project/big_tests/tests/mongoose_helper.erl"},
       {line,60}]},
    {graphql_helper,init_domain_admin_handler,2,
      [{file,"/home/circleci/project/big_tests/tests/graphql_helper.erl"},
       {line,169}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_server.erl"},{line,1380}]},
    {test_server,run_test_case_eval,9,
      [{file,"test_server.erl"},{line,1224}]}]}}

Report log

:error_in_suite
{error,'inbox_SUITE:all/0 failed'}

Report log

:error_in_suite
{error,'inbox_extensions_SUITE:all/0 failed'}

Report log

jingle_SUITE:init_per_suite
{'EXIT',
  {{badrpc,
     {'EXIT',
       {#{cluster_member => mongooseim@localhost,
        reason => set_extra_db_nodes_failed,
        result => {ok,[]}},
        [{mongoose_cluster,set_extra_db_nodes,1,
           [{file,"/home/circleci/project/src/mongoose_cluster.erl"},
          {line,132}]},
         {mongoose_cluster,unsafe_join,2,
           [{file,"/home/circleci/project/src/mongoose_cluster.erl"},
          {line,116}]},
         {mongoose_cluster,with_app_stopped,2,
           [{file,"/home/circleci/project/src/mongoose_cluster.erl"},
          {line,221}]},
         {global,trans,4,[{file,"global.erl"},{line,463}]},
         {mongoose_cluster,join,1,[]}]}}},
   [{distributed_helper,rpc,
      [#{node => mongooseim2@localhost,timeout => 30000},
       mongoose_cluster,join,
       [mongooseim@localhost]],
      [{file,
         "/home/circleci/project/big_tests/tests/distributed_helper.erl"},
       {line,121}]},
    {distributed_helper,add_node_to_cluster,2,
      [{file,
         "/home/circleci/project/big_tests/tests/distributed_helper.erl"},
       {line,29}]},
    {jingle_SUITE,init_per_suite,1,
      [{file,"/home/circleci/project/big_tests/tests/jingle_SUITE.erl"},
       {line,61}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_server.erl"},{line,1380}]},
    {test_server,run_test_case_eval,9,
      [{file,"test_server.erl"},{line,1224}]}]}}

Report log

login_SUITE:error_in_suite
{error,'mam_SUITE:groups/0 failed'}

Report log

sic_SUITE:error_in_suite
{error,'smart_markers_SUITE:all/0 failed'}

Report log

@chrzaszcz chrzaszcz marked this pull request as ready for review January 30, 2023 09:49
@chrzaszcz chrzaszcz marked this pull request as draft January 30, 2023 09:58
@chrzaszcz
Copy link
Member

Postponing the merge to master until this PR is load-tested.

@chrzaszcz
Copy link
Member

chrzaszcz commented Feb 2, 2023

Load test report summary

  1. Baseline: PR-3948 (last PR merged to master)
  2. Tested version: PR-3765 with mongoose_c2s

The c2s rework caused no statistically significant changes in performance. A more significant improvement in CPU usage of 1-4% was seen between PR-3394 and PR-3948/PR-3765, i.e. before the c2s rework. This was not investigated any further because it was out of scope of the c2s load tests.

One missing metric (mam_lookup) was detected for both code versions – this can be investigated separately.

Performed tests:

  • One-to-one chat with MAM, w/o Inbox
  • One-to-one chat with MAM and Inbox
  • One-to-one MAM lookup
  • MUC Light with MAM, w/o Inbox

@chrzaszcz chrzaszcz marked this pull request as ready for review February 2, 2023 17:34
Copy link
Collaborator

@DenysGonchar DenysGonchar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this feature branch is ready to be merged, all the remaining minor tasks can be continued on master.

@DenysGonchar DenysGonchar merged commit 06a1d21 into master Feb 6, 2023
@DenysGonchar DenysGonchar deleted the feature/mongoose_c2s branch February 6, 2023 14:55
@jacekwegr jacekwegr added this to the 6.1.0 milestone Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants