Slow startup on Windows service depending on system date (!??)

A

andrewbb

Occasionally I had been getting a 30-60 second delay when starting a
Windows service written in .NET. Today I stumbled upon a way to
reproduce it without fail:

Set the system date to the 31st of the current month, the service
starts immediately.
Set the system date to the 1st of next month, the service hangs for
30-60 seconds.
Change back to the 31st and it starts immediately again.
etc.

The service:
Main proc consists of ServiceBase.Run(new MyService());
OnStart returns immediately
Compiled in Release mode

Does anyone have any idea what is happening here?
 
N

Nicholas Paldino [.NET/C# MVP]

Well, the obvious place to look would be in your service code. Are you
performing any date-sensitive work that would be longer when the date is the
first of a month?

If it is not that, then do you have any dependencies on other services
being started up? If so, is it possible that those services are doing
something on the first of the month?
 
B

Ben Voigt [C++ MVP]

Occasionally I had been getting a 30-60 second delay when starting a
Windows service written in .NET. Today I stumbled upon a way to
reproduce it without fail:

Set the system date to the 31st of the current month, the service
starts immediately.
Set the system date to the 1st of next month, the service hangs for
30-60 seconds.
Change back to the 31st and it starts immediately again.
etc.

The service:
Main proc consists of ServiceBase.Run(new MyService());
OnStart returns immediately

Did you also remove all code from static constructors, constructors, inline
initializers?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top