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

Muc light loop fix #1147

Merged
merged 3 commits into from
Jan 19, 2017
Merged

Muc light loop fix #1147

merged 3 commits into from
Jan 19, 2017

Conversation

ludwikbukowski
Copy link
Contributor

@ludwikbukowski ludwikbukowski commented Jan 10, 2017

This PR fixes infinite route loop triggered by muc_light.
Essentially, when someone tried to invite a user who contained domain reserved for the muclight service in his JID (by default its "muclight.HOST"), there was triggered infinite loop of function ejabberd_router:route/3. This was happening because muc_light processing didn't ignore error message

Proposed changes include:

  • test that checks if memory of c2s process is not growing when the loop is triggered by special affiliation change stanza
  • fix for the issue in the mod_muc_light

@ludwikbukowski ludwikbukowski force-pushed the muc-light-loop-fix branch 4 times, most recently from 0d5d0f4 to b0d543a Compare January 10, 2017 17:01
@@ -16,6 +16,7 @@
{exml, ".*", {git, "git://github.com/esl/exml.git", "2.4.0"}},
{lager, ".*", {git, "git://github.com/basho/lager.git", "3.2.4"}},
{lager_syslog, ".*", {git, "git://github.com/basho/lager_syslog.git", "3.0.3"}},
{ranch, ".*", {git, "https://github.com/ninenines/ranch.git", "1.3.0"}},
Copy link
Member

Choose a reason for hiding this comment

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

Apparently needs a rebase. Got polluted with ranch update PR. :)

[SessionRecPid] = rpc(ets, tab2list, [session]),
{session, {_, Pid}, _, _, _, _} = SessionRecPid,
%% maybe throws exception
check_process_memory_growing(Pid, 0, 2),
Copy link
Member

Choose a reason for hiding this comment

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

I think it should be called assert_process_memory_not_growing, because right now it looks like the test expects the process to grow.

@fenek
Copy link
Member

fenek commented Jan 11, 2017

Even though there are no conflicts, Merge branch 'master' of https://github.com/esl/mongooseim look kind of ugly. Can you please get rid of them with rebase -i or cherry-pick?

@michalwski
Copy link
Contributor

Even though there are no conflicts, Merge branch 'master' of https://github.com/esl/mongooseim look kind of ugly. Can you please get rid of them with rebase -i or cherry-pick?

Agree, we used to do rebase for small changes.

tests measures memory consumed by c2s process of user, who sent
wrongly prepared affiliation change stanza. If memory grows, test fails
the loop is triggered when someone sends special affiliation change stanza.
When someone tries to invite a user to a room and the user is wrongly named in
the invitation stanza (muclight.localhost domain instead of localhost), the
infinite loop of ejabberd_router:route/3 fun will be called.
@ludwikbukowski
Copy link
Contributor Author

sorry guys, I had broken master locally so rebasing wasn't working correctly. Anyway should be fine now

@michalwski
Copy link
Contributor

It is, thanks.
@fenek did @ludwikbukowski address your requests? Could you approve the changes and merge the PR (when travis passes)? This one is quite important bugfix.

@ludwikbukowski
Copy link
Contributor Author

one thing needs refactoring; having in mind that sessions can be kept in the redis,
RPC call to mnesia for c2s Pid doesnt work then.
thanks to Travis!

@michalwski
Copy link
Contributor

thanks to Travis!

That's why we have so many jobs on travis-ci.

@fenek
Copy link
Member

fenek commented Jan 13, 2017

When can we expect a fix for Redis job? :)

Host = lbin(escalus_users:get_host(Config, alice)),
Resource = <<"res1">>,
SessionRecPid = rpc(ejabberd_sm, get_session, [AUsername, Host, Resource]),
{{AUsername, Host, Resource},{_, Pid}, _, _} = SessionRecPid,

Choose a reason for hiding this comment

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

According to Elvis:

Missing space right "," on line 737

now its more generic and should work with other session backends
@michalwski michalwski merged commit 5b0c846 into master Jan 19, 2017
@michalwski michalwski deleted the muc-light-loop-fix branch January 19, 2017 15:48
@michalwski
Copy link
Contributor

Thanks!

This was referenced Jan 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants