Microsoft KB Archive/831933

= FIX: MiniJIT allows Just-In-Time-Activated COM+ components to join their own context =

Article ID: 831933

Article Last Modified on 10/26/2006

-

APPLIES TO


 * Microsoft COM+ 1.5, when used with:
 * Microsoft Windows XP Professional

-





Important This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows Registry



SYMPTOMS
Application performance may decrease when you migrate your custom applications from Microsoft Transaction Server (MTS) for the Microsoft Windows NT 4.0 operating system to Microsoft COM+ 1.5 for Microsoft Windows XP. Application performance can decrease by almost 40 percent, but the problem does not affect all custom applications, just those that use the Just-In-Time (JIT) Activation service in COM+.



CAUSE
When you use the JIT Activation service in COM+, the COM+ component is forced to join its own context. This can cause too much context creation and cross-context marshaling in COM+.



RESOLUTION
To resolve this problem, obtain the latest service pack for Windows XP. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

322389 How to obtain the latest Windows XP service pack



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the &quot;Applies to&quot; section. This problem was first corrected in Microsoft Windows XP Service Pack 2.



MORE INFORMATION
Warning If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.

This fix adds a new Microsoft COM+ feature that is named MiniJIT. With MiniJIT enabled, a component can take part in JIT activation and can still be activated in the context of its caller. MiniJIT also makes sure that the IObjectControl::Activate method and the IObjectControl::Deactivate methods are appropriately called, and that the transaction and the state of the parent (component of the caller) are not affected when the child component calls any one of the following methods:
 * IObjectContext::SetComplete
 * IObjectContext::SetAbort
 * IObjectContext::EnableCommit
 * IObjectContext::DisableCommit

Note With MiniJIT enabled on a component, all the component and application property settings other than those for JIT that are mentioned in the following article still must be set correctly to activate the component in the context of the caller:

261096 HOWTO: Activate a COM+ Component in Its Caller's Context

Steps to Enable MiniJIT
 Make sure that the COM+ Hotfix Rollup Package 7 or later is installed. Add the following value to the registry to enable MiniJIT:

Key: MiniJITEnabled

Type: REG_DWORD

value: 1 Set all the component and application property settings that are mentioned in the following article:

261096 HOWTO: Activate a COM+ Component in Its Caller's Context

 In the component properties, set the following options to allow the COM+ runtime to determine that the object has MiniJIT enabled:  Enable Just In Time Activation</li> Must be activated in callers context</li></ul> </li></ol>

You must correctly identify the candidate components for MiniJIT. Before you apply MiniJIT, you must make sure that these components can be instantiated in the context of the caller. The components must meet the following requirements:
 * These components must not use any COM+ services that are other than JIT.
 * The component or the components that have MiniJIT enabled must always be called from another component or from other components in the same process. The components that have MiniJIT enabled should not be called from a component or components, or from a client or clients, in another process. Microsoft recommends that you add components that have MiniJIT enabled to a Library package. This makes sure that MiniJIT is created in the process of the callers.
 * The component or the components that have MiniJIT enabled must always be called from another component with the same threading model. This make sure that the component or the components can be instantiated on the same Thread or Apartment.

If you do not meet these requirements, the component instantiation may fail with the following error message: 0x80004024: The specified activation could not occur in the client context as specified.

Differences Between JIT and MiniJIT

 * The ObjectControl_Activate method for the MiniJIT object is called immediately after you create the object and not when the first method is called. In a typical JIT scenario, ObjectControl_Activate is called when the first method call is made.
 * The ObjectControl_Deactivate method for the MiniJIT object is only called when the calling object is destroyed. The Deactivate method of the MiniJIT object is not called immediately after the SetComplete method or the SetAbort method call is made. It is not called even after its last outstanding reference is released. In the typical JIT case, ObjectControl_Deactivate is called after SetComplete or SetAbort or when the last reference is released.

Additional query words: winxp wincom+ kbWinXPpreSP2COMRollup7Fix

Keywords: kbhotfixserver kbqfe atdownload kbwinxpsp2fix kbwinxppresp2fix kbfix kbbug KB831933

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.