"error while sending message ( recipient-unavailable )" randomly shows up in chat window
The message "error while sending message ( recipient-unavailable )" randomly shows up in chat windows sometimes. This also happened when I didn't send any message to that contact recently, so I have no idea what's actually causing the problem here. Even when starting gajim on the console, no error is logged there.
The particularly annoying aspect of this bug is that this message causes a "new message" notification, the window gets highlighted and the tray icon blinks.
I guess what I'm mostly asking about right now is to make the error message more informative.
Steps to reproduce
OS version: Debian testing
GTK version: 2.24.29
PyGTK version: 2.24.0
I also encountered this bug from time to time.
My guess is, that this is triggered by presence queries that cannot be delivered.
I suppose there was a S2S problem when that occured. The problem with making this error less visible is that is that happen with a real message you send, you'd be happy to know that it wasn't delivered ...
No...I also have this messages on my personal server without federation.
Both chat partners are on my server and sometimes I randomly receive such error messages when the contact goes offline.
But this is hours after I wrote messages to this contact (which where all received already by the way).
How much does the client know about the message that this error is about? As a start, it'd be great if the client could log some more details on the console.
Well, it would be nice to at least log the message id of the message which causes this error...
You could open the XML-console and wait for the bug then and when it happens search for the logged message id in the xml console to see what message exactly caused the error to appear :)
Well you should see this error message in XML logs. So it's easy to see the id and scroll back to send the sent message.
relevant stanzas which triggered this error
I just added a XML log which shows what stanzas trigger this error.
In my gajim chat window the following status/error messages are displayed (sorry for the german text parts):
[22:18:02] user_a/mobile ist jetzt Hat einen Fehler (recipient-unavailable) [22:18:02] Fehler beim Senden von Nachricht ( recipient-unavailable ) [22:18:02] user_a ist jetzt Abgemeldet (Disconnected: Replaced by new connection) [22:18:08] user_a ist jetzt Verfügbar
Translated (but I don't know if this is the "official" english text in gajim):
[22:18:02] user_a/mobile is now has an error (recipient-unavailable) [22:18:02] error while sending message ( recipient-unavailable ) [22:18:02] user_a is now offline (Disconnected: Replaced by new connection) [22:18:08] user_a is now available
Logs are clear. You received a presence because your server was unable to send a presence and a message to your contact. Would you expect Gajim to ignore that and don't inform you that something went wrong?
[08:06:52 AM] error while sending message ( service-unavailable )
I really like gajim and was evaluating it for use in our company to replace pidgin. The message carbon support is awesome in gajim!
I have one issue that may be the same as this persons issue. I get many dozens of these messages showing up in many chat windows. The sender isn't even online and may not even have a client connected to the jabber server.
[08:06:52 AM] error while sending message ( service-unavailable ) [08:06:52 AM] error while sending message ( service-unavailable ) [08:06:53 AM] error while sending message ( service-unavailable )
Im not sure what these are but I think they should be filtered away from chat windows. Perhaps an advanced option to show them for debugging or verbosity.
Our jabber server: Openfire 3.10.2
Attaching copy/paste from XML console log.
@asterix: No, I would expect such messages to only appear for xmpp stanzas I sent manually (so to speak: messages I really wrote).
And to ignore such error messages for automatically sent stanzas like chatsate or presence stanzas.
Currently this error message is shown for every error reply, even if it is an error to an automatic stanza (like presence or chatstate).
@innominatus: this is exactly what triggers such messages for you (I would suspect it is the presence stanza for you)
No it's not presences, it's PEP messages, that are sent by the server. So maybe this request should go to the server: do not send us message errors for messages we haven't sent explicitly to a contact.
Same thing for the previous presence. We sent our presence to our server, which forwards it to our contact list. So we receive a presence error, for a presence that our server sent to a contact.
Well, I think all errors not corresponding to a message sent explicitly by a user should be ignored by gajim.
@asterix: would be nice if you could do this as I currently have no time (hold a list of all explicitly sent message ids and check this list on incoming errors, then ignore every error not having an corresponding entry in this list).
I had some time to create a patch and test it. This patch adds some new members to some events to get and store the message id of sent messages and to distinguish manually sent message stanzas from atomatically generated ones.
At the top there is the change in src/chat_control.py which adds a automatic_message=False to the generated MessageOutgoingEvent (the default value is True).
The next level is at src/common/connection_handlers.py and src/common/connection_handlers_events.py where this information is used to create a list of explicitly sent messages and to ignore error events (MessageErrorEvent) when the id ov the error stanza does not appear in the list (plus: every error is only displayed once, this is no problem as we are using uuids in gajim which should be unique enough for this)
The last level is at src/common/connection.py where some of this events are raised. In _nec_message_outgoing() the MessageSentEvent event was raised before the actual message was sent but in _nec_gc_message_outgoing() the event was raised after the message was sent. I corrected this inconsistency by moving parts of the callback cb() in _nec_message_outgoing() into _nec_stanza_message_outgoing(). For this I had to pass _cb_parameters containing the parameters of cb() in _nec_message_outgoing() to the StanzaMessageOutgoingEvent. I also added the new member "automatic_message" to this event. The MessageSentEvent now has the new members automatic_message and msg_id to do its job.
@asterix: please review this and commit it if you like. And feel free to ask me questions if you have some :)
The diff against the current default branch of gajim containing the described changes
second version of my patch which limits the number of recorded message ids
I still get this
error while sending message ( service-unavailable )
Messages from every Contact in my Group roster when I start gajim or login in my account.
Lastest Version 0.16.5-65d9193e5b68
It's fixed in default branch, not in 0.16 branch yet.