[Looking for Charlie's main web site?]

CF911: Tips for dealing with Windows service timeout, useful when CF's taking too long to stop/start

Note: This blog post is from 2011. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
In my last entry, CF911: Is your ColdFusion service taking too long to shut down? Find out why, I discussed the first of a two part answer to helping people who are finding that sometimes ColdFusion takes too long to shut down (or startup). That one talks about how to find out where CF may be logging info to explain why it's taking so long.

In this second entry, I'll address the separate but related problem, particularly if you're running CF as a Windows service, that you may find you get timeout errors from the Windows Services panel itself. I'll share some tips to help with that, which I share often with clients of my independent consulting as a CF troubleshooter.

The first thing to understand is that there is indeed a timeout (configurable) for how long the Windows Services control panel is willing to wait. Beyond that, though, there are some 3 more tricks you can use to avoid that timeout. (And I would say again that sometimes you really want to focus instead on WHY CF is taking so long to startup or shutdown, but until you do, the following info may help give you some breathing room.)

[....Continue Reading....]

Comments
usually if CF wont stop/restart then increasing the service timeout wont help much, it simply wont ever get there.
The solution is actually really simple. If the service seems like it is not going to restart before it times out Just open the task manager and kill jrun, the service will then restart successfully.
Russ, did you read the previous note? I explained there (and pointed to it as preface to this) that you CAN in fact often find out why CF won't stop. That was the whole point of the last note, so I disagree that taking these steps to let it shutdown "won't help much".

Anyway, yeah, I realize one COULD kill the task. I assumed people knew that. This entry was a follow-up to the last, explaining how one could let it shutdown (despite the services timeout issue) if you wanted to.

But just to avoid any more confusion, I've just updated the entry to make that clear and credited you for making the pointing.
sorry if I missed something, I will note though while you would assume "folks know this", it isn't always true, I have actually pointed this out to a fair number of people who moaned about the CF service taking too long to restart, even people who do hositng :-)
# Posted By Russ Michaels | 10/21/11 4:50 AM
Fair enough. Like I said, I have updated the note already to make that point and give you due credit for the reminder. Thanks.
I created a batch file to stop and start the CF service when I know it has hung/crashed. I don't have to use it often, but it took a minute to type it up and saves a minute or so when I have to do it.

In case you don't know the command prompt command it is
net stop "coldfusion 9 application server"
net start "coldfusion 9 application server"

the quotes didn't seem to always be required, but they never hurt to have them there.
# Posted By matt | 10/27/11 9:04 PM
Yep, Matt. Good point. In fact, I covered that above (in the entry), in "Tip 4: Consider not using the Services Panel at all". :-)

I know: perhaps too much info to read it all. :-)
I should add that since writing that entry, I have since learned that there is an available argument that can be specified for the jrunsvc command, which controls the service used for CF. There are starttimeout and stoptimeout args, which seem to have defaults of 4 and 2 minutes, respectively. See the JRun release notes for more about this:

http://www.adobe.com...

If the other info above doesn't help with an unexpected problem of timeouts during startup or shutdown, consider this (whether the impact of the defaults, or the prospect of modifying these values.)
I have a CF 9.0.1 Standard server running on Windows 2003 that will occasionally hang. When I have restart it, I try to use the tips outlined in this article to speed things up; but it consistently takes up to 5 minutes for the service to start back up successfully. I have another, nearly identical server hosting the same version of CF, and it usually only takes 30 seconds for the CF service to restart on that server.

What would account for the huge amount of time required for CF to re-start on one of my servers, but not the other?
# Posted By Michael | 1/21/13 4:28 PM
FYI,
ServicePipeTimeout has nothing to do with killing a service. It has to do with the start-up process and tells the service manager to wait the specified amount of time before giving error (7000 etc ...) that something couldn't start or whatever because something else didn't start. If you have something that starts a little slow you increase the variable in SPT to 60 or greater to tell the service manager to chill. This only pertains to the starting side of a start or restart not the shutting down.
# Posted By michael clyde | 2/17/15 6:47 AM
@Michael, thanks for your attempt to clarify. But you refer to "servicepipetimeout" when nothing else in the blog entry or comments do, so can you clarify what specific point you were referring to? I'm not denying you have a point.

And I will admit I may have gotten something wrong (if you are referring to something in the blog entry or a comment from me), but I am not seeing the immediate connection (and at the moment I haven't the time to reread the blog entry, from 2011, and all the comments) to try to connect those dots.

Thanks.
Hey Charlie,
This article is about Service Control Panel timeouts and about killing a service faster. (in this case, CF when run as a service) In the (second) paragraph of 'Tip 1' you state
[QUOTE]
And technically, you should be able to control that timeout via a registry key, called ServicesPipeTimeout, which is discussed in this Microsoft technote and defined in HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control.
[END QUOTE]
The Service Control Manager (SCM) controls the starting/stopping of services. The above mentioned SystemPipeTimeout ONLY controls a STARTUP timeout before the SCM will issue an error for a slow or non starting service. That is why, as you stated, you could not get it to work on several different machines because, the reg key solution you were trying has NOTHING to do with shutdown timeout errors or the Service Control Panel's speed at which it kills services. As for the speed that services are killed, that is controlled by the "WaitToKillServicesTimeout" that you said "is NOT related to this discussion".

So, I'm sure you can see my 1st comment WAS actually referring to something in your article, namely Tip 1 and consequently what my point would be that you were asking about.

michael clyde
# Posted By michael clyde | 2/18/15 6:30 AM
@Michael, thanks for clarifying. I don't know if you can tell the source of my initial confusion over your last comment, but in it you referred to it as ServicePipeTimeout (singular) and that's what I'd searched for. (I mentioned I didn't have time to closely reread the entry, and since I'd written it 3+ years ago, I couldn't recall all I'd said.)

So thanks for connecting that dot. And thanks again for trying to help clarify where you feel I was mistaken regarding that. I have now reread the blog entry, and your comments. I still think we're not on the same page. Since you want to make your points clear, let me respond to them.

Your first comment says this ServicesPipeTimeout setting "has nothing to do with killing a service". Well, I didn't say it did. Instead I referenced an MS article which said that value "represents the time in milliseconds before a service times out". And I was discussing it in a section entitled, "There is a timeout set for how long the Windows Services panel will wait". So I was not talking about "killing a service".

i then pointed out in the same section an available WaitToKillServiceTimeout registry entry, and that does refer to "killing" a service, but I noted that it was "NOT related to this discussion". And you reference this later, so I'll get back to that in a moment.

So I guess I'm wondering first what led you to comment that I was asserting the ServicesPipeTimeout DID kill a service. It seems I did not.

Second, you conclude your first comment saying that this setting "only pertains to the starting side of a start or restart not the shutting down." OK, we're on the same page there. The blog entry begins "Tips for dealing with Windows service timeout". I was indeed focused on "the starting side of a start" as well as the stopping.

Your next comment now says that you feel this blog entry is "about killing a service faster". Well not quite. Again, it was about understanding why a service may not start/stop when you expect it should, and some possibilities related to that.

Then you clarify in this second comment that the ServicesPipeTimeout setting "has NOTHING to do with shutdown timeout errors". Well, again, I didn't say it did. Even having reread things now, I just don't see me saying what you say I am.

As for my having "tried it on multiple machines" and "not finding it to work", I was referring to its control of the time for how long it takes the service to start, in the control panel. Again, I wasn't saying it had anything to with "killing" the service. It's a subtlety, but I just want to clarify what I was saying.

Now, I gather you have a sincere concern about misinterpretation of this setting, and fair enough. I just don't see anything I need to change, but if you (or anyone else reading this) sees something I did misstate, do let me know and I'd change it.

BTW, you switched to referring to "SystemPipeTimeout" but I assume you meant ServicesPipeTimeout.

That said, you also say that this "has NOTHING to do with shutdown timeout errors" and " ONLY controls a STARTUP timeout before the SCM will issue an error". Are you sure it doesn't cover both starts and stops of a service? Even if it does control only one of them, I don't see that changing what I said, but if it does control both, then it would change what you said.

Again, I'm just trying to be as clear as you, for the sake of those reading along.

And in fact, you conclude saying that "As for the speed that services are killed, that is controlled by the "WaitToKillServicesTimeout". Well, hold on there. First, again to be clear, that's NOT to be pluralized. It's WaitToKillServiceTimeout. (I'm not picking on you, it's just that it really would help readers for us both to be as clear on these things as possible).

Second, though, I said it's "not related to this discussion" because according to the docs I read (and point to when I referenced it), that affects how long Windows is willing to wait when it, Windows, IS SHUTTING DOWN, and is trying to stop services in that process, before it will just kill a service that's taking too long to stop properly. And that does indeed have "nothing to do" with this discussion about "Tips for dealing with Windows service timeout", in the context I have presented this topic.

If you feel I still have said something wrong, after these clarifications, let me know. I'm open to correcting mistakes. If you just read things differently than I now show I wrote them, and you want to let it be, that's cool too. I'm open to dialogue and want to put further accurate information. Thanks for your points of clarification.
If chaning of the reg-value has no effect, this worked out for me:
https://adminsissues...
# Posted By Amos | 1/25/16 9:20 AM
Copyright ©2024 Charlie Arehart
Carehart Logo
BlogCFC was created by Raymond Camden. This blog is running version 5.005.
(Want to validate the html in this page?)

Managed Hosting Services provided by
Managed Dedicated Hosting