[python-win32] Service does not start at windows boot but at user's login

bob gailer bgailer at gmail.com
Thu Jun 5 02:15:45 CEST 2008


stephane.poirot wrote:
> Good morning,
>
> I'm currently building an application which involves two different 
> processes : one is a service and the other one is a simple client.
> My client starts at user's login and the service should start at 
> windows boot. I say 'should' because it seems that the service
> actually starts at user's login too : I put logs in the event log and 
> I noticed that the service starts almost 7 to 10 seconds after
> the client, which is not what is expected. Service's properties are : 
> run automatically on System account, no dependencies.
> The code of my service is based on the one found in the book : 
> Oreilly, Python Programming on Win32, at chapter 18.6 :
> Sample Service Written in Python.
>
>
> Furthermore, my two processes communicate through a named pipe, and 
> the problem aforementioned involves that the communication is not 
> possible : indeed, the service, who should start before the client, 
> creates the pipe and waits for a client connection. Client has just to 
> open  the pipe to connect. But obviously if the client starts before 
> the service, an error occurs because no pipe is created so far.
>
> I did a lot of searches to solve this problem, but haven't found any 
> issue yet.
> I first thought that  the problem came from pythonservice.exe, which 
> hosts my service : it may take longer time
> to load than common other windows services. That's why I converted my 
> service into a .exe thanks to py2exe. Then the path in service's
> properties has changed to this executable. But the problem remains : 
> service still starts after client.
> However, the problem only occurs at first user's login after machine's 
> boot : if he disconnects and somebody connects after, without reboot, 
> the service is still running, which is normal.

I run Windows 2003 Server with automatic logon. It seems to me that some 
services are started after the logon. I base this on noting that I get 
the Some Services Did Not Start alert many seconds after my desktop has 
appeared.

Could the client repeatedly try connecting with some reasonable delay 
between connection attempts?

-- 
Bob Gailer
919-636-4239 Chapel Hill, NC



More information about the python-win32 mailing list