473,785 Members | 2,720 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Singleton problems

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.
Nov 16 '05 #1
1 1413
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.
"Stephen Brown" <no****@teluspl anet.net> wrote in message
news:gCZBc.1556 $0A.26456@local host...
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.

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2499
by: Alicia Roberts | last post by:
Hello everyone, I have been researching the Singleton Pattern. Since the singleton pattern uses a private constructor which in turn reduces extendability, if you make the Singleton Polymorphic what sort of problems/issues should be considered? Also, I see that a singleton needs to be set up with certain data such as file name, database URL etc. What issues are involved in this, and how would you do this? If someone knows about the...
10
1509
by: JFR | last post by:
i found this code sample on the net that i wanted to use: class CUniqueObject { private: CUniqueObject( void ) : m_iValue(0) { } ~CUniqueObject( void ) { }
21
2469
by: Sharon | last post by:
I wish to build a framework for our developers that will include a singleton pattern. But it can not be a base class because it has a private constructor and therefore can be inherit. I thought maybe a Template can be use for that, but C# does not support Templates (will be C# generics in mid 2005). Does anyone have a solution on how the singleton pattern can be written, in C#, as a framework/ infrastructure class, so users can use this...
5
3998
by: Bob | last post by:
Does anyone know of any adverse affects of using singleton data access objects in an ASP.NET Web Service? I've been forced to implement it this way but it just doesn't seem right to me. I haven't been able to find a single example of someone doing it this way and that's usually not a good sign. I'm afraid that there may be subtle problems that won't show up quickly because the production environment will not be hitting the web service at...
2
1590
by: Bob Johnson | last post by:
Just wondering the extent to which some of you are implementing classes as Singletons. I'm working on a brand new project and, early on, identified some obvious candidates. By "obvoius candidates" I mean classes for which terrible problems would clearly arise if more than one instance were to exist. But as I'm getting into the design of this new solution, I'm realizing that a large percentage of the classes _could be_ implemented as...
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9481
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10155
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10095
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5383
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.