"John Maly" <johnmaly.DeleteThis@hotmail.com> wrote in message
news:e6ohBGuNEHA.556@TK2MSFTNGP10.phx.gbl...
> Hi All,
> We have a Web application built with ASP Code. The ASP Code in turn calls
> VC++ dll through a COM Object. The Com Object spawns a worker thread
> (thread-A). Then the worker thread spawns another thread (thread-B). The
There you go!
You never can be sure about the thread state of the parent process within
IIS. If IIS decides that a thread needs to be returned to the pool, you
really have a problem, you cannot get events on that.
Second, you play with your live

when you go out of your COM apartment
within a process. It is against good COM programming practices

, yes, you
can/could use a free threaded marshaler, but vbscript/IIS and all together,
it's not advised...
> code in thread-B contains an infinite looping, so that the life of
Thread-B
> lasts till IIS is Reset. In other words Thread-B runs as long as IIS runs.
> But, after running like 5 or 10 minutes IIS crashes.
>
> IIS crashes because of the infinite loop which is purposely put in to
retain
> the life of the thread till IIS is reset.
> If I dont have the infinite loop, it does not crash...
> Would appreciate any help on why IIS is crashing. I have included the IIS
> message from Eevet Viewer and the code
>
> Thank you for your time,
> - John
> ==========================================================================
> IIS Crash message from the Event Viewer (System) is as follows:
> ==========================================================================
> A process serving application pool 'DefaultAppPool' suffered a fatal
> communication error with the World Wide Web Publishing Service. The
process
> id was '3196'. The data field contains the error number.
>
> ==========================================================================
> The code in the function which is passed to AfxBeginThread, is as
follows.
> ==========================================================================
> UINT WorkerThreadCheckWebReportFile(LPVOID pParam)
> {
>
> UINT retval = 0;
> CWorkerThreadInfo *pActivityThreadinfo;
> pActivityThreadinfo = (CWorkerThreadInfo *)pParam;
>
> if (!pActivityThreadinfo)
> return retval;
>
> //Set the authentication info for this new thread to be the same as that
of
> //the parent thread, to ensure this will work properly with OS
> authentication
> HANDLE hActivityThread = GetCurrentThread();
> BOOL bRet = SetThreadToken( &hActivityThread,
> pActivityThreadinfo->hToken );
>
> if (!bRet)
> {
> // Couldn't set the authentication information for this thread
> // Pass it back to the primary thread which will return it to the
process
> pActivityThreadinfo->m_nResult = ERR_AUTHENTICATION_FAILED;
> return retval;
> }
>
> // End Code added to fix the NT Authentication Issue
> TCHAR szDBPath[255];
> TCHAR szAppPath[255];
> CFDCProcCtrl* pWebActy = NULL;
> CTimeSpan tSpan;
>
> try
> {
> while (1)
> {
> if (!pfCloseWebActivityFile || !pfCheckWebActivityFile)
> return 1;
>
> for (int iCount = 0; iCount < vpProcCtrlList.size(); iCount++)
> {
> pWebActy = vpProcCtrlList[iCount];
> CString sDBPath = pWebActy->GetDBPath();
> _tcscpy(szAppPath, pActivityThreadinfo->m_sAppPath);
> strcpy(szDBPath, sDBPath.GetBuffer(sDBPath.GetLength()));
> if (pfCheckWebActivityFile(szAppPath, szDBPath) == 1)
> {
> pWebActy->TimeSpan(&tSpan);
> if (tSpan.GetTotalSeconds() >= 30)
> {
> pfCloseWebActivityFile(szAppPath, szDBPath);
> pWebActy->SetClose();
> }
> }
> }
> Sleep(6000);
> }
>
> }
> catch(...)
> {
> CloseHandle(hActivityThread);
> delete pActivityThreadinfo;
> pActivityThreadinfo->m_nResult = ERR_CRL_EXCEPT;
> }
> CloseHandle(hActivityThread);
> delete pActivityThreadinfo;
> return 1;
> }
>
> ==========================================================================
>
><!-- ~MESSAGE_AFTER~ -->