MAPI Crashes When Using COM Multithread Model
ID: Q235059
|
The information in this article applies to:
-
Microsoft Outlook, versions 2000, 97, 98
-
Microsoft Exchange Active Server Components, version 5.0
-
MAPI
SYMPTOMS
When writing a multi-threaded apartment model in COM to set up more than one session, MAPI stops responding (crashes) with the following stack:
HrNewCommonSession() line 1037 + 46 bytes
MAPILogonX() line 2444 + 45 bytes
MAPILogonEx() line 2055 + 27 bytes
CSession::M_ScDo_Logon() line 1167 + 70 bytes
CSession::V_HrInvoke() line 246 + 8 bytes
CDispatchObj::Invoke() line 1003 + 11 bytes
_com_invoke_helper() + 655 bytes
_com_dispatch_method() + 35 bytes
_Session::Logon() line 17 + 52 bytes
CContainer::Open() line 37 + 90 bytes
RPCRT4! Invoke@12 + 40 bytes
RPCRT4! NdrStubCall2@16 + 1248 bytes
RPCRT4! CStdStubBuffer_Invoke@12 + 147 bytes
OLE32! StubInvoke + 83 bytes
OLE32! MTAInvoke + 21 bytes
OLE32! STAInvoke + 86 bytes
OLE32! CRpcChannelBuffer::AppInvoke + 131 bytes
OLE32! ComInvoke + 513 bytes
OLE32! ThreadDispatch + 21 bytes
OLE32! 77b5c7a6()
USER32! DispatchMessageWorker@8 + 135 bytes
USER32! DispatchMessageA@4 + 11 bytes
NtfyWaitForMultipleObjects() line 429
ScStartNtfyEngineMgr() line 1899 + 17 bytes
ScInitMapiX() line 678 + 5 bytes
MAPIInitialize() line 316
CDLL::S_ScAddLock() line 80 + 9 bytes
DllGetClassObject() line 174 + 5 bytes
OLE32! CDllCache::GetClassInterface + 161 bytes
OLE32! CDllCache::Add + 250 bytes
OLE32! CDllCache::GetOrLoadClass + 235 bytes
OLE32! SearchCacheOrLoadInProc + 42 bytes
OLE32! CoCreateInstanceEx@24 + 443 bytes
OLE32! wCoCreateInstance + 38 bytes
OLE32! CoCreateInstance@20 + 106 bytes
RPCRT4! Invoke@12 + 40 bytes
RPCRT4! NdrStubCall2@16 + 1248 bytes
RPCRT4! CStdStubBuffer_Invoke@12 + 147 bytes
OLE32! StubInvoke + 83 bytes
OLE32! MTAInvoke + 21 bytes
OLE32! STAInvoke + 86 bytes
OLE32! CRpcChannelBuffer::AppInvoke + 131 bytes
OLE32! ComInvoke + 513 bytes
OLE32! ThreadDispatch + 21 bytes
OLE32! 77b5c7a6()
USER32! DispatchMessageWorker@8 + 135 bytes
USER32! DispatchMessageW@4 + 11 bytes
OLE32! CDllHost::WorkerThread + 223 bytes
OLE32! DLLHostThreadEntry + 9 bytes
OLE32! CRpcThread::WorkerLoop + 21 bytes
OLE32! CRpcThreadCache::RpcWorkerThreadEntry + 26 bytes
KERNEL32! BaseThreadSt
CAUSE
MAPI uses a message pump to do the initialization. Initializing with a multithreaded apartment model from a COM app using CDO, more than one initialize message will be sent (one for each thread in the apartment).
During initialization, MAPI creates another message pump, and then the second initialization is processed before the first completes. A profile object is not filled in the first initialization until the notification manager is started. Because MAPI re-enters the initialization functions the second time, the profile object will not be filled until the second initialization finishes, and the logon is completed. Unfortunately, the logon uses the profile object that is NULL because it isn't yet filled in the first initialization call.
RESOLUTION
A supported fix that corrects this problem is now available from Microsoft, but
it has not been fully regression tested and should be applied only to systems
experiencing this specific problem. If you are not severely affected by this
specific problem, Microsoft recommends that you wait for the next Microsoft Exchange Server 5.5 service pack
that contains this fix.
To resolve this problem immediately, contact Microsoft Product Support Services
to obtain the fix. For a complete list of Microsoft Product Support Services
phone numbers and information on support costs, please go to the following
address on the World Wide Web:
http://www.microsoft.com/support/supportnet/overview/overview.asp
The English version of this fix should have the following file attributes or later:
Date Time Version Size File name Platform
-------------------------------------------------------------
05-14-99 7:34am 5.5.2621.0 879,888 Mapi32.dll I386
05-14-99 7:33am 5.5.2621.0 1,392,912 Mapi32.dll Alpha
STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed
at the beginning of this article.
Additional query words:
Keywords :
Version : WINDOWS:2000,5.0,97,98
Platform : WINDOWS
Issue type : kbbug