views:

384

answers:

4

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?

+6  A: 

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

Hershi
A: 

Hershi: The boxing would make sense to explain if it were running very slowly, but he mentioned Access Denied errors, which doesn't strike me as being related?

Orion Edwards
A: 

In answer to Orion Edwards' question: Well, actually we didn't get Access Denied errors - when I mentioned disk access errors, it manifested in errors in process X due to the extremely slow I/O (probably timeouts, race conditions, etc. - not really sure exactly what since it's a 3rd party product).

To be more specific: The product I nicknamed "X" in the original question was "Virtual PC" - when a Virtual Machine is automatically started upon login the slow I/O usually results in disk errors inside the virtual machine - meaning that we got the "BSOD" during the OS startrup within the VM, or alternatively errors like the following one appeared in the internal VM's "Event Log":

An error was detected on device \Device\Harddisk0\D during a paging operation.

Hershi
A: 

The program probably needs some more info put into its properties. It needs to "Run As", instead of just running.

Maybe this application should be developed as a service, instead of a program to be launched, or you could have service that launches the program when its determined the best window of opportunity.

JasonMichael