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

Route accumulator #3240

Merged
merged 9 commits into from
Sep 3, 2021
Merged

Route accumulator #3240

merged 9 commits into from
Sep 3, 2021

Conversation

NelsonVides
Copy link
Collaborator

I'd like all routing to pass the accumulator along, with whatever modifications are needed like stripping it or updating the routed element. This will help with tracing the routing mechanism from start to end, if at all times the accumulator is preserved. It will also for example give me at the caller site, information about the packet handler's handling, like what muclight or pubsub did with the package. Then it is up to the caller to inspect the accumulator.

@mongoose-im

This comment has been minimized.

@codecov
Copy link

codecov bot commented Sep 2, 2021

Codecov Report

Merging #3240 (79dcea6) into master (61018c1) will increase coverage by 0.00%.
The diff coverage is 73.91%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3240   +/-   ##
=======================================
  Coverage   80.33%   80.34%           
=======================================
  Files         398      398           
  Lines       32540    32548    +8     
=======================================
+ Hits        26142    26150    +8     
  Misses       6398     6398           
Impacted Files Coverage Δ
src/mod_dynamic_domains_test.erl 0.00% <0.00%> (ø)
src/mongoose_packet_handler.erl 100.00% <ø> (ø)
src/mongoose_router_dynamic_domains.erl 100.00% <ø> (ø)
src/mongoose_router_global.erl 100.00% <ø> (ø)
src/muc_light/mod_muc_light_codec.erl 71.42% <ø> (ø)
src/muc_light/mod_muc_light_room.erl 93.33% <ø> (ø)
src/xmpp_router.erl 100.00% <ø> (ø)
src/pubsub/mod_pubsub.erl 73.23% <42.85%> (+0.05%) ⬆️
src/mod_muc.erl 74.94% <50.00%> (-0.18%) ⬇️
src/ejabberd_s2s.erl 82.08% <60.00%> (ø)
... and 23 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 61018c1...79dcea6. Read the comment docs.

@mongoose-im

This comment has been minimized.

src/ejabberd_router.erl Outdated Show resolved Hide resolved
@mongoose-im

This comment has been minimized.

@mongoose-im
Copy link
Collaborator

mongoose-im commented Sep 2, 2021

small_tests_24 / small_tests / adb2522
Reports root / small


internal_mnesia_24 / internal_mnesia / adb2522
Reports root/ big
OK: 1588 / Failed: 0 / User-skipped: 290 / Auto-skipped: 0


dynamic_domains_24 / pgsql_mnesia / adb2522
Reports root/ big
OK: 1690 / Failed: 0 / User-skipped: 114 / Auto-skipped: 0


small_tests_22 / small_tests / adb2522
Reports root / small


dynamic_domains_23 / pgsql_mnesia / adb2522
Reports root/ big
OK: 1690 / Failed: 0 / User-skipped: 114 / Auto-skipped: 0


small_tests_23 / small_tests / adb2522
Reports root / small


ldap_mnesia_23 / ldap_mnesia / adb2522
Reports root/ big
OK: 1515 / Failed: 0 / User-skipped: 363 / Auto-skipped: 0


ldap_mnesia_22 / ldap_mnesia / adb2522
Reports root/ big
OK: 1515 / Failed: 0 / User-skipped: 363 / Auto-skipped: 0


ldap_mnesia_24 / ldap_mnesia / adb2522
Reports root/ big
OK: 1515 / Failed: 0 / User-skipped: 363 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / adb2522
Reports root/ big
OK: 3090 / Failed: 0 / User-skipped: 184 / Auto-skipped: 0


elasticsearch_and_cassandra_24 / elasticsearch_and_cassandra_mnesia / adb2522
Reports root/ big
OK: 1891 / Failed: 0 / User-skipped: 286 / Auto-skipped: 0


pgsql_mnesia_22 / pgsql_mnesia / adb2522
Reports root/ big
OK: 3090 / Failed: 0 / User-skipped: 184 / Auto-skipped: 0


pgsql_mnesia_23 / pgsql_mnesia / adb2522
Reports root/ big
OK: 3090 / Failed: 0 / User-skipped: 184 / Auto-skipped: 0


mysql_redis_24 / mysql_redis / adb2522
Reports root/ big
OK: 3073 / Failed: 0 / User-skipped: 201 / Auto-skipped: 0


mssql_mnesia_24 / odbc_mssql_mnesia / adb2522
Reports root/ big
OK: 3090 / Failed: 0 / User-skipped: 184 / Auto-skipped: 0


riak_mnesia_24 / riak_mnesia / adb2522
Reports root/ big
OK: 1738 / Failed: 0 / User-skipped: 289 / Auto-skipped: 0

Copy link
Contributor

@vkatsuba vkatsuba left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link
Member

@chrzaszcz chrzaszcz left a comment

Choose a reason for hiding this comment

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

The code looks good, I only see one possible issue: if a host type and server is set in Acc, the call to ejabberd_router:route(From, To, Acc, Packet) will result (in case of a locally routed packet) in an Acc that has a different host type and server (the ones for the recipient). As a result, further processing of such Acc might e.g. trigger hooks for a wrong host type.

To make sure it's not an issue, one would have to check all calls to ejabberd_router:route/4 for which the result is not ignored and ensure that the resulting Acc is never used to run hooks for a host type etc.

@@ -41,6 +46,6 @@ do_route(OrigFrom, OrigTo, OrigAcc, OrigPacket, Handler) ->
drop ->
mongoose_hooks:xmpp_stanza_dropped(Acc0, OrigFrom,
OrigTo, OrigPacket),
ok
Acc0
Copy link
Member

Choose a reason for hiding this comment

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

Nice! It was against the spec.

@NelsonVides NelsonVides changed the title Route accumulator [WIP] Route accumulator Sep 2, 2021
@vkatsuba vkatsuba self-requested a review September 2, 2021 13:37
@NelsonVides NelsonVides changed the title [WIP] Route accumulator Route accumulator Sep 2, 2021
@mongoose-im
Copy link
Collaborator

mongoose-im commented Sep 2, 2021

small_tests_24 / small_tests / 79dcea6
Reports root / small


internal_mnesia_24 / internal_mnesia / 79dcea6
Reports root/ big
OK: 1588 / Failed: 0 / User-skipped: 290 / Auto-skipped: 0


dynamic_domains_24 / pgsql_mnesia / 79dcea6
Reports root/ big
OK: 1690 / Failed: 0 / User-skipped: 114 / Auto-skipped: 0


small_tests_22 / small_tests / 79dcea6
Reports root / small


dynamic_domains_23 / pgsql_mnesia / 79dcea6
Reports root/ big
OK: 1690 / Failed: 0 / User-skipped: 114 / Auto-skipped: 0


small_tests_23 / small_tests / 79dcea6
Reports root / small


ldap_mnesia_24 / ldap_mnesia / 79dcea6
Reports root/ big
OK: 1515 / Failed: 0 / User-skipped: 363 / Auto-skipped: 0


ldap_mnesia_22 / ldap_mnesia / 79dcea6
Reports root/ big
OK: 1515 / Failed: 0 / User-skipped: 363 / Auto-skipped: 0


ldap_mnesia_23 / ldap_mnesia / 79dcea6
Reports root/ big
OK: 1515 / Failed: 0 / User-skipped: 363 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / 79dcea6
Reports root/ big
OK: 3090 / Failed: 0 / User-skipped: 184 / Auto-skipped: 0


elasticsearch_and_cassandra_24 / elasticsearch_and_cassandra_mnesia / 79dcea6
Reports root/ big
OK: 1909 / Failed: 1 / User-skipped: 286 / Auto-skipped: 0

jingle_SUITE:all:jingle_session_is_established_with_a_conference_room
{error,
  {{assertion_failed,assert,is_iq_result,
     {xmlel,<<"iq">>,
       [{<<"from">>,<<"*[email protected]">>},
        {<<"to">>,
         <<"alice_jingle_session_is_established_with_a_conference_room_56.543391@localhost/res1">>},
        {<<"id">>,<<"7ad62f5a-ca6b-43e9-ac87-22c1c9e0a287">>},
        {<<"type">>,<<"set">>}],
       [{xmlel,<<"jingle">>,
          [{<<"xmlns">>,<<"urn:xmpp:jingle:1">>},
           {<<"action">>,<<"session-info">>},
           {<<"sid">>,<<"7c5f1353-426a-449c-8433-52dcf31582d6">>}],
          [{xmlel,<<"ringing">>,
             [{<<"xmlns">>,<<"urn:xmpp:jingle:apps:rtp:info:1">>}],
             []}]}]},
     "<iq from='*[email protected]' to='alice_jingle_session_is_established_with_a_conference_room_56.543391@localhost/res1' id='7ad62f5a-ca6b-43e9-ac87-22c1c9e0a287' type='set'><jingle xmlns='urn:xmpp:jingle:1' action='session-info' sid='7c5f1353-426a-449c-8433-52dcf31582d6'><ringing xmlns='urn:xmpp:jingle:apps:rtp:info:1'/></jingle></iq>"},
   [{escalus_new_assert,assert_true,2,
      [{file,
         "/home/circleci/app/big_tests/_build/default/lib/escalus/src/escalus_new_assert.erl"},
       {line,84}]},
    {jingle_SUITE,send_initiate_and_wait_for_first_iq_set,2,
      [{file,"/home/circleci/app/big_tests/tests/jingle_SUITE.erl"},
       {line,393}]},
    {jingle_SUITE,
      '-jingle_session_is_established_with_a_conference_room/1-fun-0-',1,
      [{file,"/home/circleci/app/big_tests/tests/jingle_SUITE.erl"},
       {line,1...

Report log


pgsql_mnesia_22 / pgsql_mnesia / 79dcea6
Reports root/ big
OK: 3090 / Failed: 0 / User-skipped: 184 / Auto-skipped: 0


mysql_redis_24 / mysql_redis / 79dcea6
Reports root/ big
OK: 3073 / Failed: 0 / User-skipped: 201 / Auto-skipped: 0


pgsql_mnesia_23 / pgsql_mnesia / 79dcea6
Reports root/ big
OK: 3090 / Failed: 0 / User-skipped: 184 / Auto-skipped: 0


mssql_mnesia_24 / odbc_mssql_mnesia / 79dcea6
Reports root/ big
OK: 3093 / Failed: 1 / User-skipped: 184 / Auto-skipped: 0

mod_event_pusher_rabbit_SUITE:group_chat_message_publish:group_chat_message_received_event_properly_formatted
{error,
  {{assertMatch,
     [{module,mod_event_pusher_rabbit_SUITE},
      {line,435},
      {expression,
        "get_decoded_message_from_rabbit ( AliceGroupChatMsgRecvRK )"},
      {pattern,
        "# { << \"from_user_id\" >> := BobRoomJID , << \"to_user_id\" >> := AliceFullJID , << \"message\" >> := Message }"},
      {value,
        #{<<"from_user_id">> => <<"[email protected]">>,
        <<"message">> => <<>>,
        <<"to_user_id">> =>
          <<"alice_unnamed_73.417057@localhost/res1">>}}]},
   [{mod_event_pusher_rabbit_SUITE,
      '-group_chat_message_received_event_properly_formatted/1-fun-1-',3,
      [{file,
         "/home/circleci/app/big_tests/tests/mod_event_pusher_rabbit_SUITE.erl"},
       {line,435}]},
    {escalus_story,story,4,
      [{file,
         "/home/circleci/app/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
       {line,72}]},
    {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


riak_mnesia_24 / riak_mnesia / 79dcea6
Reports root/ big
OK: 1738 / Failed: 0 / User-skipped: 289 / Auto-skipped: 0

Copy link
Member

@chrzaszcz chrzaszcz left a comment

Choose a reason for hiding this comment

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

Looks good

@chrzaszcz chrzaszcz merged commit 4ccfb03 into master Sep 3, 2021
@chrzaszcz chrzaszcz deleted the route_accumulator branch September 3, 2021 08:51
@Premwoik Premwoik added this to the 5.0.0 milestone Oct 5, 2021
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.

5 participants