Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-20388

Salesforce component does not handshake on the connection failure

    XMLWordPrintableJSON

Details

    • Unknown

    Description

      We use the Salesforce component to consume platform events and every 3 hours we observe the following warning message:

      Connect failure: {advice={reconnect=handshake, interval=0}, channel=/meta/connect, id=2005814, error=403::Unknown client, successful=false}
      

      According to this article, it is caused by the expiring sfdc-stream cookie used by CometD. When it happens, the client is expected to perform a new handshake and re-subscribe to the channels. This is handled in connectListener (SubscriptionHelper#initMessageListeners). Unfortunately, because the client is in the CONNECTED state when this message is received, the condition

              while (!abort && !client.isDisconnected()) {
                  try {
                      Thread.sleep(DISCONNECT_INTERVAL);
                  } catch (InterruptedException e) {
                      LOG.error("Aborting handshake on interrupt!");
                      abort = true;
                  }
      
                  abort = abort || isStoppingOrStopped();
              }
      

      (SubscriptionHelper#doHandshake) is not met and it stays in the handshaking state indefinitely (SubscriptionHelper#handshaking), hence the handshake is not being performed. As a consequence, after a couple of days the client stops receiving Salesforce events.

      This bug may have been introduced by this commit, which removed

      client.disconnect();
      

      from connectListener (SubscriptionHelper:178).

      Attachments

        Issue Links

          Activity

            People

              zhfeng Zheng Feng
              bartoszpop Bartosz Popiela
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: