+ Start a Discussion

getting Read timeouts when querying for tables and when calling .queryMore(...)

I have a java app I have developed being used to generate export files for an integration I am working on however, I when querying the sfdc instance in question I am receiving an read timeout error.


I have even tried Limiting the query to return 1 record and still at times I get this error.  this also occurs when I am calling the .queryMore() method.


This error occurs infrequently and I am unsure why.


I have tried to catch this error and increase the bindings timeout using binding.setTimeout(currentPoll+100).. and I allow this for 5 iterations of the read timeout error but  nonetheless since I am making so many query calls within my application it is almost a guarantee at this point that several will fail.


I have set the initial timeout to the correct binding (I believe this is true because I was told to set the timeout after logging in which I am doing) .


Also, I am not sure how to catch the error as well.  I am currently catching an Exception e because using java.net.socketTimeoutException does not seem to work for me.


Any help on this issue would be greatly appreciated as I have no idea what to do at this point.


I am willing to post any code in order to help!



Best Answer chosen by Admin (Salesforce Developers) 
What your timeout set to ?

All Answers

What is the object name, how many records are there in Salesforce, and what is the SOQL you're using?



Could this problem be because I am not ever explicitly calling the binding.logout() call from my app and so there are still connections persisting across my runs of the app?


First off, thank you for the response.


There are about 11000+ records in most of the objects i am querying so I do understand that is quite a few but not an unrealistic number either.


Also, none of the objects are standard objects they are all custom objects minus the Account object.


The SOQL I am using is typical [select field1,field2__r.fieldA,field3 from object_1__c] 


Lastly, I have limited each query for now to 1000 records and still receive the error at times.


Here is an example of a query: 


qr = binding.query("select ID, FirstName, Middle_vod__c, LastName, ME__c, PIMS__c, Specialty_1_vod__c, Credentials_vod__c, SID__c, Does_not_Accept_Schedule_4__c from Account " +

"where isPersonAccount = True and LastModifiedDate >="+dt.toString()+" and LastModifiedDate <"+edt.toString()+" Limit 1000"); 


where dt and edt are date strings inputted by the user at the onset of the app. 

What your timeout set to ?
This was selected as the best answer

Initially 1000 then it tries again each time adding 100 to the 1000 for a max of 5 iterations.  Sometimes this fixes the problem other times the max of 5 is reached.   

1 second, no wonder you keep hitting it, that's way too low.

I have no idea why I thought this was being done in Seconds.


Silly me.


Thank's for the direction and help guys.