shashank created CAMEL-25961:
--------------------------------

             Summary: camel-xmpp - after a lost connection a producer can send 
before the shared connection is logged in again, and the group chat producer 
does not enter its room again
                 Key: CAMEL-25961
                 URL: https://issues.apache.org/jira/browse/CAMEL-25961
             Project: Camel
          Issue Type: Bug
          Components: camel-xmpp
            Reporter: shashank
            Assignee: shashank


With CAMEL-25841 the consumers and producers of one account share one 
connection, and a producer that finds it not connected reconnects it under the 
account's lock ({{XmppComponent.reconnect}}), which now connects and logs it in 
again. Three gaps are left:

* The producers ({{XmppPrivateChatProducer}}, {{XmppGroupChatProducer}}, 
{{XmppDirectProducer}}, {{XmppPubSubProducer}}) only check 
{{connection.isConnected()}} before they send. A send that comes while another 
producer, the consumer's monitor or Smack's {{ReconnectionManager}} has 
connected the connection but not yet logged it in goes out before the login, 
and the server does not deliver it.
* {{XmppGroupChatProducer}} does not enter its room again after the connection 
was lost, so its messages to the room are not delivered (the consumer enters 
its room again since CAMEL-25842).
* The consumer's connection monitor ({{XmppConsumer.checkConnection}}) connects 
and logs in without the account's lock, while the producers use it; moving it 
onto {{XmppEndpoint.reconnect(connection)}} makes all users of an account 
reconnect under the same lock.

h3. Proposed fix

Producers: reconnect when the connection is not connected or not logged in 
(when it should be), through {{XmppEndpoint.reconnect}}. Group chat producer: 
enter the room again after a login, as the consumer does (a 
{{ConnectionListener.authenticated}} with {{resumed=false}}, or a check before 
each send). Consumer monitor: use {{XmppEndpoint.reconnect(connection)}}, 
keeping its room re-entry.

Tests: the {{FakeXmppServer}} of both PRs; parallel sends right after 
{{dropConnections()}} must all be delivered; a group chat producer sends to its 
room after a reconnect.

Also (Claus Ibsen on #28263): the parent's {{jxmpp-version}} (1.1.0) is never 
used for jxmpp-core and jxmpp-jid, because smack-core 4.4.8 asks for them in 
the range {{[1.0.0,1.0.999]}} (the build uses jxmpp 1.0.3; the direct 
{{jxmpp-jid:1.1.0}} is omitted for conflict, and since #28263 
{{jxmpp-util-cache}} is 1.1.0). Align the property with what Smack 4.4.x 
accepts (1.0.3), or move to a Smack version that accepts jxmpp 1.1.

Affected: main once CAMEL-25841 and CAMEL-25842 are merged (before them, the 
producers did not log in again at all).

_Filed with Claude Code on behalf of allthingssecurity._




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to