The Core Technologies Blog

Professional Software for Windows Services / 24×7 Operation


Your Windows Service Says “Running,” But Is It Actually Working?

Your Windows Service Says Running, But Is It Actually Working?

A green “Running” status in Services.msc can be very reassuring. Indeed, it means that your service’s executable is still active.

But it’s NOT proof that your application is healthy — serving requests, processing jobs or accepting connections.

The truth is that even though a Windows Service is technically running, it can still be utterly useless. A lifeless zombie, dead on its feet.


The most frustrating kind of outage

Application crashes are never welcome.

But in the spectrum of failures, a clear, unambiguous crash (where the process dies) is the easiest to deal with. That’s because it’s relatively straightforward to determine when a process exits and react accordingly.

It’s far more difficult to catch failures when the service is still running but not doing its work. Conventional monitoring tools tell us that everything is fine, yet the service is actually down because customers cannot complete the tasks they need to perform.

The result? Prolonged, frustrating outages.


Common examples of “running but not working”

If we define failure as “not working”, there are a variety of ways a running Windows Service can fail.

For example, users will complain loudly when:

  • A network service accepts a connection but never returns a response.

  • A queue processor is alive but no longer consuming messages.

  • A database service is running but cannot accept useful work.

  • A web server accepts HTTPS requests but always responds with a 5XX error.

  • An integration service has lost access to a remote dependency.

  • A backup service stops uploading files to the cloud.

You can probably think of other scenarios as well.


Why Windows cannot always see the problem

Windows can easily determine whether your service has started, stopped or reported a status. It can even detect when your service process crashes — and quickly restart it.

But that’s the limit of what the operating system can do. It cannot automatically know whether every application-specific business operation is succeeding.

Keep in mind that the Windows Services system is built to manage a wide range of applications. The recovery functionality is very generic because it must support anything a programmer can dream up.

And because of that general-purpose approach, Windows doesn’t even attempt to understand how your program works. The result is that Windows never checks if your service is actually doing its job.


Service Protector checks the work, not just the process

Fortunately, Service Protector closes the gaps.

Instead of just checking if the process is alive or not, Service Protector digs in and confirms that your application is actually doing its job.

For example, Service Protector can check:

  • Is your service using too much memory or CPU?

  • Is a drive letter mapped and accessible?

  • Was a special file updated recently?

  • Is a network server accepting TCP/IP connections?

  • Is a web server responding properly?

  • Is an important/helper program or service running?

  • Does your service have one or more network connections open?

  • Was an adverse Windows event reported while your service was running?

  • Does your service have too many operating system handles open?

And if none of those work for you, extend Service Protector with a custom health check — a probe that works for your unique situation.


Example #1: Automatically restart your service if it’s using too much memory

If your service is a memory hog, have no fear. Service Protector will calculate the executable’s memory usage every few seconds and promptly restart it if it exceeds a specific threshold.

Just enter the threshold and you’ll be good to go:

Set the memory threshold for your service

Example #2: Automatically restart your service if it has no open network connections

Are you running a Windows Service that must always be listening for connections?

If so, Service Protector will periodically scan your server and recycle it if it’s not accepting connections.

Install a “network connections” sanity check to do the trick. Start by entering what kind of network connections are expected:

Check that your service always has a network connection

Afterwards, enter how often Service Protector should check your server and you’ll be all set.


Try Service Protector completely free for a month — no strings attached

Download the free 30-day trial and put Service Protector to the test yourself, in your unique environment. Setup takes a couple of minutes, and you’ll know soon if it’s what you need.

For Windows 11/10 & Windows Server 2025/2022/2019/2016
  • 100% compatible with all current versions of Windows
  • No signup necessary
  • No credit card required
  • No advertising of any kind
  • Easy uninstall if it doesn’t solve your problem
Posted in Service Protector | Tagged , , , , , , | Leave a comment

AlwaysUp Feature Spotlight: Set Your Application’s Priority

AlwaysUp Feature Spotlight: Set Your Application's CPU Priority

What’s the “set priority” feature? Why would I use it?

Is AlwaysUp running an important, CPU-hungry application for you? Does that application deserve more resources than other programs on the machine? If so, you’re in luck because AlwaysUp can speed up your mission-critical app by giving it more CPU cycles.

But before we dig into how to do that in AlwaysUp, let’s explore the Windows technology behind the feature.

How Windows runs applications

Windows is a multi-tasking operating system, where your machine’s CPUs are shared between all the programs running on your computer. Behind the scenes, each program gets a periodic slice of the CPUs as Windows cycles through them all.

By default, all programs are treated the same and the CPUs are allocated equally between them. For example, if there are a 100 programs running, each is offered 1/100th of the CPUs over the course of a minute.

But Windows understands that not all programs are equivalent. Some deserve more of your computer’s precious CPU cycles, while others need less.

To support those differing needs, Windows offers a flexible CPU scheduling priority system. With that, you’re able to tell Windows if your application needs more CPU, or less.

AlwaysUp taps into the Windows scheduling system, making it possible for you to tailor your application’s CPU use as it runs as a Windows Service.

Why set my application’s priority?

In general, you do it to make your AlwaysUp application run faster.

And why not give your program a boost — especially if it’s the most important application running on your computer?

We’ll show you how adjust priority in the next section.


How do I set my application’s priority in AlwaysUp?

You can set your application’s CPU priority on the General tab:

Set your application's priority in AlwaysUp

Select the best value for your application from the dropdown menu:

The application priority values in AlwaysUp

Here’s what each option will do:

cpu Idle (only runs when the computer is idle)

Your application will only be assigned a CPU when no other program needs it. That is, only when the computer is idle.

This setting is great for background tasks that should always defer to programs.

cpu Below Normal

Your application needs regular CPU cycles but it’s OK if other programs take most of the CPU. “Below Normal” is appropriate for low-priority tasks that are happy to wait while normal activities take precedence.

cpu Normal

“Normal” is the default priority and most applications run at this level. Windows will allocate a fair and balanced amount of CPU to ensure that your application makes steady progress.

cpu Above Normal

Windows will assign your application a bit more CPU than normal — but not so much that it “starves” other applications.

This is a safe choice if you want to provide a moderate boost for your application.

cpu High

When you select “High”, Windows will move your application to the front of the line and give it the CPU whenever it can use it. That will certainly boost your application but it may prevent other, lower priority applications from running.

cpu Real-time (highest – use with caution)

Set your application’s priority to “Real-time” in the rarest of circumstances. That’s because it’s the highest level and Windows will schedule you application ahead of vital system tasks, and that can lead to unwelcome behavior.

Keep in mind that while AlwaysUp provides the real-time option for completeness, we’ve never come across a real-world situation where it was the answer. Caveat emptor.


What are your best tips for setting CPU priority?

Tip #1: “Above normal” is enough for most applications

If you’re running an important application that should take priority over others, we recommend boosting priority to “Above normal”.

Doing so will ensure that your app takes precedence over all regular applications — but not at the expense of critical operating system functions.

You probably don’t need to go all the way to “High” priority, and almost certainly never to “Real-time”.

Tip #2: Consider limiting your application to specific CPUs too

In addition to setting CPU priority, AlwaysUp can also run your application on specific CPUs. You may find that level of control helpful when you’re managing many applications and need to constrain how CPUs are assigned.

You can find the CPU assignment controls on the Extras tab:

Set which CPUs your application should use

Just pick one or more CPUs and you’ll be good to go.


Posted in AlwaysUp | Tagged , , , , | Leave a comment

AlwaysUp Feature Spotlight: Stop Trying to Restart a Failing Application

Stop Trying to Restart your Application

Why should AlwaysUp stop trying to restart my application?

Let’s be clear: AlwaysUp’s primary job is to make sure that your program is always running. At its core, the software will do everything in its power to prevent prolonged downtime, which can be costly to you and your team.

But even so, there are times when AlwaysUp isn’t able to fulfill its noble mission. And in those rare scenarios, it may be best to fail gracefully instead of continuing to fight an unwinnable battle.

Let’s explore the issue through an example.

Example: A critical network drive vanishes

In this scenario, you’ve already installed your program as a Windows Service with AlwaysUp. Even though it’s running on the PC in your cubicle, the executable sits on a network drive hosted by the file server in your office.

Overnight, a power surge knocks out the file server. It’s completely dead. Your IT team will have to restore it from a backup later that day.

Luckily your PC is still working. When it roars back to life, AlwaysUp immediately tries to start your application. But since the executable sits on the recently departed file server, AlwaysUp fails to start it. The error looks like this:

AlwaysUp fails to start a network application

Undaunted, AlwaysUp will try again — and fail again. In fact, it will keep trying every second, thousands of times, filling up your event logs and not getting anything done. It’s the very definition of beating a dead horse, until you arrive at your desk and manually stop AlwaysUp.

To avoid that futile cycle, you should configure AlwaysUp to give up after a while. We’ll cover that prudent safety net in the next section.


How do I tell AlwaysUp when to give up restarting?

The mechanism is simple. Instruct AlwaysUp to stop trying to restart your application and exit if it fails several times over a given period.

The controls are on the Restart tab:

Set when to stop restarting a failing application

By default, AlwaysUp gives up if it fails 5 times in 1 minute. That’s proven to be a good safety net for many customers but please feel free to tune the values for your specific application.

Understand that once it hits the threshold you’ve defined, AlwaysUp will shut down. The Windows Service created to manage your application will stop. You’ll see an error like this in the activity report:

AlwaysUp logs an error when it gives up restarting

After you fix the underlying problem, you’ll have to manually restart AlwaysUp (or reboot your computer) to run your application as a service again.


What are your best tips for using the stop-restarting feature?

Tip #1: Set up email alerts to tell you when AlwaysUp gives up

If you’d like to be notified when AlwaysUp stops trying to restart your application and shuts down, you should configure email alerts.

The final email (after the stop-restarting threshold has been crossed) will clearly communicate what’s going on:

Email telling you that AlwaysUp has stopped

That way, you’ll know that you need to jump in to get your application going again.

Tip #2: If AlwaysUp gives up, troubleshoot your application

If your application repeatedly fails to start, it’s likely a serious problem. It’s certainly not one that AlwaysUp will be able to solve by itself.

You should jump in to troubleshoot. Here are a few things to try:

  • Start your application on your desktop (without AlwaysUp involved) and see if it reports any warnings or errors.

  • Try the same command line that AlwaysUp uses to launch your application. To do so, combine both the Application and Arguments fields, making sure to enclose the path in quotes if it contains a space:

    Compose your application command line
  • Review any log files that your application writes.

  • Watch out for sneaky automatic updates that break things. For example, if an update relocates your application’s main executable file, you’ll need to update the path in AlwaysUp.

Posted in AlwaysUp | Tagged , , , | Leave a comment

AlwaysUp Feature Spotlight: Stop Your Application With A Special Command

AlwaysUp Feature Spotlight: Stop Your App With A Special Command

What’s a “stop command”? Why would I use it?

Stopping your application in AlwaysUp triggers a multi-step shutdown process. The goal of that process is to close your application gracefully, without data loss.

Behind the scenes, AlwaysUp sends multiple standard Windows messages to tell your program to wrap up whatever it’s doing and exit. Fortunately, most programs receive those requests, save their work, and quit without any drama.

But some applications would rather take a different approach. Instead of dealing with standard Windows methods, they provide a command-line to invoke a graceful shut down.

For example:

  1. VirtualBox allows you to power off or suspend a virtual machine by running the “VBoxManage.exe controlvm” command.

  2. The nginx web server implements a fast shutdown when you run “nginx.exe -s stop”.

In fact, running a “stop command” is often the best way to close an application. That’s because the command often provides additional context and gives the program complete control over how to exit.

Furthermore, we can safely assume that the software implements the stop command for a good reason — and that it should be used when possible.


How do I make AlwaysUp close my application with a special stop command?

  1. Before we get to AlwaysUp, compose the command line that you will use to stop your application:

    • Start with the full path to the executable to run. Enclose it in quotes if it contains a space.
    • Follow the executable with all the required parameters for the stop command. Again, be sure to quote parameters with spaces.

    For example, if the VirtualBox instructions say to run “VBoxManage controlvm savestate”, your full command will look like ours:

    "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" controlvm “Server 2025 Trial” savestate

    Or to stop nginx, this command does the trick for us:

    "C:\nginx\nginx.exe" -p "C:\nginx\htdocs" -s stop

  2. Next, confirm that your command actually does the job. Open a command prompt and ensure that running the command closes your application, as expected.

    For instance, we were able to close our VirtualBox machine from the command line just fine:

    Test your stop command
  3. Edit your application in AlwaysUp.

  4. Move to the Extras tab.

  5. Check the Use this special command to stop the application box and provide the full command you created in step 1.

    We entered our VirtualBox command:

    Set the command line that stops your application
  6. Save your changes.

And with that change in place, AlwaysUp will invoke the command whenever it needs to stop your application.


What are your best tips when using a stop command?

Tip #1: Put your stop command in a batch file

Is your stop command complex? Or does it involve multiple operations? For example, do you need to set environment variables before running a program?

If so, you should:

  • create a batch file that stops your application, and
  • provide that batch file to AlwaysUp on the Extras tab.

That will be easier (and less error-prone) than trying to cram a complex command line into AlwaysUp.

Tip #2: Give your program enough time to exit

By default, AlwaysUp will wait for up to 30 seconds for your stop command to do its work. If the application is still alive after that period, AlwaysUp will fall back to its regular methods and your program may be forcibly terminated.

If your application needs more time to exit, you should set a suitable extension on the Extras tab:

Give your application more time to exit

Tip #3: Test your stop command from AlwaysUp

After installing the stop command, be sure to test that it works from AlwaysUp too.

Try stopping your application from AlwaysUp and make sure that your application concludes in a timely fashion, without errors.

Check:

  • your application’s log files, to confirm that it shut down properly;
  • the AlwaysUp activity report (select Application > Report Activity > Today to open it in your browser).
Posted in AlwaysUp | Tagged , , , | Leave a comment

Q&A: Where’s The Output From My Python Script?

Where's The Output From My Python Script?
Quotes  Our team uses AlwaysUp to run a few Python scripts automatically after a reboot. Everything works fine except for one of the scripts that prints to the console. We have AlwaysUp save it for us but we noticed an issue with statements not coming out in the log file. Is there any option in AlwaysUp to make sure that all print statements are saved to the file?

— Sylvia P.

Hi Sylvia, thanks for reaching out.

It’s good to hear that you’re using AlwaysUp’s capture-console-output-to-file feature. That’s the best way to record any text that your Python script prints.

And with that feature active, the file you entered should contain every single line that Python prints:

Capture Python console output

So your instincts are right: something strange is going on. You shouldn’t be missing any output.

Here’s what we found out when we investigated.


The problem: Python buffers output when not interactive

It turns out that Python handles calls to the print function based on how it’s running.

When you run Python interactively — by launching python.exe at the prompt and typing commands at it — all calls to the print function are immediately and fully processed. In that case, all print statements show up right away, as expected.

But in non-interactive scenarios — for example, when Python is invoked to process a script — Python may hold on to print output for a while before producing it. That’s called output buffering, and it’s in place to improve performance by consolidating many expensive output operations into a single one.

My guess is that you’re experiencing output buffering. Your script’s calls to print succeed, but Python is accumulating characters before efficiently printing them to the console all at once.

The good news is that if you’re happy to do without the performance benefits of output buffering, there are a few ways to ensure that print statements are processed immediately. Pick one of the three solutions we outline below to fix the problem.


Solution #1: Run Python unbuffered

To do away with all buffering when running your script, start Python in unbuffered mode.

You can do that in a couple of ways:

  1. Specify the -u parameter on your python.exe command line, or

  2. Set the PYTHONUNBUFFERED environment variable to 1 before launching python.exe.

Either option will do the trick.

To apply the first option, edit your Python script in AlwaysUp and add the “-u” flag to the Arguments field, like this:

Run Python script unbuffered

That’s probably the easiest fix to implement.


Solution #2: Update your script to call print with the “flush” parameter

Are you able to update the code?

If so, you have additional options instead of running completely unbuffered.

First, you can instruct each call to the print function to immediately produce its text. You do so by adding and setting the flush parameter to True.

For example, if you have this line of code:

print("Hello, World.")

Then this variation will ensure that the text is never buffered:

print("Hello, World.", flush=True)

The benefit of this approach is that you can limit your changes to only the information that you must see immediately.

For example, you can modify only the time-sensitive printouts while still getting the performance benefits of buffering on less important output.


Solution #3: Update your script to manually flush output

If you’re unable (or unwilling) to change the print statements, you can add occasional calls to the sys.stdout.flush() function instead. When you call flush, Python will immediately output all the text it has buffered from previous calls to print.

Simply call flush whenever you need to ensure that all text sent to AlwaysUp. Here’s an example:

import sys
print("Hello, world.")
sys.stdout.flush()

Note that with this option, you have precise control over when to clear the output buffer.

For example, you can choose to call flush only after multiple prints (or function calls), like this:

import sys
print("I watch the world go round and round,")
print("and see mine turning upside down.")
print("- Genesis, Throwing it all away")
print_lyrics_copyright()
sys.stdout.flush()

You’re in charge.


So there you have it, Sylvia. Please be sure to consider each of the solutions and choose the best one for your unique environment. We recommend running Python unbuffered (solution #1) — unless you have special performance requirements.

Best of luck with your Python scripts!

Posted in AlwaysUp | Tagged , , , , , | Leave a comment