Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are my auto-run applications acting weird on Vista?

The product we are working on allows the user to easily set it up to run automatically whenever the computer is started. This is helpful because the product is part of the basic work environment of most of our users.
This feature was implemented not so long ago and for a while all was well, but when we started testing this feature on Vista the product started behaving really weird on startup. Specifically, our product makes use of another product (lets call it X) that it launches whenever it needs its services. The actual problem is that whenever X is launched immediately after log-on, it crashes or reports critical errors related to disk access (this happens even when X is launched directly - not through our product).

This happens whenever we run our product by registering it in the "Run" key in the registry or place a shortcut to it in the "Startup" folder inside the "Start Menu", even when we put a delay of ~20 seconds before actually starting to run. When we changed the delay to 70 seconds, all is well.

We tried to reproduce the problem by launching our product manually immediately after logon (by double-clicking on a shortcut placed on the desktop) but to no avail.

Now how is it possible that applications that run normally a minute after logon report such hard errors when starting immediately after logon?

like image 858
Hershi Avatar asked Aug 19 '08 06:08

Hershi


1 Answers

This is the effect of a new feature in Vista called "Boxing": Windows has several mechanisms that allow the user/admin to set up applications to automatically run when windows starts. This feature is mostly used for one of these purposes: 1. Programs that are part of the basic work environment of the user, such that the first action the user would usually take when starting the computer is to start them. 2. All sorts of background "agents" - skype, messenger, winamp etc.

When too many (or too heavy) programs are registered to run on startup the end result is that the user can't actually do anything for the first few seconds/minutes after login, which can be really annoying. In comes Vista's "Boxing" feature:

Briefly, Vista forces all programs invoked through the Run key to operate at low priority for the first 60 seconds after login. This affects both I/O priority (which is set to Very Low) and CPU priority. Very Low priority I/O requests do not pass through the file cache, but go directly to disk. Thus, they are much slower than regular I/O. The length of the boxing period is set by the registry value: "HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\DelayedApps\Delay_Sec".

For a more detailed explanation see here and here

like image 182
Hershi Avatar answered Oct 11 '22 16:10

Hershi