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. 0 1760 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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,
|
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...
|
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...
|
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
|
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...
| |
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...?
|
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
|
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...
|
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...
|
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...
|
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,...
| |
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...
|
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,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |