+ Start a Discussion
djordandjordan 

"Connection reset by peer" errors

Over the past week, I've been getting intermittent "Connection reset by peer" errors while querying contacts.

2004-04-13 15:42:46,002 INFO  CaIntegration.CaIntegration doIntegration (CaIntegration.java:777) - Found a total of 12017 records in contact
2004-04-13 15:42:55,241 INFO  CaIntegration.CaIntegration manageInsertOrUpdate (CaIntegration.java:621) - About to query sforce for more info about records#0 to 199(200)
2004-04-13 15:43:32,639 INFO  CaIntegration.CaIntegration manageInsertOrUpdate (CaIntegration.java:633) - Adding data to the DB
...

2004-04-13 15:44:13,486 INFO  CaIntegration.CaIntegration manageInsertOrUpdate (CaIntegration.java:621) - About to query sforce for more info about records#600 to 799(200)
2004-04-13 15:44:13,862 ERROR CaIntegration.CaIntegration doIntegration (CaIntegration.java:820) - Failed to transfer data for entity contact because of error:
com.salesforce.common.exceptions.IntegrationException: Failed to query sforce records: com.salesforce.common.exceptions.SforceException: Cannot retrieve data from contact because java.net.SocketException: Connection reset by peer: Connection reset by peer
Attempting to recover...
2004-04-13 15:44:13,968 INFO  CaIntegration.CaIntegration cleanup (CaIntegration.java:137) - Connection to sforce closed

 

The line which throws this exception is:

                sobjects = binding.retrieve(fieldList, entityName, idList);

Similiar queries to account doesn't result in any issues. I'm using Java 1.3 (for deployment compliance reasons) with SOAP API 2.5.

 

Has anyone else seen this?

 

Paul SwaddlePaul Swaddle
Hi Team,
Greeting of the day!!!
 
We are facing technical issue from this 14th May 2018, suddenly we start getting “TCP connection reset by peer” response from “Salesforce” after sending lead information using web services.
 
Technical Stack used at our end:
OS: Redhat Linux (RHEL)
Web Server: APACHE
Web Scripting Language: PHP
Used CURL for sending the details.
 
 
Code snippet for sending lead generation requested to Salesforce is ….
 
/*****************************************************************************************************/
     /* Purpose           : Sending request to sales-force for lead generation
     /* Inputs       : $pStrPostArr :: Post data array.
     /* Returns      : None.
     /* Created By   : Jaiswar Vipin Kumar R.
     /*****************************************************************************************************/
     function send($pStrPostArr = array()){
           /* if post data is empty then do needful */
           if (empty($pStrPostArr)){
                /* return status */
                return false;
           }
          
           /* set POST variables */
        $strDestiantionURL = 'https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8';
           /* removed used index */
           unset($pStrPostArr['desitnationURL']);
          
           /* if destination URL is not set then do needful */
           if (empty($strDestiantionURL)){
                /* return status */
                return false;
           }
          
           /* variable initialization */
           $strFields = '';
          
   
        /* url-ify the data for the POST */
        foreach($pStrPostArr as $strKey=>$strValue) {
                if($strFields == ''){
                     $strFields .= $strKey.'='.$strValue;
                }else{
                     $strFields .= '&'.$strKey.'='.$strValue;
                }
           }
       // rtrim($strFields,'&');
        if(isset($_COOKIE['debug'])){
                //print_r($pStrPostArr);
                echo $strFields;exit;
           }
        /* open connection */
        $ch = curl_init($strDestiantionURL);
       
        /* set the url, number of POST vars, POST data */
        curl_setopt($ch,CURLOPT_URL,$strDestiantionURL);
        curl_setopt($ch,CURLOPT_POST,count($pStrPostArr));
       curl_setopt($ch,CURLOPT_POSTFIELDS,$strFields);
       
        curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, FALSE);
        curl_setopt($ch,CURLOPT_RETURNTRANSFER, TRUE);
        curl_setopt($ch,CURLOPT_FOLLOWLOCATION, TRUE);
           curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
          
       
        /* execute post */
        $this->_strReponse           = curl_exec($ch);
           /* Request Body */
           $this->_strRequestBody     = curl_getinfo($ch);
          
           if($this->_strReponse === FALSE){
                $this->_strError     = curl_error($ch);
           }
       
        /* close connection */
        curl_close($ch);
    }
 
 
 
And Send Lead Information DataSet  is :
 
Array
(
    [desitnationURL] => https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8
    [first_name] => Jaiswar
    [last_name] => Vipin+Kumar+R
    [company] => PocketApp
    [job_title__c] =>
    [country_c__c] =>
    [appdetail] => app development & designing
    [email] => vipin.jaiswar%40pocketapp.co.uk
    [phone] => %2B919773596947
    [Lead_Budget__c] => Undisclosed
    [description] => Fill+out+the+form+below+with+your+requirments+and+we+will+get+back+to+you+as+soon+as+possible.+Alternatively%2C+send+an+email+to+sales%40pocketapp.co.uk+or+give+us+a+call+on+%2B44+20+7183+4388
    [oid] => XXXXXXXXXXXXXXX
    [sfga] => XXXXXXXXXXXXXXX
    [retURL] => https://www.pocketapp.co.uk/thank-you/
    [lead_source] => Web
    [source__c] => https://www.semrush.com/siteaudit/campaign/472189/review/
    [medium__c] => referral
    [campaign__c] => (referral)
    [term__c] => -
    [content__c] =>
    [Visitor_ID__c] => 312724244
    [gclid__c] => -
    [Count_of_Sessions__c] => 1
    [Count_of_Pageviews__c] => 12
    [00ND0000006RIpG] =>
    [00ND0000006RHJY] =>
    [00ND0000006RHJd] =>
    [00ND0000006RHJi] =>
    [00ND0000006RHJs] =>
    [00ND0000006RHJn] =>
    [00ND00000064Guy] =>
    [00ND00000064Gv3] =>
)
 
Can you please assist us, what changes we need to make our end to make this start working as it was?
 
Vipin Kumar R JaiswarVipin Kumar R Jaiswar
Salesforce has changed the API endpoints for capturing the LEAD (web-to-lead) and CASE (web-to-case). After updating the API endpoint, solution start working again :)

Updated endpoints are:
  • “https://webto.salesforce.com/servlet/servlet.WebToLead”
  • “https://webto.salesforce.com/servlet/servlet.WebToCase”

Reference  URL: https://help.salesforce.com/articleView?id=000240426&type=1


Thanks & Regards
Jaiswar Vipin Kumar R.