[python-win32] Problems starting services - any advice?

David London david.london at sentai.com
Mon Dec 3 23:50:48 CET 2007


On Monday 03 December 2007 3:21:06 pm Tim Roberts wrote:
> David London wrote:
> > Hello all,
> > I'm encountering some strangeness when running my python code on a
> > windows machine and I was wondering if anyone had any advice,
> >
> > I have a number of python services (8) that run on a client machine,
> > monitoring various database tables or folders, doing something with the
> > data, then sleeping for a given amount of time and repeating.
> > Normally, I have installed and run these services as "local system" and
> > they have worked without any problems.
> > For the latest client, they have asked that we run all of the services as
> > a specific user. This is where I'm running into problems.
> > When I attempt to start the 8th service, it gives me an error (error
> > 1053: The service did not respond to the start or control request in a
> > timely fashion). It doesn't matter what order I start them in, the eighth
> > service always fails to start. And if I change the service back to run as
> > "local service" it runs without problem.
> > I'm pretty sure that this is not a windows specific problem, since I can
> > create another user (with the same permissions) and when I attempt to
> > start the service it gives me the same error.
>
> Why does that make you think it is not a "windows specific problem"?

Because I didn't consider memory issues when I was thinking about the cause of 
the problem. 
>
> > It appears as if there is some internal limit on the number of services
> > that pywin can handle.
> >
> > Has anyone else encountered this? Or have any advice on where I could
> > look to see what errors are being generated? I can not find any logs or
> > error messages when the services fail to start.
>
> This is not a Python issue.  It turns out to be a Windows issue.
>
> Every service that runs with a real user ID gets its own "desktop",
> separate from the console desktop.  Each desktop gets a chunk of heap
> space for all of the applications running on that desktop, carved from a
> global desktop heap.  The size of each heap is about 3MB, but  the
> global heap has a non-configurable size of 48MB.  Those were the numbers
> as of Windows 2000, although it sounds like they aren't that much
> different now.
>
> In the old days, you used to be able to adjust the size of this heap by
> tweaking a registry entry:
>     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
> Manager\Subsystems
> In the "Windows" value, there's a parameter like
> "SharedSection=1024,3072".  The suggestion is to change that to
> 1024,3072,512.  However, on my XP SP2 machine, that's already what it says.
>
> Do your services need to interact with the user?

The services never interact with the user. 
So, it's sounding like I'm just going to have to tell the client that the 
services need to run as "local service".

David




More information about the python-win32 mailing list