Click to See Complete Forum and Search --> : Win32 Service Child Process dies on logout.


rrenomeron
July 16th, 2002, 05:09 PM
I've written a simple Win32 service which runs a java program via a batch file (using CreateProcess()) and waits for the java program (which is in an infinite loop) to die. The service, once started, runs until the user logs out, at which point the java process is terminated. This happens even when the service is started before the user logs in (i.e. Automatic startup type).

I can't kill the java process using the task manager (which is the way it should be), which makes me believe it's running in the same environment as the service process itself. But does anyone know why the java process gets killed on logout? A couple of hours searching MSDN and the Knowledge Base turned up an article on running OS/2 apps from a service (from 1995 no less!), but little else.

My current workaround for this is to have the service simply respawn the java program when it dies (unless the service is explicitly stopped by the Service Control Manager), but I would like to have a more elegant solution.

Any suggestions or wild theories would be appreciated.

Bob Davis
July 17th, 2002, 11:05 AM
I don't really have any good solutions for you, but you may want to try this question over in the Visual C++ forum. It's more geared toward Windows development, so you may get more help there.