function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SnowjonSnowjon 

An existing connection was forcibly closed by the remote host

Hello,

 

I am working on a project that involves tranferring large ammount of data from a SQL Server database to custom objects in SalesForce. So far, it has been going very well. However, today , I came across this error whil making an UPSERT call through the API :

 

System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

 

The error is worrying enough in itself, but when I reran the script, although it ran correctly, it created everything TWICE in the database. Surely the UPSERT command should make sure that the objects are only created once, using the external ID from our system?

 

Many thanks!

 

 

AlwaysConfusedAlwaysConfused

 

This manifests in lots of peculiar ways.

 

Try reducing the batch size that you push to the server in one go, for some reason I've only been able to get a really solid upsert in batches of less than about 100 to 150 (depending on server load).

 

You are right however, normally the external id would only be allowed to be inserted once, any following call would then be an upsert, this is probably due to some sort of caching issue on the server, highly unusual though.