Automatically restart Coldfusion service when it goes down [duplicate] - coldfusion

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How to restart Coldfusion Application Server when application is timeout?
Currently I have an ColdFusion application that causes server issues. After 1-2 days that serve doesn't respond until a manual restart is done.
I know that I had to find what is going wrong in my scripts and I spend time and time for several weeks.
But pending I would make a script that restart automatically ColdFusion service if it is bugged.
I have not many knowledge in batch script etc.. but I guess that the test would be a request to a .cfm and the response would be serve until a timeout. ?
Has anyone ever met a script like this ?
Config: Win 2k8 Server R2 - Coldfusion 9(.0.0)
Thank you

Two things here
The real way is to fix the issue and you can do that with Fusion Reactor - http://www.fusion-reactor.com/fr/ It will help you monitor and restart and self heal as it needs.
You could create a batch file, and create a Scheduled Task in Windows that ran it.
Using Net Start / Net Stop Commands
net stop "Macromedia JRun CFusion Server"
net start "Macromedia JRun CFusion Server"
Thought this may not always work so I have a batch file:
c:\JRun4\uninstall\KillJRun.exe
net start "Macromedia JRun CFusion Server"
Which works for me.

Your best bet is to use Pingdom or another server monitoring tool. When the server goes down (responds with a 503 error, service unavailable) you may be able to have Pingdom send a response to a PHP script on the server that calls a batch file. I am not sure if Pingdom supports pinging another server is one is down, but you could have Pingdom email to an inbox that your PHP can check every few minutes.
This may end up being more work than figuring out what is wrong with your script though.
Edit: You may want to look at this question. This will only work if the service has stopped, whereas usually when a script crashes ColdFusion it is hanging. If you run the script that crashes the server, then look at the service, if it says stopped, then this may work for you.
The other thing that I would check is the JVM memory. Often times crashes are due to processing large amounts of data from files or the database and the JVM doesn't have the memory to do that.

Nope. It cannot be restart automatically when your CF services/server is hanging. The only one way is to restart by windows schedule.

You could also use Nagios+Plugins to fire a restart script when the service hangs. But following the previous advice & finding out what the problem is is your best bet.

Related

Suddenly scheduled tasks are not running in coldfusion 8

I am using Coldfusion MX8 server and one of the scheduled task was running from 2 years but now suddenly from 01/12/2014 scheduled tasks are not running. When i browsed the file in browser then the file is running successfully without error.
I am not sure is there any updatation or license expiration problem. I am aware that mid of this year Adobe closed the support for coldfusion 8.
The first most common problem of this problem is external to the server. When you say you browsed to the file and it worked in a browser, it is very important to know if that test was performed on the server desktop. Knowing that you can browse to the file from your desktop or laptop is of small value.
The most common source of issues like this is a change in the DNS or network stack that is interfereing with resolution. For example, if the internal DNS serving your DMZ suddenly starts serving the "external" address - suddenly your server can't browse to your domain. Or if the IP served by the server for the domain in question goes from being 127.0.0.1 to some other IP that the server can't acces correctly due to reverse proxy or LB or some other rule. Finally, sometimes the Apache or IIS is altered so that an IP that previously was serviced (127.0.0.1 being the most common example) now does not respond.
If it is something intrinsic to the scheduler service then Frank's advice is pretty good - especially look for "proxy schduler" entries in the log - they can give you good clues. I would also log results of a scheduled task to a file. Then check the file. If it exists then your scheduled tasks ARE running - they are just not succeeding. Good luck!
I've seen the cf scheduling service crash in CF8. The rest of CF is unaffected.
Have you tried restarting the server?
Here are your concerns:
Your File (works since you tested it manually).
Your Scheduled Task (failed).
Your Coldfusion Application (Service) (any changes here)?
Your Server (what about here).
To test your problem create a duplicate task and schedule it. Leave the other one in place (maybe set your new one to run earlier). Use the same file too. See if it completes.
If it doesn't then you have a larger problem. Since the Coldfusion Server sits atop of the JVM there could be something happening there. Things just don't stop working unless something got corrupted or you got compromised. If you hardened your server by rearranging/renaming the file structure to make it more secure...It would break your task.
So going back: if your test schedule works then determine what is different between the two. Note you have logging capabilities. Logging abilities for CF8
If you are not directly incharge of maintaining this server, then I would recommend asking around and see if there was recent maintenance, if so, what was done to the server?

jetty 404 error page on hot deployment

I am currently using Jetty 9.1.4 on Windows.
When I deploy the war file without hot deployment config, and then restart the Jetty service. During that 5-10 seconds starting process, all client connections to my Jetty server are waiting for the server to finish loading. Then clients will be able to view the contents.
Now with hot deployment config on, the default Jetty 404 error page shows within that 5-10 second loading interval.
Is there anyway I can make the hot deployment has the same behavior as the complete restart - clients connections will wait instead seeing the 404 error page ?
Unfortunately this does not seem to be possible currently after talking with the Jetty developers on IRC #jetty.
One solution I will try to use are two Jetty instances with a loadbalancing reverse proxy (e.g. nginx) before them and taking one instance down for deployment.
Of course this will instantly lead to new requirements (session persistence/sharing) which need to be handled. So in conclusion: much work to do in the Java world for zero downtime on deployments.
Edit: I will try this, seems like a simple enough solution http://rafaelsteil.com/zero-downtime-deploy-script-for-jetty/ Github: https://github.com/rafaelsteil/jetty-zero-downtime-deploy

CF Service continuously restarts every 25 seconds

After my laptop froze yesterday I rebooted, and now the ColdFusion 9 Application Server service starts and restarts endlessly! Although it's set to start automatically, upon bootup it does not start. So I start it manually. Then I look at the Windows Event Viewer which reports:
The ColdFusion 9 Application Server service for the "coldfusion" server was started. PID is 5788.
That's good. But then, about 9 seconds later, Event Viewer reports:
The ColdFusion 9 Application Server service for the "coldfusion" server is restarting.
16 seconds later, the Event Viewer reports that the service has, in fact, started again. And 9 seconds after that, it reports that the service is starting again.
Unless I manually stop the service, this cycle continues, with the CF service restarting itself every 25 seconds, give or take a second. Needless to say, I can't use ColdFusion. When I try to reach a page, I get error 500: There is no web application configured to service your request
I am running the developer edition of CF9, Windows. Computer behaves normally otherwise.
[Edit]
The coldfusion-out.log includes this:
Server coldfusion ready (startup time: 9 seconds)
A fatal error has been detected by the Java Runtime Environment:
EXCEPTION_IN_PAGE_ERROR (0xc0000006) at pc=0x6d6e2424, pid=5456, tid=7724
JRE version: 6.0_17-b04
Java VM: Java HotSpot(TM) Server VM (14.3-b01 mixed mode windows-x86 )
Problematic frame:
C [nio.dll+0x2424]
An error report file with more information is saved as:
C:\ColdFusion9\runtime\bin\hs_err_pid5456.log
If you would like to submit a bug report, please visit:
http://java.sun.com/webapps/bugreport/crash.jsp
The crash happened outside the Java Virtual Machine in native code.
See problematic frame for where to report the bug.
The detailed error report, C:\ColdFusion9\runtime\bin\hs_err_pid5456.log, has a ton of information, but I don’t understand much of it. I’ll be happy to post it all if you think you might be able to make heads or tails of it.
In the event that the only solution is to reinstall CF, can you tell me where to find the config files? I know I will need jrun-web.xml (and I know where it is), but where, for example, are the datasource definitions found? I can’t seem to find any folder or file with the settings from the CF Admin. (The CF Admin won’t run, so I can’t view them that way.)

How to Stop A ColdFusion MX-7 Scheduled Task that has already started

I inherited a coldfusion MX7 application that has a long running process, which the user kicked by accident.
By my calculations, at the current rate, the job will run for 3 days.
There doesnt seem to be a way through the administrator interface to stop a job that is running.
The table that is being filled can be easily repopulated, so I would think stopping the coldfusion service wont effect anything except the table, which isnt a problem.
Am I right? Is that safe? Is there another way?
a one-time restart of the service should be fine. for the future, you may want to add a required url param or other such safety mechanism to keep this long process from accidentally going off.
Check to see if the task already has an explicit timeout out set
Explicit Timeout
Otherwise the default page time out is used
Server Settings
For newer versions of ColdFusion 8 and above, you can kill a running page with with the Server Monitor in the section labeled "Aborting unresponsive or troublesome requests/threads"
Using server monitor.
It also may be possible to stop the processing by killing the SQL Server Task:
Is there a task manager of sorts for SQL Server 2008 and on?

Service blocks windows startup

We have automatically started service which in some cases spends a lot of the time loading necessary data, let's say 10 minutes. During this time it works as expected (processing some huge data files required to start). I report the progess by C++ SetServiceStatus function, it is working fine.
This service is not dependent on anything and has only one dependency which is again our own service. It is started after those 10 minutes, it needs the first "server" service to be fully running to accept the requests.
I thought that windows would start all other automatic services (in less then 10 minutes as usually) and then start working normally but system is completely blocked during startup (i can't login to computer or ping the computer) until this one specific service is started (reports SERVICE_RUNNING by SetServiceStatus). When out service completely starts, the other missing system services (required for network, remote desktop, whatever, it's quite random) are also started. Is this normal behaviour? Why are non-depending processes (as remote desktop, network connections, etc.) waiting for this process? Am I missing something?
I tried to add some dependencies to postpone the startup of my service but I ended up with many dependencies and behaviour still somehow random (as order of services is random). Sometimes I was able to login but for example Start button started working only after those 10 minutes when my service was started. I am not sure what is "the last service" to depend on and what services to include to my depend-list and on some computers this services can be disabled and it can bring new problems... so I don't like this solution very much.
Another option was Delayed start option for our service. This should start service when all other automatic services are running. Well, this works fine, windows boots, computer running and responding, our service is started, but the performance is very bad, many times slower than usually, it seems that delayed started services have much lower priority or something like that.
My only current solution is to report to system that my service is running (by SetServiceStatus function), but to continue loading (this works, I tested it). But then we have problem with our dependent service as it needs to be started when the first one is really ready. It can be solved but I still wonder how is this possible and if there is something I could use to keep the current state of automatic started service which reports "started" when it is really fully started and prepared to work. Thanks for any ideas.
Set SERVICE_RUNNING as soon as possible, and then continue processing in background. Make your other service resilient to the first service being in a running state, but not yet ready to service.
The longer the service is in the starting state the more problems we get from different windows versions.