PRB: Errors When ATL Multi-Threaded ActiveX Script Host Runs Concurrent Scripts (310939)



The information in this article applies to:

  • The Microsoft Active Template Library (ATL) 2.0
  • The Microsoft Active Template Library (ATL) 3.0
  • Microsoft Visual C++, 32-bit Professional Edition 6.0

This article was previously published under Q310939

SYMPTOMS

When you attempt to use a multi-threaded ActiveX Scripting host that is written in Active Template Library (ATL) to run scripts on two or more threads simultaneously, and you call IActiveScriptParse::ParseScriptText, you may receive the following HRESULT from ParseScriptText:
Error: 0x80020101 (-2147352319)
SCRIPT_E_REPORTED
If the host implements IActiveScriptSite::OnScriptError, the EXCEPINFO structure that is returned from IActiveScriptError::GetExceptionInfo has the following scode:
Error: 0x80004005 (-2147467259)
E_FAIL: Unspecified error
The problem occurs very frequently on multi-processor computers, but it can also occur on a single-processor computer if the thread count is high.

CAUSE

The problem is related to the host's implementation of a named item object that is being used by the Microsoft Visual Basic Scripting Edition (VBScript) or Microsoft JScript script engine while the engine runs the scripts from multiple threads.

The ATL default implementation for IDispatch::GetIDsOfNames contains a small bug that can cause a named object to return an E_FAIL error message when it attempts to access the ITypeInfo interface for an object, even though the ITypeInfo interface is returned. This problem occurs independent of ActiveX Scripting but is frequently seen by ActiveX Scripting clients that are written in ATL.

RESOLUTION

For additional information on how to correct this problem in an ATL project, click the article number below to view the article in the Microsoft Knowledge Base:

266713 BUG: IDispatch::GetIDsOfNames() May Return E_FAIL When Successful

REFERENCES

For more information on these errors or ActiveX Scripting in general, see the following Knowledge Base articles:

247784 INFO: '80020101' Returned From Some ActiveX Scripting Methods

232394 HOWTO: Catch Run-time Errors in an ActiveX Script Host

223139 HOWTO: Add Support for Hosting VBScript to an ATL Application


Modification Type:MajorLast Reviewed:12/15/2003
Keywords:kbprb KB310939