Hello!
We have some code that is written in COM. It was used in a
"ISAPI-extension server " and everithing was fine. And it is fine at
the moment.
But now this code is used from the ASP.NET server. And we receive some
unknown exceptions. Them occurs after a long period of working (about
of 10,000 stress-test-queries). We can't ever recognize these
exceptions.
For example, yesterday I've received an exception in the method:
STDMETHODIMP CGobiSrv::put_FSCreator(IUnknown* fsCreator)
{
SAFE_METHOD_START("CGobiSrv::put_FSCreator")
AFX_MANAGE_STATE(AfxGetStaticModuleState())
serve->SetFSCreator( fsCreator );
GTRACEL("FSCreator received\n");
return S_OK;
SAFE_METHOD_END
}
We try to catch exceptions using the following code:
#define SAFE_METHOD_START(method_name) \
CMethodExecutionViewer method_ex_viewer( this->GetClassID(),
this->GetInstanceNum(), method_name ); \
try { \
#define SAFE_METHOD_END \
} catch (std::exception& e) { \
method_ex_viewer.ViewException( "standard", e.what() ); \
return E_FAIL; \
} catch (CException* e) { \
const int MAX_ERR_LEN = 256; \
GBuffer<TCHAR> err_msg(MAX_ERR_LEN); \
e->GetErrorMessage( err_msg, MAX_ERR_LEN ); \
method_ex_viewer.ViewException( _TEXT("MFC"), static_cast<TCHAR*>(
err_msg ) ); \
return E_FAIL; \
} catch (_com_error &e) { \
method_ex_viewer.ViewException( _TEXT("COM"), e.ErrorMessage() ); \
return E_FAIL; \
} catch (CAtlException &e) { \
const int MAX_ERR_LEN = 256; \
GBuffer<TCHAR> hr_code(MAX_ERR_LEN); \
ltoa(e, hr_code, 16); \
method_ex_viewer.ViewException( _TEXT("ATL"), static_cast<TCHAR*>(
hr_code ) ); \
return E_FAIL; \
} catch (...) { \
method_ex_viewer.ViewException( "unknown", "" ); \
return E_FAIL; \
} \
and our exceptions are always fall into the catch (...) section.
There is some EnterCriticalSection()/LeaveCriticalSection() that occurs
in SetFSCreator() method because of the fact that some global data is
shared between COM-objects. It's is because we use very legacy code.
Maybe the error is somewhere in interlocking, but why it's working in
the ISAPI-mode?
We use _ATL_APARTMENT_THREADED. We tried to run ASP script with and
without ASPCompat="true". We tried to run on .NET 1.1 and .NET 2.0. The
song remains the same.
It's very hard to debug. Because these exceptions occurs in different
places and after a long time of working.
Can anybody help us?
--
Danil 2 1375
you need to set AspCompat=true, to support STA (apartment model) com
objects. also are you calling Marshal.ReleaseComObject(), to release the
object?
note: STA com objected can not be used directly from a webservice.
-- bruce (sqlwork.com)
<da************@gmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com... Hello!
We have some code that is written in COM. It was used in a "ISAPI-extension server " and everithing was fine. And it is fine at the moment.
But now this code is used from the ASP.NET server. And we receive some unknown exceptions. Them occurs after a long period of working (about of 10,000 stress-test-queries). We can't ever recognize these exceptions.
For example, yesterday I've received an exception in the method:
STDMETHODIMP CGobiSrv::put_FSCreator(IUnknown* fsCreator) { SAFE_METHOD_START("CGobiSrv::put_FSCreator") AFX_MANAGE_STATE(AfxGetStaticModuleState()) serve->SetFSCreator( fsCreator ); GTRACEL("FSCreator received\n"); return S_OK; SAFE_METHOD_END }
We try to catch exceptions using the following code:
#define SAFE_METHOD_START(method_name) \ CMethodExecutionViewer method_ex_viewer( this->GetClassID(), this->GetInstanceNum(), method_name ); \ try { \
#define SAFE_METHOD_END \ } catch (std::exception& e) { \ method_ex_viewer.ViewException( "standard", e.what() ); \ return E_FAIL; \ } catch (CException* e) { \ const int MAX_ERR_LEN = 256; \ GBuffer<TCHAR> err_msg(MAX_ERR_LEN); \ e->GetErrorMessage( err_msg, MAX_ERR_LEN ); \ method_ex_viewer.ViewException( _TEXT("MFC"), static_cast<TCHAR*>( err_msg ) ); \ return E_FAIL; \ } catch (_com_error &e) { \ method_ex_viewer.ViewException( _TEXT("COM"), e.ErrorMessage() ); \ return E_FAIL; \ } catch (CAtlException &e) { \ const int MAX_ERR_LEN = 256; \ GBuffer<TCHAR> hr_code(MAX_ERR_LEN); \ ltoa(e, hr_code, 16); \ method_ex_viewer.ViewException( _TEXT("ATL"), static_cast<TCHAR*>( hr_code ) ); \ return E_FAIL; \ } catch (...) { \ method_ex_viewer.ViewException( "unknown", "" ); \ return E_FAIL; \ } \
and our exceptions are always fall into the catch (...) section.
There is some EnterCriticalSection()/LeaveCriticalSection() that occurs in SetFSCreator() method because of the fact that some global data is shared between COM-objects. It's is because we use very legacy code. Maybe the error is somewhere in interlocking, but why it's working in the ISAPI-mode?
We use _ATL_APARTMENT_THREADED. We tried to run ASP script with and without ASPCompat="true". We tried to run on .NET 1.1 and .NET 2.0. The song remains the same.
It's very hard to debug. Because these exceptions occurs in different places and after a long time of working.
Can anybody help us?
-- Danil
Dear Bruce,
thank you for your reply.
I try to use Marshal.ReleaseComObject(). I check the returm value and
it always equals to 0.
Exceptions are still here. The problem is that I don't know what to
catch. I don't understand what's happened. I afraid that something is
happened with the host aspnet_wp process.
There is anonther question. Is there a way to 'reboot' aspnet_wp
process sometimes? For example, one time for each 1000 requests. It can
help to avoid the problem, if we can't solve them. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Hector Villafuerte |
last post by:
Hi,
I have been using Python 2.3.4 with MySQL 4.0.16-max-nt (through
MySQLdb) for months. Today this messages showed up:
Exception exceptions.AttributeError: "'NoneType' object has no
attribute...
|
by: dadofgage |
last post by:
I have an application that was written in access and it is linked to
data on a microsoft SQL server.
I have no problems getting the data out of the database but if I want
to update the data, I...
|
by: RepStat |
last post by:
I've read that it is best not to use exceptions willy-nilly for stupid purposes as they can be a major performance hit if they are thrown. But is it a performance hit to use a try..catch..finally...
|
by: KC |
last post by:
Greeting all!
I have a problem that I'm hoping will be of interest to others here, and
maybe a solution will crop up. I appoligize for the message's length.
Now, I'm new to C# and .NET, so I...
|
by: Keith |
last post by:
All,
I have been told this is an ASP.NET issue and not an IIS
issue, so I am posting this here.
I have a problem with ASP.NET returning an HTTP 500 error
when trying to run ASPX pages on...
|
by: Ralf Gedrat |
last post by:
Hello!
I have some Vb.Net applications, which are terminated at indefinite times
without message.
If I call in the program regulated system.GC.Collect, then the program is
terminated here...
|
by: Shehab Kamal |
last post by:
In Main I register ThreadException to handle unhandled exceptions
Application.ThreadException += new
ThreadExceptionEventHandler(App_ThreadException);
The method will show a MessageBox or a Form...
|
by: robert |
last post by:
I get python crashes and (in better cases) strange Python exceptions when (in most cases) importing and using cookielib lazy on demand in a thread.
It is mainly with cookielib, but remember the...
|
by: Daniel |
last post by:
Hello!
I am having a problem with a windows application that abnormally terminates
itself. The application is a multi threaded .NET 1.1 application, and can
briefly be described as follows:
...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |