Singleton problems

  • Thread starter Thread starter Stephen Brown
  • Start date Start date
S

Stephen Brown

I posted a question yesterday about a Singleton I have, using the standard
dotNet pattern, that seems to get recreated several times a day. I turned
on my performance counters (thanks to Mickey William's post yesterday) and
my Singleton restarting happens at the same time as an application restart.
Now it's pretty clear it has nothing to do with garbage collection and it
makes sense that application restart would destroy my singleton. Now the
bigger question is why application restart is happening. There hasn't been
any changes to any of the files or services on the server and yet we see
several application restarts a day, at times 2 or 3 in the course of an
hour. There is also nothing in the error logs or event viewer. It has
happened when there was no activity on the site at all. We also have put an
audit in the singleton that writes to a log file on it's constructor and
it's destructor, but we only see log entries being written from it's
constructor. Why wouldn't it's destructor ever be called? Why would the
application restart? If the application can be restarted for no apparent
reason, how can I maintain a reliable singleton? Sure, it's still a
singleton in that it only creates one instance but it really defeats my
purposes if it gets recreated several times a day.
 
I'm replying to my own message as we've found the culprit. We had a log
directory in the bin folder that would write a log file from a Windows
service. Any time any file changes in the bin folder OR any file in any
subdirectory under the bin folder it seems that the application will
restart.
 
Back
Top