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

Stream Management policy-violation "h attribute too big" #408

Closed
scatterbrain opened this issue Mar 19, 2015 · 4 comments
Closed

Stream Management policy-violation "h attribute too big" #408

scatterbrain opened this issue Mar 19, 2015 · 4 comments

Comments

@scatterbrain
Copy link

I'm testing out Stream Management support and wondering why I'm receiving a policy-violation error from MongooseIM. I'm using MongooseIM 1.5.

Message Log from the client's point of view starting from the bind:

XMPP Recv: <iq id="MX_1" type="result" xmlns="jabber:client">
  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
    <jid>a84d2e1007dd3d38379e3f7e5b200225c2f85f3ad72753febe4c4ce7aa00c6b4@testdomain.net/MatriX</jid>
  </bind>
</iq>


XMPP Send: <enable xmlns="urn:xmpp:sm:3" />

XMPP Send: <iq id="MX_2" type="set" xmlns="jabber:client">
  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
</iq>

XMPP Recv: <enabled xmlns="urn:xmpp:sm:3" />

XMPP Recv: <iq type="result" id="MX_2" xmlns="jabber:client">
  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
</iq>

XMPP Send: <iq id="MX_3" type="get" xmlns="jabber:client">
  <query xmlns="jabber:iq:roster" />
</iq>

XMPP Recv: <iq from="a84d2e1007dd3d38379e3f7e5b200225c2f85f3ad72753febe4c4ce7aa00c6b4@testdomain.net" to="a84d2e1007dd3d38379e3f7e5b200225c2f85f3ad72753febe4c4ce7aa00c6b4@testdomain.net/MatriX" id="MX_3" type="result" xmlns="jabber:client">
  <query xmlns="jabber:iq:roster”>
    <item subscription="none" jid="test@testdomain.net" />
  </query>
</iq>

XMPP Recv: <r xmlns="urn:xmpp:sm:3" />

XMPP Send: <a h="2" xmlns="urn:xmpp:sm:3" />

XMPP Recv: <stream:error xmlns:stream="http://etherx.jabber.org/streams">
  <policy-violation xmlns="urn:ietf:params:xml:ns:xmpp-streams" />
  <text xmlns="urn:ietf:params:xml:ns:xmpp-streams">h attribute too big</text>
</stream:error>

The xep-0198 states:

There are two values of 'h' for any given stream: one maintained by the client to keep track of stanzas it has handled from the server, and one maintained by the server to keep track of stanzas it has handled from the client. The client initializes its value to zero when it sends <enable/> to the server, and the server initializes its value to zero when it sends <enabled/> to the client (it is expected that the server will respond immediately to <enable/> and set its counter to zero at that time). After this initialization, the client increments its value of 'h' for each stanza it handles from server, and the server increments its value of 'h' for each stanza it handles from the client."

In the above log, the client receives two <iq/> result stanzas after it has sent the <enable/> so if I understand this correctly, it has replied with the correct h="2" attribute to the server's <r/>

Why does the server complain about policy-violation?

@erszcz
Copy link
Member

erszcz commented Mar 19, 2015

Good catch, thanks! We'll need to have a closer look at why this happens.

@studzien
Copy link
Contributor

There was an issue with such an order of session establishment (<enable> before <session>).
The fix has already been merged into the master branch.
Please try if this solves your problem.

@michalwski
Copy link
Contributor

The mentioned fix was done in #347

@scatterbrain
Copy link
Author

You are correct, building from the master branch fixed this issue for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants