Re: Windows Service & ADO problem



Allen wrote:


Thanks for the thoughts, however the problem occurs on machines
without iLO cards too. I reviewing the detailed logging that I have
incorporated this OS corruption only occurs when the service stop code
that includes the call to CoUninitialize is never called.


ah, it seems we are narrowing this down... maybe the problem is not the
unfreed components.

As ADO is based on COM it needs to call coInitialize to initialize its
library for the current thread. Well, actually Microsoft recommends to
skip coInitialize and use coInitializeEx instead so that you can
specify the concurrency model.

Anyway, if you don't call coUninitialize there is a lot of things not
done. As stated in MSDN:

[coUninitialize] "Closes the COM library on the current thread, unloads
all DLLs loaded by the thread, frees any other resources that the
thread maintains, and forces all RPC connections on the thread to close"

It also may be a problem with MDAC or COM corruption/bug. There is an
MDAC component checker:

http://msdn.microsoft.com/data/ref/mdac/downloads/

Don't know if there is anything similar for COM. I would also recommend
to check if you have the latest MDAC version.

silly question but is there a way to ensure that a particular service
is shut down before all others in the OS? maybe some dependency or
another?

if the OS is closed gracefully you can make your app react to close
messages from the system and free/unload anything you need. However you
won't have direct control over it. If the OS simply dies because the
power is gone not AFAIK

--
Best regards :)

Guillem Vicens Meier
Dep. Informática Green Service S.A.
www.clubgreenoasis.com
--
Contribute to the Indy Docs project: http://docs.indyproject.org
--
In order to contact me remove the -nospam

.



Relevant Pages

  • CoUninitialize() and CComPtr<> object lifetimes
    ... I have tracked down a bug involving object lifetimes to a quirk in CComPtr<> ... help that CoInitialize() is being called somewhere in the app framework. ... CoUninitialize(); ... What is going on with this DLL? ...
    (microsoft.public.vc.atl)
  • Re: Calling Coinitialize
    ... > Delphi 5 C/S compiled programs and use ADO. ... > the dll's doesn't seem to help) and then it will immediately crash ... not calling coInitialize and coUninitialize at all. ...
    (borland.public.delphi.database.ado)
  • Re: Question Error Access violation in CoUninitialize() call
    ... Success = false; ... CoInitialize may fail and if it does, ... CoUninitialize. ... If you decide you should be calling CoInitialize, ...
    (microsoft.public.win32.programmer.ole)
  • Re: Question Error Access violation in CoUninitialize() call
    ... CoInitialize may fail and if it does, ... If you decide you should be calling CoInitialize, ... fails, do not call CoUninitialize. ... released all interfaces before calling CoUninitialize. ...
    (microsoft.public.win32.programmer.ole)