"UnknownHostException / Host could not be resolved" for sandbox orgs - seems to be a Salesforce DNS issue; see pinned response

Issue #2589 resolved
Carlos Valverde created an issue

Hi team, I’m getting the following error when I updated the plugin with the latest version as of right now (2.3.1.9).

The error I get is the following:

I get this error when updating the cached metadata, but if I open a connection I get properly redirected to my Salesforce org’s page. Please tell me if more info on this is needed.

Official response

Comments (26)

  1. Scott Wells repo owner
    • changed status to open

    Hi. Can you please provide your idea.log (Help | Show Log in Explorer/Finder/Files) from immediately after this occurs so I can see the full stack trace and therefore the call that's failing in this manner?

    FWIW, nothing has changed in the way that IC2 calls the Salesforce API in a very long time, so my guess is that it's either a temporary/transient Salesforce DNS issue (I saw a few just last week) or something with your machine's/network's DNS configuration. Are you able to resolve that hostname from the command-line using nslookup and/or dig?

    https://www.a2hosting.com/kb/getting-started-guide/internet-and-networking/troubleshooting-dns-with-dig-and-nslookup/

  2. Scott Wells repo owner

    First off, I’m not sure why all of the text is suddenly gray. That seems to be a Bitbucket issue tracker problem that is new since yesterday. Weird… I’ll log a support case with them, but my guess is that they’re likely already on it since it’s such an obvious and prominent issue.

    The errors that I’m seeing in the provided log are not the same as those from the original poster here. He’s seeing failures due to UnknownHostException which is attributable to a failed DNS resolution. The ones in this log are from a BindException which indicates that a server couldn’t listen successfully on a TCP port, in this case specifically because something else is already listening on that same port:

    BindException invoking https://renovo--devsm.sandbox.my.salesforce.com/services/Soap/T/61.0/00DcW0000008ZocUAE: Address already in use: getsockopt
    

    That’s in a stack trace for a SOAP request, though, so my guess is that the error is actually coming from the Salesforce server:

    Caused by: java.net.BindException: Address already in use: getsockopt
        at java.base/sun.nio.ch.Net.pollConnect(Native Method)
        at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672)
        at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:547)
        at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:602)
        at java.base/java.net.Socket.connect(Socket.java:633)
        at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:178)
        at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:533)
        at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:638)
    

    We could confirm that 100% if you want to enable debug logging for all SOAP calls by adding the following to Help | Diagnostic Tools | Debug Log Settings:

    com.illuminatedcloud.intellij.client.ForceComApiClient
    com.illuminatedcloud.intellij.client.ForceComApiClient!trace
    

    After doing so, restart the IDE completely as the latter entry above sets the logging level for Apache CXF and that one can’t be changed dynamically.

    After restarting the IDE, reproduce the error and, in your idea.log, you’re going to see very detailed request and response logging for all SOAP and REST requests and responses with the Salesforce APIs. I recommend not attaching that log file as-is, but rather extracting the key portion that we care about here, specifically whatever request/response pair results in the BindException. Feel free to redact any sensitive information from even that log extract. I mainly care about the HTTP request and response header/status information and not as much the payloads.

    Once we have that diagnostic information, you can remove the debug logging for ForceComApiClient and restart the IDE again to ensure that no more sensitive information is being emitted to the log.

  3. Carlos Valverde reporter
      <div class="preview-container wiki-content"><!-- loaded via ajax --></div>
      <div class="mask"></div>
    </div>
    

    </div> </form>

  4. Carlos Valverde reporter

    Hi Scott, thank you for the quick reply, I’ve added the idea.log, the steps that I did was.

    1. Open IntelliJ IDEA 2024.1.4 (Build #IU-241.18034.62).
    2. Regenerate Offline Symbol Table (Full).

    Then the error pop-up was shown.

  5. Scott Wells repo owner

    Thank you. The UnknownHostException is coming from a standard Salesforce API, MetadataApi.listMetadata(), and is for host irvinecompany--cval202405.sandbox.my.salesforce.com. I’m able to resolve that hostname locally:

    $ nslookup irvinecompany--cval202405.sandbox.my.salesforce.com
    Server:  UnKnown
    Address:  2600:1700:1b1:1f:723a:cbff:fec3:68d2
    
    Non-authoritative answer:
    Name:    st1.edge.sfdc-lywfpd.edge2.salesforce.com
    Addresses:  34.211.108.47
              34.211.108.46
              34.211.108.45
    Aliases:  irvinecompany--cval202405.sandbox.my.salesforce.com
              h.edge2.salesforce.com
              st.edge.oregon.edge2.salesforce.com
    

    What do you get when you try to do the same? Note that if you don’t have nslookup, you may have dig, but the lookup needs to be from the exact same machine where this error is occurring.

    Also, is that the same hostname that’s displayed in Salesforce under Setup | Company Settings | My Domain? If not, you might try to authorize the org using the hostname shown there, switch the project to that connection, and try to generate the OST (and any other failing operations) again.

    Please let me know the outcome from either/both of those.

  6. Scott Wells repo owner

    I have received confirmation from some others that “Host could not be resolved” issues have been occurring with sandbox orgs the last several days 100% independent of IC2. I’d definitely recommend flushing the machine’s DNS cache and see if that helps:

    https://www.a2hosting.com/kb/getting-started-guide/internet-and-networking/clearing-the-dns-cache-on-your-computer/

    It sounds like at least some of those who are experiencing this also cannot resolve these sandbox hostnames directly from the command-line, so it does not appear to be an IC2 issue but rather a Salesforce DNS issue.

  7. Stanislaw Zan

    Following from issue #2592, I still have the issue. What I’ve done:

    • Erased connection and created new one with correct domain name instead of test
    • Flushed DNS running ipconfig /flushdns in Powershel
    • I’ve restarted WebStorm and run the tests, still got No such host is known error.

    I’m attaching idea.log (stzan-idea.log)

  8. Scott Wells repo owner

    Thanks for all of the diagnostic info. What happens if you run the following from the command-line?

    nslookup wlthdev-projectuk-wealth--wlthdev.sandbox.my.salesforce.com
    

    Does it show a proper resolution from the command-line, or is your machine unable to resolve it altogether?

  9. Stanislaw Zan

    I executed the nslookup you provided and got error message, can't find wlthdev-projectuk-wealth--wlthdev.sandbox.my.salesforce.com: Server failed. But when I paste the org URL into the web browser, it opens the page correctly.

    I’ll contact my company’s IT Support then.

  10. Scott Wells repo owner

    Okay, that’s…good?…to hear. At least it’s consistent. Based on what I’ve heard from others in the Salesforce ecosystem who’ve had this issue in the past week or so, it was an intermittent issue at best that ultimately resolved itself. I’m wondering if changes to these hostnames are just needing to propagate throughout the DNS caches. Thanks for letting me know, and I’ll be curious to hear what you find out from your company’s IT.

  11. Carlos Valverde reporter

    Hi Scott, here’s the information requested.

    1. For the nslookup I receive the following information:
     nslookup irvinecompany--cval202405.sandbox.my.salesforce.com
    Server:         192.168.10.1
    Address:        192.168.10.1#53
    
    Non-authoritative answer:
    irvinecompany--cval202405.sandbox.my.salesforce.com     canonical name = h.edge2.salesforce.com.
    h.edge2.salesforce.com  canonical name = st.edge.oregon.edge2.salesforce.com.
    st.edge.oregon.edge2.salesforce.com     canonical name = st1.edge.sfdc-lywfpd.edge2.salesforce.com.
    Name:   st1.edge.sfdc-lywfpd.edge2.salesforce.com
    Address: 34.211.108.45
    Name:   st1.edge.sfdc-lywfpd.edge2.salesforce.com
    Address: 34.211.108.47
    Name:   st1.edge.sfdc-lywfpd.edge2.salesforce.com
    Address: 34.211.108.46
    
    1. For the Domain Name under Settings I have the following:

    Now, when I copy the url and try to authorize I get the same UnknownHostException , here’s a screenshot of what I did for the setup.

    Please let me know if there’s something else I can add.

  12. Scott Wells repo owner

    Thank you, Carlos. Can you please flush your machine’s DNS cache, restart the machine (just to make sure any in-memory caches are also flushed), and try again? If it still fails, can you please try the following and see whether or not it works?

  13. Carlos Valverde reporter
      <div class="preview-container wiki-content"><!-- loaded via ajax --></div>
      <div class="mask"></div>
    </div>
    

    </div> </form>

  14. Scott Wells repo owner

    Thanks, Carlos. Since the host is resolvable from the command-line but not from the IDE – and you’ve flushed all of the respective DNS caches now – the only remaining thought that comes to mind is that the OS and IDE network configuration settings don’t match properly. Has there perhaps been a recent change to your network’s firewall/proxy configuration that has been updated properly on your machine’s OS but not yet in the JetBrains IDE? Take a look at this user guide section (which is also affected by the Bitbucket font color bug…sigh…):

    https://bitbucket.org/RoseSilverSoftware/illuminatedcloud/wiki/User_Guide/Configuring_the_IDE_to_Use_a_Proxy_Server

    You might need to ask your IT folks what might have changed recently…basically right before this issue started for you.

  15. Carlos Valverde reporter

    I followed the process from above:

    1. sudo killall -HUP mDNSResponder
    2. Restart the computer.
    3. Invalidate caches and Restart Intellij IDEA.

    Unfortunately, I received the same error. I’ve attatched a new idea.log file just in case it logs something that might help.

    Btw, I just saw the new comment, will take a deeper dive at it.

  16. Carlos Valverde reporter

    Ok, an interesting thing happened, I’m currently using Jetbrains AI and I noticed that there was an issue while trying to authenticate, when pulling the logs the same error was happening UnknownHostException, a few weeks ago I added a WiFi extender in my house, and the WiFi that I was using was the one from the extender, when I went to the ‘main’ WiFi everything worked.

  17. Scott Wells repo owner

    Whoa…that’s bizarre. Sounds like it’s definitely attributable to your home network. I wonder if the extender is using a different DNS config. Assuming you’re using DHCP across the board, what are the provided DNS settings for the main network and the extender? If they’re different, I’d look into how to configure the extender to be consistent.

  18. Carlos Valverde reporter

    Indeed, I’ll check the DNS settings for both the main network and the extender, thank you very much for the help!

  19. Scott Wells repo owner

    Sure, no problem. I'm just glad to see a path toward an understanding and therefore resolution. I was truly starting to run out of ideas!

    I'll resolve this, but if you circle back and find that it's still something with IC2 (or if someone else is having the same issue still), let's reopen it and get new diagnostic info.

  20. Log in to comment