다음을 통해 공유


Thoughts on Connection_Abandoned_By_AppPool

So, lately I have been getting a variety of questions about non-IIS but related issues. This is a slippery slope... but let me see how far it can go.

Question:

dear david:

I have a problem about the application pool ,it will crash after some Connection_Abandoned_By_AppPool errors. I know what happened, what I want to know is how to prevent it. coz I run a application which access another application to get data on schedule. The application access a realtime database which may not response on time, this will cause the Connection_Abandoned_By_AppPool problems. On this situation, how can I prevent these errors to make it looks working well?

Many thanx!

Answer:

It is not clear to me why this is a problem about the application pool. You seem to indicate that the problem is with the application that you are running which crashes when it accesses a realtime database which may not respond on time.

So, the problems which cause Connection_Abandoned_By_AppPool, as stated by you, are:

  1. The application crashes when it cannot get the data in time
  2. The database is not really "realtime" when it should be

Now, you are interested in preventing the Connection_Abandoned_By_AppPool problems, which means you need to either:

  1. Fix the application to not crash on error conditions such as not getting the data in time
  2. Fix the database to be "realtime" so that it responds appropriately

Other than directly fixing the cause(s) of the crashes that cause Connection_Abandoned_By_AppPool, you have no alternatives to prevent errors to "make it looks working well" when things are not working well. Why?

Well, suppose someone is making a query against your web application looking for some information that is only in the database. If you do not fix the problems in your application/database, then they can fail to retrieve the information for the user's query. Now what do you do to "make it looks working well"? The user is expecting an answer, your application does not have the answer and cannot retrieve it, and you say you do not want the user to see any problems... so are you going to fake an answer?

Maybe you can introduce a highly-available data-caching layer on top of the database such that all queries do not need to go to the database all the time, but this data could be stale. Plus, you now introduce the complexity of a data-caching layer with its own bugs... without fixing the original bugs in the other application nor the database issue. Whether any of this is worth it - that is for you to decide at an architectural level. Hey, you have to think about this stuff. :-)

In general, I advocate users to identify and fix the actual problem, not just "make it looks working well", because otherwise you tend to end up with complicated hacks that may not delay the inevitable.

//David

Comments

  • Anonymous
    November 17, 2005
    :)Thank you for ur kindly reply.
    Sorry for my poor english, may be I didn't state the problem clear enough. The application is a web page which displays realtime data trend. The realtime data is stored in a realtime database(InfoPlus21). We use javascript+XML to read the data from InfoPlus21 and display the trend on the page every 5 seconds without refreshing the page. Few missing data may not change the trend very much. But after too many errors (say: 100 Connection_Abandoned_By_AppPool or more in 12 hours ) will make IIS crashed. That's the reason I ask for a solution "make it looks working well". If the error of missing data couldn't be solved in a short time, at least do not crashe IIS. :)

    any idea?

    ps: I really want to know what behind the Connection_Abandoned_By_AppPool. What cause the error? Normaly the application runs well, so don't know why this could happen.

    Thank you very much:)

  • Anonymous
    November 17, 2005
    The comment has been removed

  • Anonymous
    November 20, 2005
    Thank you very much. I will work on this direction and try to find what happened :)
    best regards

  • Anonymous
    February 14, 2006
    I am getting connection abandon error in the IIS when we click on download on the file that we fetch from SRS db.

  • Anonymous
    February 14, 2006
    The comment has been removed

  • Anonymous
    February 15, 2006
    No there is no custom code to download the file from SRS. Basically let me explain the problem in detail.

    Files larger than 21 MB are not getting downloaded.Here i get a server reset connection error and file download is only upto certain percentage.When i check the iis log file i see Connection_Abandoned_By_AppPool error.

    Files upto 19 MB can be downloaded easily.

    These files are zipped in the Sql reporting services db.

  • Anonymous
    February 15, 2006
    The comment has been removed

  • Anonymous
    February 15, 2006
    David - SRS is SQL reporting services, it has its own portal, so these zip files are shown as hyperlinks on the SRS portal. These zip files are stored as BLOBs in the SRS db. When the link is clicked it starts downloading the file.

    So files that are greater than 21 MB size a server reset connection error  is encountered and file download is only upto certain percentage.When i check the iis log file i see Connection_Abandoned_By_AppPool error

  • Anonymous
    February 15, 2006
    Jaideep - then that sounds like custom code doing download of blobs from SQL.

    If custom code is in ASP, then the KB may apply.
    If custom code is in ASP.Net, I think there is also a 20MB-download bug (I don't have that KB handy).

    //David

  • Anonymous
    February 15, 2006
    David - The SRS does it all, we have not written any custom code for download. The Large files are published to SRS site, and we download these files from the SRS site.
    Please let me know your thots.

  • Anonymous
    February 15, 2006
    Jaideep - oh, I see where the confusion lies - custom code is not necessarily anything you have written (that would be "user code"). SRS may have written that code it already... In which case this is a support case for Microsoft.

    I am jumping ahead to thinking about what could cause behavior like that, and I can think of a specific KB that applies to custom code written in ASP (826756) involving a 20MB number and another for ASP.Net (don't have its number). Do either of them fit your case?

    I think you should contact Microsoft PSS because in the case of product issues, the call and fix should be free (charge refunded back).

    //David

  • Anonymous
    February 20, 2006
    David - I want to tell you one observation, When Site is SSL enabled the large file is not able to down load we get a server reset error.

    When the SRS site is SSL disabled, then we are able to download the large file from the SRS site.

    Any idea on what could be happening?

  • Anonymous
    February 21, 2006
    Jaideep - I have no idea, but I think you should contact Microsoft Product Support. They are specifically trained to troublshoot such issues.

    //David

  • Anonymous
    March 13, 2006
    Connection_Abandoned_By_AppPool seems to appear when App Pool requests a recycle because virtual memory limit exceeded (i.e. PeriodicRestartMemory metabase property).  Hence, IMHO, it could result from a healthy albeit overweight application, or too many connections, etc.

  • Anonymous
    May 15, 2006
    We have the same problem with IIS6, wenn using ISAPI written  in c++. When we allocate memory with more than 550 MB in this extension, IIS6 disables our app. here the testapp as isapi

    memtest.cpp
    // MEMTEST.CPP - Implementierungsdatei für Ihren Internet-Server
    //    MemTest Extension

    #include "stdafx.h"
    #include "MemTest.h"


    ///////////////////////////////////////////////////////////////////////
    // Tabelle zur Befehlsinterpretation

    BEGIN_PARSE_MAP(CMemTestExtension, CHttpServer)
    // ZU ERLEDIGEN: Fügen Sie Ihr ON_PARSE_COMMAND() ein und
    // ON_PARSE_COMMAND_PARAMS() hier, um Ihre Befehle einzubinden.
    // Beispiel:

    ON_PARSE_COMMAND(SetMem, CMemTestExtension, ITS_PSTR)
    ON_PARSE_COMMAND(Default, CMemTestExtension, ITS_EMPTY)
    DEFAULT_PARSE_COMMAND(Default, CMemTestExtension)
    END_PARSE_MAP(CMemTestExtension)


    ///////////////////////////////////////////////////////////////////////
    // Das einzige CMemTestExtension-Objekt

    CMemTestExtension theExtension;


    ///////////////////////////////////////////////////////////////////////
    // CMemTestExtension Implementierung

    CMemTestExtension::CMemTestExtension()
    {
    m_pInt = NULL ;
    }

    CMemTestExtension::~CMemTestExtension()
    {
    if (m_pInt)
    delete m_pInt ;
    m_pInt = NULL ;
    }

    BOOL CMemTestExtension::GetExtensionVersion(HSE_VERSION_INFO* pVer)
    {
    // Aufruf der Standardimplementierung für die Initialisierung
    CHttpServer::GetExtensionVersion(pVer);

    // Einlesen der Beschreibungszeichenfolge
    TCHAR sz[HSE_MAX_EXT_DLL_NAME_LEN+1];
    ISAPIVERIFY(::LoadString(AfxGetResourceHandle(),
    IDS_SERVER, sz, HSE_MAX_EXT_DLL_NAME_LEN));
    tcscpy(pVer->lpszExtensionDesc, sz);
    return TRUE;
    }

    BOOL CMemTestExtension::TerminateExtension(DWORD dwFlags)
    {
    // Erweiterung wird beendet
    //ZU ERLEDIGEN: Alle Per-Instanz-Ressourcen bereinigen
    return TRUE;
    }

    ///////////////////////////////////////////////////////////////////////
    // CMemTestExtension Befehls-Handler

    void CMemTestExtension::Default(CHttpServerContext* pCtxt)
    {
    StartContent(pCtxt);
    WriteTitle(pCtxt);

    pCtxt << _T("This default message was produced by the Internet");
    pCtxt << _T(" Server DLL Wizard. Edit your CMemTestExtension::Default()");
    pCtxt << _T(" implementation to change it.rn");

    EndContent(pCtxt);
    }

    // Die folgenden Zeilen nicht bearbeiten. Sie werden vom Klassenassistenten benötigt.
    #if 0
    BEGIN_MESSAGE_MAP(CMemTestExtension, CHttpServer)
    //{{AFX_MSG_MAP(CMemTestExtension)
    //}}AFX_MSG_MAP
    END_MESSAGE_MAP()
    #endif // 0



    ///////////////////////////////////////////////////////////////////////
    // Verwendet Ihre Erweiterung nicht die MFC, benötigen Sie diesen Code, um sicherzustellen,
    // dass die Erweiterungsobjekte das Ressourcen-Handle für das Modul finden können.
    // Wollen Sie Ihre Erweiterung so umwandeln, dass sie nicht von MFC abhängt,
    // entfernen Sie die Kommentare um die nachfolgenden AfxGetResourceHandle()
    // und DllMain()-Funktionen sowie die globale Varaible g_hInstance.

    /
    **

    static HINSTANCE g_hInstance;

    HINSTANCE AFXISAPI AfxGetResourceHandle()
    {
    return g_hInstance;
    }

    BOOL WINAPI DllMain(HINSTANCE hInst, ULONG ulReason,
    LPVOID lpReserved)
    {
    if (ulReason == DLL_PROCESS_ATTACH)
    {
    g_hInstance = hInst;
    }

    return TRUE;
    }

    ***/

    void CMemTestExtension::SetMem(CHttpServerContext *pCtxt, LPCSTR MemSizeMB)
    {
    *pCtxt << "<html><head><titel>Test Memory</title></head>rn<body>" ;
    char *cp = strstr(MemSizeMB,"=") ;
    if (!cp)
    {
    *pCtxt << "Fehler</BODY></HTML>" ;
    return ;
    }
    cp++ ;
    int theSize = atoi(cp) ;
    theSize = 1024 ; // KB
    theSize = 1024 ; // MB
    if (m_pInt)
    delete m_pInt ;
    m_pInt = new char[theSize] ;
    CString Str ;
    if (m_pInt)
    Str.Format ("Speicher von %i MB erstelle</BODY></HTML>",theSize / (1024
    1024)) ;
    else
    Str.Format ("Speicher von %i MB <B>NICHT</B>erstelle</BODY></HTML>",theSize / (1024
    1024)) ;
    *pCtxt << Str ;


    }

    memtest.h
    #if !defined(AFX_MEMTEST_H__5D3BF5AB_497D_4DD0_816C_9EA532DCF4F1__INCLUDED
    )
    #define AFX_MEMTEST_H__5D3BF5AB_497D_4DD0_816C_9EA532DCF4F1__INCLUDED_

    // MEMTEST.H - Header-Datei für Ihren Internet-Server
    //    MemTest Extension

    #include "resource.h"

    class CMemTestExtension : public CHttpServer
    {
    public:
    char m_pInt;
    void SetMem(CHttpServerContext
    pCtxt,LPCSTR MemSizeMB);
    CMemTestExtension();
    ~CMemTestExtension();

    // Überladungen
    // Vom Klassenassistenten generierte Überladungen virtueller Funktionen
    // HINWEIS - An dieser Stelle werden Member-Funktionen vom Klassen-Assistenten eingefügt und entfernt.
    //    Innerhalb dieser generierten Quelltextabschnitte NICHTS VERÄNDERN!
    //{{AFX_VIRTUAL(CMemTestExtension)
    public:
    virtual BOOL GetExtensionVersion(HSE_VERSION_INFO* pVer);
    //}}AFX_VIRTUAL
    virtual BOOL TerminateExtension(DWORD dwFlags);

    // ZU ERLEDIGEN: Hier Handler für Ihre Befehle einfügen.
    // Beispiel:

    void Default(CHttpServerContext* pCtxt);

    DECLARE_PARSE_MAP()

    //{{AFX_MSG(CMemTestExtension)
    //}}AFX_MSG
    };


    //{{AFX_INSERT_LOCATION}}
    // Microsoft Visual C++ fügt unmittelbar vor der vorhergehenden Zeile zusätzliche Deklarationen ein.

    #endif // !defined(AFX_MEMTEST_H__5D3BF5AB_497D_4DD0_816C_9EA532DCF4F1__INCLUDED)


    any comments?

    mailto:martin@hemag.ch

  • Anonymous
    September 26, 2006
    Hi David,

    I have a Web Application in which I need to pass a URL with querystring which works fine when passed to Response.Redirect(). But when passed to Server.Transfer() it hangs and it updates
    "Connection_Abandoned_By_AppPool DefaultAppPool" as error in the following location.

    C:WINDOWSsystem32LogFilesHTTPERR

    I have to use Server.Transfer() instead of Response.Redirect() as per customer scenario.

    Do you have a solution for the same?

  • Anonymous
    September 26, 2006
    Hi David,

    I have a Web Application in which I need to pass a URL with querystring which works fine when passed to Response.Redirect(). But when passed to Server.Transfer() it hangs and it updates
    "Connection_Abandoned_By_AppPool DefaultAppPool" as error in the following location.

    C:WINDOWSsystem32LogFilesHTTPERR

    I have to use Server.Transfer() instead of Response.Redirect() as per customer scenario.

    Do you have a solution for the same?

  • Anonymous
    February 07, 2008
    Hi, I solved a similar problem by looking at the following article: http://support.microsoft.com/kb/885654 Cheers!!

  • Anonymous
    September 09, 2008
    The above support link worked for me too lol.

  • Anonymous
    April 03, 2009
    Connection_Abandoned_By_AppPool can also come about when a worker process is recycled.  I'm currently doing some testing with time-based vs. request-based recycling.  We have a number of sites that are returning 503 errors or 500 errors when the worker process recycles at its 60 minute deadline.  It appears that the time based recycle causes any standing requests to be dropped in a bad way.  I'm hoping that switching over to recycle after N requests will ensure that the thread finishes those N requests and does not get passed more until it recycles. Does anyone know if IIS will stop passing new requests to a worker thread when it's ready to recycle?

  • Anonymous
    April 20, 2009
    Benjamin - if you see 500 or 503, then you are seeing Connection_Abandoned_By_AppPool due to bugs in your application or your Application Pool configuration. When IIS decides to recycle a worker process due to a metric like time or #-requests, it will atomically switch future requests to the new worker process in an overlapping fashion by default. You can configure to be non-overlapping. i.e. For any recycling metric, suppose the Nth request is handled by the original worker process and the N+1st request is handled by the new worker process. Overlapped recycle means that the N+1st request does not wait for the Nth request to finish in the original worker process before starting itself in the new worker process. Overlapped recycling is usually ok, unless the application assumes that it is a singleton and has a lock on something system-wide like a log file or mutex. This system-wide lock becomes a problem when the N+1st request starts up in the new worker process (and tries to lock the resource) when the Nth request is still running in the old worker process (and has the lock on the resource). This frequently causes the N+1st request to fail, and if enough of it fails in a short enough time, the AppPool falls into 503. In all cases, if you see errors during worker process recycling, it is either a bug in the application, or there is a misconfiguration in the user's configuration of the Application Pool settings which conflict with the application's behavior. //David