MAM query error result: "rsmSet must not be null"

I am seeing a similar issue (using Smack 4.2.0 and Open Fire 4.1.6 with Monitoring Service plugin). Currently reading up on XEP-0313 to determine which is true:

a) My code is in error, or
b) Smack library is in error (by requiring “set” on the “fin”) when set should be optional, or
c) Openfire/Monitoring plugin is in error (by not sending a required “set” on the “fin”)

Do you know is true?

Here is the code snippet I am using to query to the server

MamManager.MamQueryResult queryResult = archive.queryArchiveWithStartDate(new Date(syncPoint));

After configuring the Openfire/Monitoring plugin, I do seem to get messages back if appropriate, but the Smack library errors out on the “fin” stanza, regardless of how many messages proceed the fin. Whether no messages match, or 3, as in the case below

And here is the traffic log.

03-22 15:47:55.612 5904-6132/com.usermap.app I/System.out: 15:47:55 SENT (0): <iq from='byoung@localtest.net/ANDROID-355301074232615' id='70Uhv-219' type='set'><query xmlns='urn:xmpp:mam:1' queryid='0a3037dd-ecea-4800-ba12-6e1ae032b8f9'><x xmlns='jabber:x:data' type='submit'><field var='FORM_TYPE' type='hidden'><value>urn:xmpp:mam:1</value></field><field var='start'><value>2018-03-21T19:47:55.622+00:00</value></field></x></query></iq>

03-22 15:47:55.732 5904-6133/com.usermap.app I/System.out: 15:47:55 RECV (0): <message to="byoung@localtest.net/ANDROID-355301074232615"><result xmlns="urn:xmpp:mam:1" queryid="0a3037dd-ecea-4800-ba12-6e1ae032b8f9" id="1"><forwarded xmlns="urn:xmpp:forward:0"><delay xmlns="urn:xmpp:delay" stamp="2018-03-22T19:45:25.652Z"/><message xmlns="jabber:client" to="user1@localtest.net" from="byoung@localtest.net/ANDROID-355301074232615" id="t9832-222" type="chat"><body>hit</body><thread>10d5fdf7-3aa0-4d6f-a291-c5e2fb84c8b0</thread><active xmlns="http://jabber.org/protocol/chatstates"></active><request xmlns="urn:xmpp:receipts"></request><tak xmlns="urn:xmpp:tak"><uid>ANDROID-355301074232615</uid></tak></message></forwarded></result></message>


03-22 15:47:55.872 5904-6133/com.usermap.app I/System.out: 15:47:55 RECV (0): <message to="byoung@localtest.net/ANDROID-355301074232615"><result xmlns="urn:xmpp:mam:1" queryid="0a3037dd-ecea-4800-ba12-6e1ae032b8f9" id="2"><forwarded xmlns="urn:xmpp:forward:0"><delay xmlns="urn:xmpp:delay" stamp="2018-03-22T19:45:47.976Z"/><message xmlns="jabber:client" to="byoung@localtest.net/ANDROID-355301074232615" from="test1@conference.localtest.net/byoung" id="t9832-292" type="groupchat"><body>well</body><tak xmlns="urn:xmpp:tak"><uid>ANDROID-355301074232615</uid></tak></message></forwarded></result></message>


03-22 15:47:55.872 5904-6133/com.usermap.app I/System.out: 15:47:55 RECV (0): <r xmlns='urn:xmpp:sm:3' />
03-22 15:47:55.882 5904-6132/com.usermap.app I/System.out: 15:47:55 SENT (0): <a xmlns='urn:xmpp:sm:3' h='20'/>
03-22 15:47:55.882 5904-6133/com.usermap.app I/System.out: 15:47:55 RECV (0): <message to="byoung@localtest.net/ANDROID-355301074232615"><result xmlns="urn:xmpp:mam:1" queryid="0a3037dd-ecea-4800-ba12-6e1ae032b8f9" id="3"><forwarded xmlns="urn:xmpp:forward:0"><delay xmlns="urn:xmpp:delay" stamp="2018-03-22T19:45:49.914Z"/><message xmlns="jabber:client" to="byoung@localtest.net/ANDROID-355301074232615" from="test1@conference.localtest.net/byoung" id="t9832-296" type="groupchat"><body>see</body><tak xmlns="urn:xmpp:tak"><uid>ANDROID-355301074232615</uid></tak></message></forwarded></result></message>


03-22 15:47:55.882 5904-6133/com.usermap.app I/System.out: 15:47:55 RECV (0): <iq type="result" id="70Uhv-219" to="byoung@localtest.net/ANDROID-355301074232615"><fin xmlns="urn:xmpp:mam:1" queryid="0a3037dd-ecea-4800-ba12-6e1ae032b8f9"/></iq>
03-22 15:47:55.892 5904-6133/com.usermap.app E/xceptionLoggingCallback: Smack message parsing exception. Content: '</fin></iq>'
                                                                        java.lang.IllegalArgumentException: rsmSet must not be null
                                                                            at org.jivesoftware.smackx.mam.element.MamFinIQ.<init>(MamFinIQ.java:73)
                                                                            at org.jivesoftware.smackx.mam.provider.MamFinIQProvider.parse(MamFinIQProvider.java:59)
                                                                            at org.jivesoftware.smackx.mam.provider.MamFinIQProvider.parse(MamFinIQProvider.java:34)
                                                                            at org.jivesoftware.smack.provider.Provider.parse(Provider.java:31)
                                                                            at org.jivesoftware.smack.util.PacketParserUtils.parseIQ(PacketParserUtils.java:632)
                                                                            at org.jivesoftware.smack.util.PacketParserUtils.parseStanza(PacketParserUtils.java:152)
                                                                            at org.jivesoftware.smack.AbstractXMPPConnection.parseAndProcessStanza(AbstractXMPPConnection.java:1025)
                                                                            at org.jivesoftware.smack.tcp.XMPPTCPConnection.access$500(XMPPTCPConnection.java:149)
                                                                            at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1026)
                                                                            at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPConnection.java:980)
                                                                            at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:996)
                                                                            at java.lang.Thread.run(Thread.java:818)


1 Like

I get similar behavior with the snippet below, where I attempt to query a group chat

MamManager.MamQueryResult queryResult = archive.queryArchive(null, new Date(syncPoint), null, conference, null);

The MAM archive appears to violate XEP-0313 § 4:

The final result response MUST include an RSM element, wrapped into a element qualified by the ‘urn:xmpp:mam:2’ namespace

Hence I moved this into the Openfire category.

Puzzling. We do attempt to set the RSM element. For the record, what version of the Monitoring plugin is being used?

Monitoring Service 1.6.0

Installed via the Openfire Admin UI, Available Plugins

Another note, we updated the Openfire to 4.2.3, and the same issue is still occurring.

Also a note on the Smack/client side, since the fin/iq fails to parse and is not processed, the query/MAM operation always times out and throws an exception

I’m running into this issue as well. Using Smack 4.2.2 and Openfire 4.2.2 as well as Monitoring service 1.6.0.

edit: added stacktrace:

org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 5000ms (~5s). Waited for response using: IQReplyFilter: iqAndIdFilter (AndFilter: (OrFilter: (IQTypeFilter: type=error, IQTypeFilter: type=result), StanzaIdFilter: id=T0L13-173)), : fromFilter (OrFilter: (FromMatchesFilter (full): null, FromMatchesFilter (ignoreResourcepart): <user>@<server>, FromMatchesFilter (full): <server>)).
        at org.jivesoftware.smack.SmackException$NoResponseException.newWith(SmackException.java:111)
        at org.jivesoftware.smack.SmackException$NoResponseException.newWith(SmackException.java:98)
        at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:253)
        at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:208)
        at org.jivesoftware.smackx.mam.MamManager.queryArchive(MamManager.java:534)
        at org.jivesoftware.smackx.mam.MamManager.queryArchive(MamManager.java:279)
        at org.jivesoftware.smackx.mam.MamManager.queryArchiveWithStartDate(MamManager.java:197)
        at com.acme.chat.ChatConnection.processHistory(ChatConnection.java:261)
        at com.acme.chat.ChatConnection.authenticated(ChatConnection.java:324)
        at org.jivesoftware.smack.AbstractXMPPConnection.callConnectionAuthenticatedListener(AbstractXMPPConnection.java:1263)
        at org.jivesoftware.smack.AbstractXMPPConnection.afterSuccessfulLogin(AbstractXMPPConnection.java:575)
        at org.jivesoftware.smack.tcp.XMPPTCPConnection.afterSuccessfulLogin(XMPPTCPConnection.java:379)
        at org.jivesoftware.smack.tcp.XMPPTCPConnection.loginInternal(XMPPTCPConnection.java:444)
        at org.jivesoftware.smack.AbstractXMPPConnection.login(AbstractXMPPConnection.java:494)
        at org.jivesoftware.smack.AbstractXMPPConnection.login(AbstractXMPPConnection.java:451)
        at org.jivesoftware.smack.ReconnectionManager$2.run(ReconnectionManager.java:294)
        at java.lang.Thread.run(Thread.java:748)
Jun 25, 2018 2:25:03 PM org.jivesoftware.smack.AbstractXMPPConnection callConnectionClosedOnErrorListener
WARNING: Connection XMPPTCPConnection[<user>@<server>/<hash?>] (0) closed with error
java.lang.IllegalArgumentException: rsmSet must not be null
        at org.jivesoftware.smackx.mam.element.MamFinIQ.<init>(MamFinIQ.java:74)
        at org.jivesoftware.smackx.mam.provider.MamFinIQProvider.parse(MamFinIQProvider.java:61)
        at org.jivesoftware.smackx.mam.provider.MamFinIQProvider.parse(MamFinIQProvider.java:36)
        at org.jivesoftware.smack.provider.Provider.parse(Provider.java:32)
        at org.jivesoftware.smack.util.PacketParserUtils.parseIQ(PacketParserUtils.java:633)
        at org.jivesoftware.smack.util.PacketParserUtils.parseStanza(PacketParserUtils.java:153)
        at org.jivesoftware.smack.AbstractXMPPConnection.parseAndProcessStanza(AbstractXMPPConnection.java:1049)
        at org.jivesoftware.smack.tcp.XMPPTCPConnection.access$500(XMPPTCPConnection.java:151)
        at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1040)
        at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPConnection.java:994)
        at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:1010)
        at java.lang.Thread.run(Thread.java:748)

Based on our initial testing (with Smack 4.3.0), Openfire 4.5.1 and Monitoring Server 2.0, this issue is resolved. Awesome!

2 Likes