{"record":{"id":"1322072aceb74bd8","repo":"pentaho/pentaho-kettle","slug":"salesforceinput-error-closingconnection","errorCode":null,"errorMessage":"SalesforceInput.Error.ClosingConnection","messagePattern":"SalesforceInput\\.Error\\.ClosingConnection","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"warning","filePath":"plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforce/SalesforceConnection.java","lineNumber":516,"sourceCode":"      }\n      if ( this.binding != null ) {\n        this.binding = null;\n      }\n      if ( this.loginResult != null ) {\n        this.loginResult = null;\n      }\n      if ( this.userInfo != null ) {\n        this.userInfo = null;\n      }\n      if ( this.getDeletedList != null ) {\n        getDeletedList.clear();\n        getDeletedList = null;\n      }\n      if ( log.isDetailed() ) {\n        log.logDetailed( BaseMessages.getString( PKG, \"SalesforceInput.Log.ConnectionClosed\" ) );\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"SalesforceInput.Error.ClosingConnection\" ), e );\n    }\n  }\n\n  public int getQueryResultSize() {\n    return this.queryResultSize;\n  }\n\n  public int getRecordsCount() {\n    return this.recordsCount;\n  }\n\n  public SalesforceRecordValue getRecord( int recordIndex ) {\n    int index = recordIndex;\n\n    SObject con = this.sObjects[index];\n    SalesforceRecordValue retval = new SalesforceRecordValue( index );\n    if ( con == null ) {\n      return null;","sourceCodeStart":498,"sourceCodeEnd":534,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforce/SalesforceConnection.java#L498-L534","documentation":"KettleException thrown by SalesforceConnection.close() when releasing the Salesforce binding/connection throws. close() nulls the query result and logs 'ConnectionClosed'; any exception during cleanup is rewrapped with 'SalesforceInput.Error.ClosingConnection'. It indicates cleanup of the SOAP session failed, not that the data operation failed.","triggerScenarios":"Calling close() while the underlying ConnectorClient/QueryResult access throws — e.g. getQueryResult() on a binding whose session is already invalid, or network error during session teardown.","commonSituations":"Double-closing a connection in step disposal logic, session already terminated server-side (admin killed session, token revoked), transient network drop during close.","solutions":["Inspect the cause — most close failures are stale-session issues; re-authenticate before further API use","Ensure close() is called exactly once per connection (guard with a boolean/finally)","Treat close-time errors as non-fatal when data was already processed — log and continue","Check Salesforce session timeout settings vs. transformation runtime","Verify network stability to the Salesforce endpoint"],"exampleFix":"// before\nconnection.close(); // throws if session already dead\n// after\ntry { connection.close(); } catch (KettleException e) { log.logMinimal(\"Ignore close failure: \" + e.getCause()); }","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"boolean isClosable(Connection c) { return c != null; }","tryCatchPattern":"try { connection.close(); } catch (KettleException e) { log.logDetailed(\"Close failed (likely stale session), ignoring: \" + e.getCause()); }","preventionTips":["Close each connection exactly once, in a finally block with a null/idempotent guard","Do not fail the transformation on close errors — data was already processed","Increase Salesforce session timeout if transformations run long","Monitor for repeated close failures — they usually indicate sessions being killed server-side"],"tags":["salesforce","cleanup","session","kettle"],"backgroundTag":"api-request-failed","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}