Is there a maximum number of COM connections? - com

An applications starts multiple other applications (components) by (D)COM+. There seems however to be some sort of maximum that can be started on the server.
The master application is written in c#, the others components in Visual Objects, 32 bit.
I've seen this problem on multiple Windows versions, including Win 7 prof and 2008 server versions.
Depending on how the component is started I get a class does not exist or
Retrieving the COM class factory for component with CLSID {50495402-21B7-11D4-A041-00A024E1D270} failed due to the following error:
80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).
In the latter case the system eventlog states:
Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"
System
Provider Name="Win32k"
EventID Qualifiers="32768" : 243
Level : 3
Task : 0
Keywords : 0x80000000000000
EventRecordID : 36855
Channel : System
computer : W151.piramide.lan
EventData
Data
Binary : 000000000100000000000000F3000080000000000000000000000000000000000000000000000000
I'm stuck for instance at my machine with arround 48-50 components.
In an earlier version of the master application (written in Visual Objects) I can connect 273 components.
Any hints/ideas?

Related

System.AccessViolationException after a second use of an ADODB Connection

I’m suffering a frustrating error for the last two weeks in a vb.net application developed for my company.
The application consists of a basic interface (Windows Form Application) to get some data (file paths and coordinates) and then processes a lot of information coming from a steel structure modelled in an external application called Staad.Pro (very common in the Oil & Gas sector) and from several Excel files.
So it gets external information from two sources:
A Staad.Pro file, through the library openstaad.dll,distributed with
Staad.Pro.
Some Excel files, through the ADO Connection and Recordset objects.
The application has been used satisfactorily for three years. I recently made some changes to introduce the background process of the data and the definition of the configuration for every project company using an external Excel file, which was previously defined at code level.
This configuration file is read directly in Excel opening an application instance (Excel), while the others Excel files are opened using ADO as I said previously. At the same time, the configuration file path is defined in a single text file, that it is always used by the application to read that path, which content can be modified using the application through an OpenFileDialog object.
I specify in particular those points because they are the changes I made before the error occurrence. There have been also two weeks of inactivity because of my holidays, during which some Windows updates have been released (I suppose some of them are related to the popular ransomware Wannacry and Petya).
So the error message I get running the application in VS Community 2015 is the following:
An unhandled exception of type 'System.AccessViolationException'
occurred in mscorlib.dll.
Additional information: Attempted to read or
write protected memory. This is often an indication that other memory
is corrupt.
It appears when the application opens the second ADO connectionn to an Excel file with the following code:
cnn1.Open("Provider=Microsoft.ace.OLEDB.12.0;" &
"Data Source=" & rutaarchivo & ";" &
"Extended Properties=""Excel 12.0;HDR=Yes"";")
The first connection is closed and the corresponding object is set to Nothing. I changed the way of access to this file trying to understand the error, avoiding ADO, but the error arises again in a later connection to another Excel file with ADO, that is again the second ADO connection after the changes.
The error arises randomly, in such a way that when the project is just opened in VS Community 2015 and then it is run for the first time, no error appears (usually), but it does after a second execution.
Other times the error arises at the call to the subroutine that makes the ADO connection to the Excel file, not at the code of the subroutine itself, with a different message:
Managed Debugging Assistant 'FatalExecutionEngineError' has detected a
problem in (path).
Additional Information: The runtime has encountered
a fatal error. The address of the error was at 0x79f387d1, on thread
0x168c. The error code is 0xc0000005. This error may be a bug in the
CLR or in the unsafe or non-verifiable portions of user code. Common
sources of this bug include user marshaling errors for COM-interop or
PInvoke, which may corrupt the stack.
When looking for an error pattern I found another error that appears when I use for the second time the same type of object of the library openstaad.dll, with the following message:
An exception of type 'System.Runtime.InteropServices.COMException'
occurred in Microsoft.VisualBasic.dll but was not handled in user code
Additional information: La memoria está bloqueada. (Excepción de
HRESULT: 0x8002000D (DISP_E_ARRAYISLOCKED))
I’ve found two main articles on the internet about this error (System.AccessViolationException):
Programs randomly getting System.AccessViolationException
https://www.codeproject.com/Questions/106826/OpenFileDialog-OleDbConnection-AccessViolationExce
I’ve tried to reinstall Access Database Engine, to define the environment variable that is mentioned and to change the .NET Framework version. Nothing works.
Any help to solve this problem will be appreciated.
Alberto Ruiz
I experienced the same error recently after the second use of an Microsoft.ACE.OLEDB.12.0 connection, to MS Access in this case.
What helped for me was wrapping the connection in a new Thread.
For example: if your problematic code that opens the connection is in method OpenExcel you could do the following:
(new Thread(() => OpenExcel())).Start();
Hope this helps.

COMExcepton occurred trying to create a new instance of Microsoft.Office.Interop.Word.Application

I am trying to create a word document using visual basic. I have found that this can be done using the Microsoft.Office.Interop.Word objects.
I have found some tutorials online (https://support.microsoft.com/en-us/kb/316384) about how to create a word document programmatically.
I have created a simple windows form application. When a button is clicked the word document will be created. I made sure to add the reference to Microsoft.Office.Interop.Word in my application.
My problem is that an error keeps getting thrown at this point:
app = New Microsoft.Office.Interop.Word.Application
The error is:
COMException occurred
A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll
Additional information: Retrieving the COM class factory for component with CLSID (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: ox80080005 (COE_SERVER EXEC FAILURE)).
I have read that the following needs to be done, so I have made sure that word 2013 is installed on my machine and I have set the target CPU to x64 inside the application's properties.
If anyone has any insight to what I am missing or if I am doing something wrong I would appreciate the help.
Update:
I have tested my code on another machine and it works. So the source of this error is not the code.
Update: Pt. 2
I've been doing some more research (http://www.microsoft.com/technet/support/ee/transform.aspx?ProdName=Windows+Operating+System&ProdVer=5.2&EvtID=10010&EvtSrc=DCOM&LCID=1033) and I believe I may be getting closer to the source of the problem. I've gone into the registry and it seems that the local server it is failing to communicate with is pointing to WINWORD.exe which makes sense. What does not make sense is that it is looking for the wrong WINWORD.exe. I am going to try and fix this so it is pointing to the WINWORD.exe for Word 2013 instead of Word 2010.
Solution
What ended up fixing my problem was preforming a quick repair on office. I went to control panel, programs and features, selected office, pressed the change button, and selected quick repair. Do not know what caused things to get messed up, but this did fix my problem.
Where do you run the code? Is it a Windows service or ASP.NET application?
Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.
If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution. Read more about that in the Considerations for server-side Automation of Office article.
You may find existing threads with the same issue described:
System.Runtime.InteropServices.COMException (0x80080005): Retrieving the COM class factory for component with CLSID
Office Automation in .NET - COMException 80080005
Word Automation with ASP.NET
Finally, if all the mentioned information is not relevant to your case I'd suggest repairing Office. It looks like something is wrong with its windows registry keys.

VB6 COM+ Out of Memory Issue

We have a ASP.Net web application which runs on .Net framework 4.0.
Architecture is like,
.Net Module --> VB6 COM+ Data Object --> VB6 COM+ Calculation Module
--> 3rd party COM+ Finance Factory (installed COM).
End user uses this application to create contracts by collecting customer details, vehicle details, finance details and calculate multiple parameters in a single calculate button click then submits all the data to another system.
Issue:
Intermittently, it is throwing ‘Out of Memory’ error while calculating the deal (on clicking calculate button on the deal) and calculation is not being completed successfully. This impacts the business.
We found that it is being thrown in the VB6 COM+ Calculation Module -> in a Initialize method.
This method is initializing the third party (installed) COM objects and feeding the necessary data for calculation in xml format (Predefined), immediately getting back the response and ending the subroutine.
We got to know that this error is happening inside this method only and not sure about which statement is causing this. And this happening in Production environment alone. No other (test) environments are able to be replicated.
It is high risk to have any logs over this method and redeploy the code into Production and hence we are unable to have any log information over here. It was an issue since beginning but happens very occasionally but it became frequent since past 6-8 months.
Error message: Sub: Initialize
Error Number: 7
Error Description: "Out of memory"
Environment detail:
Windows 2003 Server SP 2 with 3 GB of Physical memory. Our application COM objects are built with Apartment Thread model and registered within MTS.
We carried out Load test, stress test but still unable to replicate the issue. And hence we are unable to find the root cause as well. We had spent good enough time on this and still struggling.

Major SQLException (XA related) in Weblogic application Server

We're developing a software with Weblogic application server (12.1.1.0); We have one domain with two applications.
We just moved up from development DB to pre-production DB (similar to production), and oh boy we got a major issue going...
DBA says the DBs are running the same version - Oracle 11 (I don't recall the exact version). The only difference we can see is that the dvlp DB uses SID for connection, and the other two uses service-name.
Now, in our domain we have two data sources X and Y. Both are connected to the same DB. We use XA driver on both. Both our applications uses the same 'persistence.xml' (and entities) which has two PUs (persistence units), each using a different data source (X and Y).
The problem is this:
An MDB starts handling a request.
It uses both PUs with EntityManagers and the Y data source with DataSource interface, which is used to get a connection (we have some JDBC code).
It calls a bean from the other application.
The other bean tries to use one of the PUs (the one connected to X data source).
SQLException is thrown:
XA error: XAResource.XAER_NOTA start() failed on resource 'x_my_domain': XAER_NOTA : The XID is not valid
We've searched the error online and we found out that we should change the data sources' configuration to
XASetTransactionTimeout=true
XATransactionTimeout=0
but that didn't worked.
We've also tried (a lot) to tweak the data sources' configuration, eventually removing one of them so we only need to tweak with only one of them, but nothing has worked.
In addition, while repeatedly tweaking the configuration, a different SQLException has slipped under our radar and started popping out instead of the previous:
Internal error: Cannot obtain XAConnection weblogic.common.resourcepool.ResourceDisabledException: Pool X is Suspended, cannot allocate resources to applications
Now this one is even more frustrating, because we tried everything; reset the data source; delete and re-create; delete and re-create with different name; delete the domain and re-create with a different data source name; go back using the dvlp DB; but nothing, the exception seems to persist.
We really don't have any idea of how to solve this and we can't go any further without fixing this problem.
We finally found how to fix the problem, but to answer the question I will have to explain more about our environment; We actually have two managed servers, and each application runs on another server. Both the admin-server and one of the MS runs on one machine, and the other MS runs on another machine (total of two machines).
The thing was that when we modified one of the data sources (X), which was used also by the other MS, we didn't restarted the other MS, but only the data-source. We guess that this caused the data-source not to update with the new modifications on the other MS, which caused the errors we encountered.
The problem was caused by a rather foolish reason, but it was hard to spot because it recurred on any environment setup of the admin-server + first MS part, even on our own PCs with a setup of only an admin-server with no definition of machines. The reason it still happened is because the address of the machine containing the other application was written in the code (read from XML configuration, but that doesn't change much).
Well, glad that's over with.

Please help me. how to handle this error. when i run my application on another computer i get this message:

In my application I use crystal report version 13. When I install my setup on another computer (just windows xp without any application)it succeeds, but when I run my application, it shows a message like this:
WindowsApplication1 has encountered a problem and needs to close. We are sorry for the inconvenience. If you were in the middle of something, the information you were working on might be lost.
It has what data does this error report contain link. From this link I have collected the following information.
Error signature
EventType : clr20r3 P1 : windowsapplication1.exe P2 : 1.0.0.0
P3 : 4ca21bfa P4 : system.windows.forms P5 : 2.0.0.0 P6 : 471ebf68
P7 : 3dad P8: 97 P9 : systemio.filenotfoundexception
Reporting details :
This error report includes : information regarding the condition of WindowsApplication1 when the problem occurred the operating system version and computer hardware is use; your Digital Product ID, which could be used to identify your license; and the Internet Protocol(IP) anddress of your computer.
We do not intentionally collect your files, name, address, e-mail address or any other form of personally identifiable information. However the error report could contain customer-specific information such as data from open files. While the information could potentially be used to determine your identity, if present, it will not be used.
The data that we collect will only be used to fix the problem. If more information is available, we will tell you when you report the problem. This error will be sent using a secure connection to a database with limited access and will not be used for marketing purposes.
File not found, that means your application is unable to find the specified file in the location defined internally; that is incorrect path. Check the report file path in your windowsapplication1.exe and where it is residing after installation of your program. It might be a problem.