Skip to main content
Inspiring
February 26, 2010
Question

Why is my CF9 service running invisibly?

  • February 26, 2010
  • 2 replies
  • 2999 views

Occasionally I've seen a strange situation where ColdFusion scripts are running normally, but the Windows Services manager shows "ColdFusion 9 Application Server" is stopped. This has happened after my monitoring script detected a problem and auto-restarted ColdFusion.

Can anyone tell me how this is possible, and what should I do about it? Other than rebooting, I haven't found any way to get the system back to normal.

Messages in the Event Log when this occurred are, for example:

02:28:39 The ColdFusion 9 Application Server service killed process with pid 1524

02:28:39 The ColdFusion 9 Application Server service for the "coldfusion" server was stopped.

02:28:40 Windows cannot unload your classes registry file - it is still in use by other applications or services. The file will be unloaded when it is no longer in use.

02:28:40 Windows saved user [SERVER]\[username] registry while an application or service was still using the registry during log off. The memory used by the user's registry has not been freed. The registry will be unloaded when it is no longer in use.

This is often caused by services running as a user account, try configuring the services to run in either the LocalService or NetworkService account.

02:30:07 The ColdFusion 9 Application Server service for the "coldfusion" server was started.  PID is 6560.

02:30:20 The ColdFusion 9 Application Server service for the "coldfusion" server is restarting.

02:30:22 The ColdFusion 9 Application Server service could not be started.  Check the server "coldfusion" log files for more information.

coldfusion-out.log shows: "coldfusion could not be started because it is already running."

I haven't seen this behavior when restarting ColdFusion manually, but I've noticed that using "Restart" in the Services manager typically fails. I need to stop ColdFusion, pause a few seconds, and then start the service again. My auto-restart script is programmed to do the same thing.

I'm running ColdFusion 9 Enterprise on Windows Server 2003 Service Pack 2, and the ColdFusion service runs under its own user account. The event log messages suggest that's part of my problem, but for security reasons, I don't want to run CF under the system account.

Thanks!

    This topic has been closed for replies.

    2 replies

    Inspiring
    February 26, 2010

    On Windows the ColdFusion Service consists of 2 applications: jrun.exe and jrunsvc.exe. jrun.exe is the application that answers requests from browsers. However, it is not really designed as a proper Windows service since it is more of a generic Java process. So jrunsvc.exe comes along as a so called service wrapper: it wraps around a jrun process and makes it into a service that plugs in to the MMC Services Control panel, starts when Windows starts, rotates logfiles etc. But the consequence of that design is that when Windows checks if the ColdFusion Service is running, it doesn't really check if the jrun.exe process is running, it checks if the jrunsvc.exe service wrapper is running.

    What is happening in your situation is that your monitoring application is restarting jrun.exe instead of jrunsvc.exe. When jrun exits, jrunsvc notices and exits too. Then your monitoring starts jrun.exe and your server repsonds to browser requests again, but Windows thinks the service is down because the wrapper is down.

    There is no real solution for this. You are just going to hae todecide to do all start / stop actions either on the jrun.exe level or on the jrunsvc.exe level. Mixing the two just is not going to work. And if you ever end up in this situation again, go to your Services Control Panel and kill all ColdFusion services, then go to the Task Manager and kill all jrun.exe processes. Then start the Windows Services again.

    BG650Author
    Inspiring
    February 27, 2010

    Thanks, Jochem, for the detailed answer! That clarifies some things, and it does seem that I can replicate similar behavior by starting the ColdFusion service and then using Task Manager to terminate jrunsvc.exe.

    Note, I'm not doing anything with jrun.exe directly. My auto-restart script uses the Perl commands Win32::Service::StopService( $Server, "ColdFusion 9 Application Server" ) and Win32::Service::StartService( $Server, "ColdFusion 9 Application Server" ).

    I think the problem comes down to this:

    Running ColdFusion under Local System account, when I stop the ColdFusion service, jrunsvc.exe does not quit until jrun.exe stops. This is normal, expected behavior, and with this setting I can successfully use "Restart" in the Windows Services Manager.

    But, running ColdFusion under a User account, when I stop the ColdFusion service, jrun.exe continues to run several seconds after jrunsvc.exe stops. In this case, using Windows Services Manager, "Restart" consistently fails. (Apparently my script is attempting to start ColdFusion at some critical point during those few seconds when jrun.exe is still running, causing the strange behavior I described previously.)

    This is true even if the ColdFusion user is an Administrator, so I don't think it's a matter of setting permissions correctly. I think it's a ColdFusion bug. Thoughts?

    One more question: When ColdFusion is in that state (jrun.exe is running but jrunsvc.exe is not), is there any graceful way to stop jrun.exe so that I can restart the service normally? I think using the task manager could potentially lead to some data inconsistency, but I suppose that goes for rebooting too.

    Participant
    April 5, 2010

    I experience your same issue with doing a "Restart" in the Services control panel. I have a script that stops the service, pauses for 5-10 seconds (I just use a ping command to simulate a pause) and then starts the service again.

    Similarly, on my development machine, I have a "Restart all services" script that stops and starts all the services, and I just make the ColdFusion 9 Application Server service be the first service to stop and the last to start. The delay of the other related CF services in between is enough of a delay to make it a non-issue.

    Josh

    February 26, 2010

    It is quite possible that the service control panel got desynced from reality.  I've seen it happen on occasion.  The panel will

    show it stopped, but task manager shows it running.  I've just killed the process manually and then started it up via the control panel.