Someone already found a solution to this error or continues to be the universal problem of the Api?

Jan 19, 2010 at 6:36 PM

Someone already found a solution to this error or continues to be the universal problem of the Api?

Server Error in '/' Application.

An existing connection was forcibly closed by the remote host

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

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

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

 

Jan 20, 2010 at 2:58 PM

I started seeing tons of these errors about a week ago, especially in my console app which I run on a batch schedule from home over DSL.  Some on my Iframe web app, but not as many.

Since nothing changed in my app, I am assuming it is yet another manifestation of the flaky nature of integrating with Facebook.  

I had to implement retry logic to get around it.  I sleep for 500ms and then retry, up to 3 times.  That handles it.  I log the number of retries, and it varies quite a bit.  Often it is zero, but it is not uncommon to see 20 - 40 retries logged across processing 900 users for my app.

Here's my retry code (I use log4net for logging):

 

             int numRetries = 3;
             do {
                try {

                   //put all of your app code here that is prone to failing
               
                } catch (Exception ex) {
                    if (numRetries <= 0) {
                        Log.Fatal("Retry exceeded", ex);
                        throw;  // avoid silent failure
                    } else {
                        Thread.Sleep(500);
                        Log.Info("Retry invoked", ex);
                    }
                }
            } while (numRetries-- > 0);

 

 

Jan 21, 2010 at 11:03 AM

Thank you Patja

This problem is really a pin in the @$$
Is very difficult to make a debug because it seems random and can go days without appearing and at one point appears every 10 seconds.

Thank you for sending your working around of the problem.

Carlos.