qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Ingham <David.Ing...@microsoft.com>
Subject RE: Error 1053 when starting any windows service that uses qpid client + COM CoInitializeEx
Date Tue, 15 Sep 2009 17:24:28 GMT
One of my Microsoft colleagues, Max Feingold, had some ideas...

-----Original Message-----
From: Max Feingold 
Sent: Monday, September 14, 2009 6:45 PM
Subject: RE: Error 1053 when starting any windows service that uses qpid client + COM CoInitializeEx

A few thoughts…  None authoritative, but based on some years of experience working in Windows.

There are a number of things one should not do in a ServiceMain.  Most can be summarized as
“don’t take too long”.

Among things that can take too long, starting another service is the canonical example - since
the SCM is waiting for you, it won’t start the other service until you’re done.  Instant

Sometimes you just do a lot of work on startup – no deadlock required.  In that case “we
need more time” should really be “defer work until later”.  So if you do need to do
something long-running during service start, don’t.  If you really, really need to, you
should make sure to call SetServiceStatus with SERVICE_START_PENDING, frequently.  This then
gives you the job of doing hang detection yourself, which is no fun.

Further, you need to remember that if your service is set to autostart, you will start up
with the OS.  This means that lots of stuff may not yet be initialized, or may be initializing
in parallel with you.  If you have a dependency on any such things (i.e. other services),
you need to declare a dependency explicitly in your service configuration.

CoInitializeEx is one of those things that IIRC may cause another service to be started (rpcss
and dcomlaunch, specifically).  So if it’s going to be used during ServiceMain, these dependencies
should be called out explicitly.  Similarly, any WMI work done in ServiceMain may require
specific service dependencies to be declared.

And with all this said, there’s no better way to debug this sort of problem than a process
dump showing the hang or crash in question.

-----Original Message-----
From: nicolae claudius [mailto:nicolae_claudius@yahoo.com] 
Sent: Tuesday, September 08, 2009 7:27 AM
To: users@qpid.apache.org
Subject: Re: Error 1053 when starting any windows service that uses qpid client + COM CoInitializeEx

This problem is only on Windows Vista, on XP works ok
I have made an windows service that uses qpid client libraries to comunicate with a server.
The service uses WMI to gather station usage information and send it to an upstream server.

I noticed that any windows service that uses qpid client libraries and simultaneously calls
CoInitializeEx(...) to initialize and use COM fails to start as windows service with the following

Error 1053: The service did not respond to the start or control request in a timeley fashion

Anyone has some advice on this ?

View raw message