Huy Nguyen created CAMEL-12986:
----------------------------------

             Summary: Salesforce streaming api breaks after access token 
expires and a timeout happens when re logging in.
                 Key: CAMEL-12986
                 URL: https://issues.apache.org/jira/browse/CAMEL-12986
             Project: Camel
          Issue Type: Bug
          Components: camel-salesforce
    Affects Versions: 2.23.0
            Reporter: Huy Nguyen
             Fix For: 2.23.0


*When using salesforce version 37 or earlier my push topics and streaming api 
runs forever with little to no issues. I tested expiring access tokens and 
hitting timeouts to mimic network failures. I debug the code and saw that there 
where retries for network failures. The type login I'm using is refresh token.*

 

*I switch over to version 44 using code from camel 2.21.0 and saw a lot of 403 
and timeouts and null pointers caused by timeouts that would kill the push 
topic subscription. Usually when the process dies I see null pointers than this 
message and no more push topic action happens.* 

org.apache.camel.component.salesforce.api.SalesforceException: Login request 
timeout: null
 at 
org.apache.camel.component.salesforce.internal.SalesforceSession.login(SalesforceSession.java:135)
 at 
org.apache.camel.component.salesforce.internal.streaming.SubscriptionHelper.createClient(SubscriptionHelper.java:345)
 at 
org.apache.camel.component.salesforce.internal.streaming.SubscriptionHelper.doStart(SubscriptionHelper.java:108)
 at 
org.apache.camel.component.salesforce.internal.streaming.SubscriptionHelper$4.run(SubscriptionHelper.java:277)
 at 
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
 at 
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
 at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.concurrent.TimeoutException: null
 at 
org.eclipse.jetty.client.util.FutureResponseListener.get(FutureResponseListener.java:109)
 at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:655)
 at 
org.apache.camel.component.salesforce.internal.SalesforceSession.login(SalesforceSession.java:129)
 ... 6 common frames omitted
15:51:51.531 [HttpClient@507583873-24] WARN 
org.eclipse.jetty.util.thread.QueuedThreadPool - 
java.lang.NullPointerException: null
 at 
org.apache.camel.component.salesforce.internal.streaming.SubscriptionHelper$4.run(SubscriptionHelper.java:284)
 at 
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
 at 
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
 at java.lang.Thread.run(Thread.java:748)
15:51:53.256 [HttpClient@507583873-24] WARN 
org.eclipse.jetty.util.thread.QueuedThreadPool - Unexpected thread death: 
org.eclipse.jetty.util.thread.QueuedThreadPool$3@4d71480c in 
HttpClient@507583873\{STARTED,8<=8<=200,i=3,q=0}

 

*When I switch to 2.23.0 I think the issue doesn't happen as often but I still 
need to do testing for long periods of time to be sure.* 

 

*To recreate the issue put a breakpoint at SalesforceSession on this line* 

 ** final ContentResponse loginResponse = loginPost.send();

*Start up the app and let the first login happen to establish an auth session. 
Then go to the AuthSession table and delete the row that correspond to the 
connection for your application, the SessionType should be Oauth2.*

*Then you have to wait for a while for the system to realize that the session 
has to expire and we need to get a new access token. If you create a timeout 
exception I think you can cause this to happen faster but I usually wait up to 
5 minutes for the loginPost.send() breakpoint to hit. To cause a timeout go to 
FutureResponseListener.java and debug and set the expired value true.*

        **        if (expired)

            throw new TimeoutException();

 *So for the version 2.21.0 when I step over everything during 
loginPost.send(); there an exception thrown the client object becomes null and 
we get a null pointer and the subscription stops.*

 

*For version 2.23.0 the timeout doesn't happen every time so again you have to 
throw a timeout by going through* *FutureResponseListener and creating a 
timeout. This is a problem because my jobs always stops taking push action 
after a couple of days. 37 version code would retry on network issues but the 
new code will throw a null pointer exception on client when theres a timeout on 
the login process and cause the subscription to die.* **

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to