473,747 Members | 3,014 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Timers die... need help

Hi everybody.

Recently I ran into situation with System.Threadin g.Timer in my ASP.NET
application. I reinstalled Windows on one of my servers and got timers stop
firing events after while, they just stop functioning one-by-one.
Here is detailed explanation. I run application on 2 dedicated Win 2003
servers. Server A serves about 1000 active simultaneous users (150-200 aspx
page requests per second), Sever B serves about 400 users (80-100 aspx
requests per sec). Application is the same. Machine.config is identical.
maxWorkerThread s and maxIOThreads bumped to 40. minFreeThreads = 8. There
are about 25 static timers throuout the application and there are some
dynamicly created timers. Recently I realized that hosting company did not
install SP1 for some reason, but applied critical hotfixes. I asked to
reinstall OS on the servers, so far they did it on server B.
Now, after installing Win 2003 on server B, with SP1 and all recent
updates, and installing my application there, I'm getting my timers stop
working. Possible exceptions in timer events are silenced. Logging shows
that timers work normally for a few minutes and then next event just never
happens. If I force timer by calling it's Change method, it works for a few
minutes and then dies again.
Below is simplyfied code sample and a result log.
Again, it works fine on Win 2003 without servicepack, and does not on
Win 2003 SP1.
The timers are not accessed from any other place, they are being created
on app init and then managed in timed event method in timed event (see
code).
Eventlog does not show any threads being terminated.

Also, I noticed that even though .Net version is the same on servers A
and B (1.1.4322.573), the behavior is a bit different. In particular, on
server A bad viewstate causes exception with message "The viewstate is
invalid for this page and might be corrupted." while on server B exception
message includes as well client IP, requested URL, and viewstate.

Does anybody have any idea what all this about? Any hint? For now I had
to shut down server B and let server A handle all the work.
I've had similar problem with System.Timers.T imer before. Since I
switched to System.Threadin g.Timer, it was gone. And now... ups...

Code sample.

Global.asax.cs

namespace VR
{
public class Global : System.Web.Http Application
{
private Common.AppTimer s appTimers;

protected void Application_Sta rt(Object sender, EventArgs e)
{
appTimers = new Common.AppTimer s();
}
}
}

vrTimers.cs

using System;
using System.Threadin g;

namespace VR.Common
{
public class AppTimers
{
private Timer tmTimedWork;
static private AppTimers appTimers;

public AppTimers()
{
try
{
VR.Logger.Log(V R.enumLogs.Logi c, "Init timers");
tmTimedWork = new Timer(new TimerCallback(O nTimedWork),
null, 7000, 10000);
appTimers = this;
}
catch(Exception ee)
{
VR.Logger.Log(V R.enumLogs.Logi c, "AppTimers( ): " +
ee.Message);
throw;
}

}

public void OnTimedWork(obj ect source)
{
VR.Logger.Log(V R.enumLogs.Trac e, "OnTimedWor k begin");

try
{
tmTimedWork.Cha nge(120000, 600000);
lock(tmTimedWor k)
{
long period = SomeClass.SomeS tatic() * 1000;
tmTimedWork.Cha nge(period, period);
VR.Logger.Log(V R.enumLogs.Trac e, "OnTimedWor k end
"+period.ToStri ng());
}
}
catch (Exception ee)
{
tmTimedWork.Cha nge(5000, 5000);
VR.Logger.Log(V R.enumLogs.Logi c, "OnTimedWor k:
"+ee.Messag e);
}
}

}
}

The log looks like this:
8/31/2005 4:37:46 AM: OnTimedWork begin
8/31/2005 4:37:46 AM: OnTimedWork end 1000
8/31/2005 4:37:47 AM: OnTimedWork begin
8/31/2005 4:37:47 AM: OnTimedWork end 1000
8/31/2005 4:37:48 AM: OnTimedWork begin
8/31/2005 4:37:48 AM: OnTimedWork end 1000
8/31/2005 4:37:49 AM: OnTimedWork begin
8/31/2005 4:37:49 AM: OnTimedWork end 1000
8/31/2005 4:37:50 AM: OnTimedWork begin
8/31/2005 4:37:50 AM: OnTimedWork end 1000
8/31/2005 4:37:51 AM: OnTimedWork begin
8/31/2005 4:37:51 AM: OnTimedWork end 1000
8/31/2005 4:37:52 AM: OnTimedWork begin
8/31/2005 4:37:52 AM: OnTimedWork end 1000
8/31/2005 4:37:53 AM: OnTimedWork begin
8/31/2005 4:37:53 AM: OnTimedWork end 1000
8/31/2005 4:37:54 AM: OnTimedWork begin
8/31/2005 4:37:54 AM: OnTimedWork end 1000

Dmitry.

Sep 1 '05 #1
0 1776

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

Similar topics

10
2706
by: WhiteSocksGuy | last post by:
Help! I am new to Visual Basic .Net (version 2002) and I am trying to get a System.Timers.Timer to work for me to display a splash screen for about two seconds and then load the main form. I have two forms (frmSplash and frmMain) and a code Module setup as my startup object. Here is the code that I have, when I try to run this part of the splash screen form shows and then program terminates. What am I doing wrong? Thanks,
13
1943
by: Bob | last post by:
My WinForms app runs on the single default thread, and uses a single SqlConnection object for all queries. I need to use one or more timers to periodically execute some of them. My own testing indicates that the forms timer does not operate on its own thread and will not cause a query to be sent to use the single SqlConnection while another is being executed from the handling of other events. Is that right? I just want to be 100% sure...
5
9887
by: Michael C# | last post by:
Hi all, I set up a System.Timers.Time in my app. The code basically just updates the screen, but since the processing performed is so CPU-intensive, I wanted to make sure it gets updated regularly; like every 1.5 secs. or so. I only ran into one issue - the MyTimer_Elapsed event handler was not updating the screen correctly all the time, often leaving large chunks of the screen un-painted for several seconds. On a whim I decided to...
8
3170
by: Jerry Spence1 | last post by:
I am trying to create timers on demand by doing the following: Dim NewTimer As New System.Timers.Timer NewTimer.Interval = 10000 AddHandler NewTimer.Elapsed, AddressOf Timeup NewTimer.Enabled = True NewTimer.Start() My problem then happens in the TimeUp routine
0
306
by: Dmitry Demchuk | last post by:
Hi everybody. Recently I ran into situation with System.Threading.Timer in my ASP.NET application. I reinstalled Windows on one of my servers and got timers stop firing events after while, they just stop functioning one-by-one. Here is detailed explanation. I run application on 2 dedicated Win 2003 servers. Server A serves about 1000 active simultaneous users (150-200 aspx page requests per second), Sever B serves about 400 users (80-100...
7
6071
by: RobKinney1 | last post by:
Hello, Wow...I have one for you all and hopefully I am not understanding this timer object correctly. I have a timer setup that pulses a connection through a socket every 60 seconds. But it seems recently connections just drop off because the timer stops firing. My question is if there is a timeout in the timer event that just shuts down the call if the timer event is taking too long to complete...?
3
8627
by: Steve Lowe | last post by:
Hi, I'm getting into VB.net with the help of a few books, but have got a problem grasping how to implement a system.timers.timer Only 1 of my 3 books mentions timers and that's a Windows.Form.Timer Basically I need to have a 30 second delay in some module code. To help me get the hang of it - (that should really be start to get
5
12243
by: Tony Gravagno | last post by:
I have a class that instantiates two Timer objects that fire at different intervals. My class can be instantiated within a Windows Form or from a Windows Service. Actions performed by one of the event handlers may take longer than the interval for either of the timers, so it's possible for multiple events to fire "simultaneously" and for events to queue up. I'm attempting to get the timers to sync on some reference type object, or use...
2
2113
by: BobAtVandy | last post by:
I'll greatly appreciate any help on this. Actually 2 questions: 1. I believe I need to use the Windows timer System.Timers.Timer . The examples I find on the web all access that timer by 'import System' . (That's System with a capital S.) I have pywin32 installed and 'import System' doesn't find System so I gather it's not in that package. Where does one get the package with Windows' System class? 2. The reason I've been...
0
8979
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
9522
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
9354
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...
0
9223
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6790
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4860
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3296
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
2
2771
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2203
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.