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

Service-not-available error on message with no-store element #398

Closed
sawantuday opened this issue Jan 8, 2015 · 6 comments
Closed

Service-not-available error on message with no-store element #398

sawantuday opened this issue Jan 8, 2015 · 6 comments

Comments

@sawantuday
Copy link

Sending message with <no-store xmlns="url:xmpp:hints"/> results in service-not-available error.

@weiss
Copy link
Member

weiss commented Jan 8, 2015

From looking at the code, I don't see how a <no-store/> tag could trigger an error stanza; and I can't reproduce the issue even if the receiving contact is offline. In the latter case, you might actually expect such an error message, but ejabberd won't generate it. I'll add that to my TODO list.

So, I don't think you got that error stanza because of the <no-store/> tag if the recipient is using ejabberd. Can you reproduce the issue? If so, could you generate a dump of the (relevant part of the) XMPP stream? What ejabberd version is the recipient using?

@sawantuday
Copy link
Author

I can reproduce the same on my local dev machine. I am using ejabberd v 14.07 built from source.

  1. exchange messages when both users are online - everything works well
  2. send message to offline user - message is stored in offline storage
  3. send message with <no-store/> to offline user - message is not stored and error is returned

Error details
type = cancel
code = 503
child = <service-unavailable/>

Following is the transcript

S:<message type="chat" to="uday@localhost" id="aae9a">
    <body>asd</body>
    <active xmlns="http://jabber.org/protocol/chatstates"/>
</message>


S:<message type="chat" to="uday@localhost" id="aaeaa">
    <body>a</body>
    <active xmlns="http://jabber.org/protocol/chatstates"/>
</message>


S:<message type="chat" to="uday@localhost" id="aae9a">
    <body>asd</body>
    <no-store xmlns="urn:xmpp:hints"/>
    <active xmlns="http://jabber.org/protocol/chatstates"/>
</message>

R:<message from="uday@localhost" type="error" xml:lang="en" to="admin@localhost/j12jk3h" id="aae9a">
    <body>asd</body>
    <no-store xmlns="urn:xmpp:hints"/>
    <active xmlns="http://jabber.org/protocol/chatstates"/>
    <error type="cancel" code="503">
        <service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
    </error>
</message>

I am using PSI as my xmpp client.

PS: I am total noob in erlang but little experimentation solved the problem.
I changed this line from ok to stop and now its working as expected.

@weiss
Copy link
Member

weiss commented Jan 8, 2015

What you describe sounds like you have some other module that's subscribed to the offline_message_hook. That other module generates the error stanza (unless you stop hook execution before it's called). I have no idea what module that might be. Are you running any custom stuff?

Either way, wouldn't you expect that error stanza if the recipient is offline and <no-store/> is specified?

@sawantuday
Copy link
Author

Yes, you are right. I checked with XEP and it says the server should return <service-unavailable/> when the user is offline and server is unable to store message for later delivery (in this case because of <no-store> element).

Thanks for your time and quick response.

@weiss
Copy link
Member

weiss commented Jan 8, 2015

Okay, thanks for the feedback.

I now understood why I wasn't able to reproduce the (correct) behavior, by the way: I copied your <no-store/> tag when generating a test <message/>, and that tag has a typo in the xmlns attribute (url instead of urn) :-P Apart from that, I've overlooked that ejabberd_sm subscribes to the offline_message_hook itself to generate that error stanza.

So, everything is fine.

erszcz pushed a commit to erszcz/ejabberd that referenced this issue Nov 7, 2015
@lock
Copy link

lock bot commented Jun 12, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants