1

I am not a Salesforce developer so please forgive me for any misunderstanding about how the system works.

I have an Java app (Spring Boot) that uses the Salesforce Rest API in order to read/write data to various objects, mainly using this endpoint to query data:

/services/data/v34.0/query?q=

Queries that are made typically take no more than a couple of seconds to run, and making one off requests through Postman or curl always seem to work, and complete in no more than 5 seconds.

Recently however, about 5% of these API calls made from the Java app to Salesforce are timing out, showing this error:

org.springframework.web.client.ResourceAccessException: I/O error on GET request for "https://X.my.salesforce.com/services/data/v34.0/query": Read timed out; nested exception is java.net.SocketTimeoutException: Read timed out

No other outbound requests from this app are having this issue so it must be to do with Salesforce.

I am not well versed with Salesforce at all but have had to take some responsibility for it in my new role, so was wondering if:

  1. Is this a common issue with an easy solution?
  2. Is there any way to retrieve any useful metrics such as what percentage of our allocated CPU usage is being used at any one point?

The environment was created for us by a third party prior to me joining the company and is very sub-optimal, but a solution is proving elusive.

Some extra things to note:

  • Some Apex classes have Future calls in them which can take up to 30 mins to execute atm, is this normal?
  • I created a bash script to try and reproduce this issue, which just pings off a few hundred API calls asynchronously to see how many are successful. When I use the domain name of the environment, roughly 5-10% of the calls fail with the error curl: (6) Could not resolve host: X.my.salesforce.com, but if I ping Salesforce to get the IP and use that instead, they are all always successful.

Appreciate any help, please let me know if you require any more information.

6
  • 1
    is it sandbox? also its looks more like your client is timing out rather than sf query timeout Jan 12, 2022 at 15:13
  • Happens in both Sandbox and production. Did initially think it was the client but plenty of requests are being made to other systems and are all fine.
    – Jake Baum
    Jan 12, 2022 at 15:22
  • 1
    some heavy querries can take more than 10 seconds or even 20. Or if some record is in lock Jan 12, 2022 at 15:27
  • curl: (6) Could not resolve host: X.my.salesforce.com is 100% a client-side issue if X is an active domain in Salesforce
    – identigral
    Jan 12, 2022 at 16:26
  • Thanks for the comments. Irrespective of the what the bash script does (It was a bit of a shot in the dark), do you think it would be possible that the queries to Salesforce are taking too long due to other processes hogging resources (Many workflows/process builders running)? Or is that unlikely to be the cause? If so is there any way to find out which ones/why? If not I will start focussing my attention on the application server instead of Salesforce
    – Jake Baum
    Jan 12, 2022 at 17:26

1 Answer 1

3

@Jake Baum, the issue here is almost certainly not related to your actual request timing out due to a large query, the issue is that Salesforce very aggressively rotates DNS mappings. I have the exact same problem, and as of yet, have not been able to resolve it. It seems that a resolved domain name might actually return a different IP mapping moments later. The issue is with Salesforce, and as far as I can tell, due to the some questionable practices with how they expose their domain names and IPs for external usage.

The fact that you (as I have also done) can reproduce the issue both from Java, and from a bash script, and have also run those tests from different physical infrastructure (my local pc, AWS, GCP, Heroku) means it is 100% NOT a client side problem. Just the joys /s of using Salesforce, I'm afraid.

I've also tried changing Java DNS caching settings, but to no effect. I've been dragging my heals open a support ticket as I don't care to have to explain basic networking concepts to a Salesforce support resource, but ultimately, I think this is the only option left.

For my application, for the time being, I had no choice but to essentially handle this problem by implementing service call re-tries. A major pain in the ass and a big performance hit.

1
  • did you ever find out anything further? did you submit a tech support case with Salesforce? We are in a similar situation and I don't see any hope of getting valid support from Salesforce tech support.
    – Paul N
    Feb 23 at 13:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .