-
Notifications
You must be signed in to change notification settings - Fork 428
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
Hunt BOSH interleave requests issue #869
Conversation
ad81d64
to
773fe12
Compare
7a1a27f
to
1c1b2c1
Compare
1c1b2c1
to
1e8cf1d
Compare
-export([test/1, sample/0, prop/1]). | ||
|
||
-export([initial_state/1, command/1, precondition/2, postcondition/3, | ||
next_state/3]). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Elvis:
Line 14 has a tab at column 0.
-export([ct_config_giver/1]). | ||
|
||
-record(state, {carol, | ||
geralt, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Elvis:
Line 27 has a tab at column 0.
?FORALL(Cmds, commands(?MODULE, initial_state(Pid)), | ||
?TRAPEXIT( | ||
begin | ||
{History,State,Result} = run_commands(?MODULE, Cmds), |
There was a problem hiding this comment.
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 43
escalus_client:stop(Client). | ||
|
||
initial_state(Pid) -> | ||
#state{carol = undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Elvis:
Line 63 has a tab at column 0.
?FORALL(Cmds, commands(?MODULE, initial_state(Pid)), | ||
?TRAPEXIT( | ||
begin | ||
{History,State,Result} = run_commands(?MODULE, Cmds), |
There was a problem hiding this comment.
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 43
|
||
initial_state(Pid) -> | ||
#state{carol = undefined, | ||
geralt = undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Elvis:
Line 64 has a tab at column 0.
maybe_stop_client(State#state.geralt), | ||
?WHENFAIL(ct:pal(error, "History: ~p~nState: ~p\nResult: ~p~n", | ||
[History,State,Result]), | ||
aggregate(command_names(Cmds), Result =:= ok)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Elvis:
Line 48 has a tab at column 0.
maybe_stop_client(State#state.carol), | ||
maybe_stop_client(State#state.geralt), | ||
?WHENFAIL(ct:pal(error, "History: ~p~nState: ~p\nResult: ~p~n", | ||
[History,State,Result]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Elvis:
Line 47 has a tab at column 0.
?FORALL(Cmds, commands(?MODULE, initial_state(Pid)), | ||
?TRAPEXIT( | ||
begin | ||
{History,State,Result} = run_commands(?MODULE, Cmds), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Elvis:
Line 43 has a tab at column 0.
prop(Config) -> | ||
Pid = spawn_link(?MODULE, ct_config_giver, [Config]), | ||
?FORALL(Cmds, commands(?MODULE, initial_state(Pid)), | ||
?TRAPEXIT( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Elvis:
Line 41 has a tab at column 0.
RMsgs = [exml_query:path(E, [{element, <<"body">>}, cdata]) | ||
|| E <- Stanzas], | ||
SortedMsgs = lists:sort([Msg || {_, Msg} <- Msgs]), | ||
ct:pal("waiting for: ~p~nreceived: ~p", [SortedMsgs, RMsgs]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Elvis:
Remove the debug call to ct:pal/2 on line 171.
{History,State,Result} = run_commands(?MODULE, Cmds), | ||
maybe_stop_client(State#state.carol), | ||
maybe_stop_client(State#state.geralt), | ||
?WHENFAIL(ct:pal(error, "History: ~p~nState: ~p\nResult: ~p~n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Elvis:
Line 46 has a tab at column 0.
|
||
prop(Config) -> | ||
Pid = spawn_link(?MODULE, ct_config_giver, [Config]), | ||
?FORALL(Cmds, commands(?MODULE, initial_state(Pid)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Elvis:
Line 40 has a tab at column 0.
Pid = spawn_link(?MODULE, ct_config_giver, [Config]), | ||
?FORALL(Cmds, commands(?MODULE, initial_state(Pid)), | ||
?TRAPEXIT( | ||
begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Elvis:
Line 42 has a tab at column 0.
?WHENFAIL(ct:pal(error, "History: ~p~nState: ~p\nResult: ~p~n", | ||
[History,State,Result]), | ||
aggregate(command_names(Cmds), Result =:= ok)) | ||
end)). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Elvis:
Line 49 has a tab at column 0.
maybe_stop_client(State#state.carol), | ||
maybe_stop_client(State#state.geralt), | ||
?WHENFAIL(ct:pal(error, "History: ~p~nState: ~p\nResult: ~p~n", | ||
[History,State,Result]), |
There was a problem hiding this comment.
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 47
maybe_stop_client(State#state.carol), | ||
maybe_stop_client(State#state.geralt), | ||
?WHENFAIL(ct:pal(error, "History: ~p~nState: ~p\nResult: ~p~n", | ||
[History,State,Result]), |
There was a problem hiding this comment.
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 47
?FORALL(Cmds, commands(?MODULE, initial_state(Pid)), | ||
?TRAPEXIT( | ||
begin | ||
{History,State,Result} = run_commands(?MODULE, Cmds), |
There was a problem hiding this comment.
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 43
maybe_stop_client(State#state.carol), | ||
maybe_stop_client(State#state.geralt), | ||
?WHENFAIL(ct:pal(error, "History: ~p~nState: ~p\nResult: ~p~n", | ||
[History,State,Result]), |
There was a problem hiding this comment.
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 47
maybe_stop_client(State#state.carol), | ||
maybe_stop_client(State#state.geralt), | ||
?WHENFAIL(ct:pal(error, "History: ~p~nState: ~p\nResult: ~p~n", | ||
[History,State,Result]), |
There was a problem hiding this comment.
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 47
?FORALL(Cmds, commands(?MODULE, initial_state(Pid)), | ||
?TRAPEXIT( | ||
begin | ||
{History,State,Result} = run_commands(?MODULE, Cmds), |
There was a problem hiding this comment.
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 43
0a12e4c
to
7219d3f
Compare
RMsgs = [exml_query:path(E, [{element, <<"body">>}, cdata]) | ||
|| E <- Stanzas], | ||
SortedMsgs = lists:sort([Msg || {_, Msg} <- Msgs]), | ||
ct:pal("waiting for: ~p~nreceived: ~p", [SortedMsgs, RMsgs]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Elvis:
Remove the debug call to ct:pal/2 on line 167.
7219d3f
to
0cbd01d
Compare
Should b7ca3b5 message reference PR 869 (this one)? Currently it references 868, which doesn't seem relevant. |
Yes, good catch! |
in some rare cases it is possible that stream:features arrive without the stream tag. In this case the xmlns:stream was not added which confused expath and probably other parsers
it is not possible to guarantee order of msgs received from BOSH is 100% tests
efdd38a
to
9a7ca19
Compare
The fix is only half line of code. Cached responses should be resent only if there is a handler, otherwise the RID is not incremented correctly when new request arrives and the session is terminated incorrectly. See PR #869 for more details about the bug.
9a7ca19
to
9609812
Compare
Proposed changes include:
rid
processing when there was a response delivered to the hendler which send biggerrid
then expectedxmlns:stream
attr in<body>
when stream features arrives in their own messageDetailed description of the deferred rids processing.
Assume expected
rid
has valueX
This bug happens when MongooseIM processes a request with
rid
X+1
beforeX
and there is a pending response to the client. In this situation Mongoose puts the request into deferred list which is expected. Also it sends the pending response to the client using this deferred connection which results in adding theX+1
rid
to cached responses list (used to track retransmissions). Later when the deferredrid
X+1
is process because the prev arrived, MongooseIM treats it as a retransmission (because therid
X+1
is on the cached responses list). Because of that the mainrid
is not updated correctly and expectsX+1
whereas it should expect nowX+2
. As a result the end the session is terminated upon receivingrid
X+3