473,756 Members | 1,818 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Timer Problem with Service

We have written a service that uses a timer control to check for a process
every 60 seconds. This is installed on a Windows 2003 Server w/SP1.

The problem we are running into is that the service doesn't stop, but it
seems the timer process stops. Has anyone else run into this? What have
been solutions?
Jan 31 '06 #1
11 1841
Hi,

"Kevin Antel" <ke****@cqlcorp .com> wrote in message
news:uv******** ******@TK2MSFTN GP09.phx.gbl...
We have written a service that uses a timer control to check for a process
every 60 seconds. This is installed on a Windows 2003 Server w/SP1.

The problem we are running into is that the service doesn't stop, but it
seems the timer process stops. Has anyone else run into this? What have
been solutions?


What Timer class r u using? You should be using System.Timers.T imer and
make sure that the AutoReset is set to true

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Jan 31 '06 #2
We are using System.Timers.T imer and we do have AutoReset set to True.
m_Timer.AutoRes et = true;

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > wrote
in message news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
Hi,

"Kevin Antel" <ke****@cqlcorp .com> wrote in message
news:uv******** ******@TK2MSFTN GP09.phx.gbl...
We have written a service that uses a timer control to check for a
process every 60 seconds. This is installed on a Windows 2003 Server
w/SP1.

The problem we are running into is that the service doesn't stop, but it
seems the timer process stops. Has anyone else run into this? What have
been solutions?


What Timer class r u using? You should be using System.Timers.T imer and
make sure that the AutoReset is set to true

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

Jan 31 '06 #3
Hi,

"Kevin Antel" <ke****@cqlcorp .com> wrote in message
news:eY******** ******@TK2MSFTN GP11.phx.gbl...
We are using System.Timers.T imer and we do have AutoReset set to True.
m_Timer.AutoRes et = true;


What the service does?
Does it happen the first time or after several events?
Are you handling all the exceptions ? using AppDomain.UnHan dledException

I have a similar environment and I haven't had any problem yet, the timer
(and a filesystemwatch er) works as expected all the time.


--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

Jan 31 '06 #4
I have read that this doesn't happen to everyone. I have also heard that it
works under Windows 2000, but not always under 2003.

The service is simple. It waits 60 seconds, then logs into a mailbox to
push files into a SQL DB.

We can't physically recreate the problem. Instead, we encounter the problem
after about 20 - 30 days of running. We are working on a service that will
notify us if it is in a stopped state, so we can better narrow down the
times that it runs.

We ae running on Windows 2003 w/SP1. I'll look into the Exception.

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > wrote
in message news:Og******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

"Kevin Antel" <ke****@cqlcorp .com> wrote in message
news:eY******** ******@TK2MSFTN GP11.phx.gbl...
We are using System.Timers.T imer and we do have AutoReset set to True.
m_Timer.AutoRes et = true;


What the service does?
Does it happen the first time or after several events?
Are you handling all the exceptions ? using AppDomain.UnHan dledException

I have a similar environment and I haven't had any problem yet, the timer
(and a filesystemwatch er) works as expected all the time.


--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

Jan 31 '06 #5
We don't believe we are getting any type of exception, it seems to be more
of a disconnect between the timer and the worker thread.

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > wrote
in message news:Og******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

"Kevin Antel" <ke****@cqlcorp .com> wrote in message
news:eY******** ******@TK2MSFTN GP11.phx.gbl...
We are using System.Timers.T imer and we do have AutoReset set to True.
m_Timer.AutoRes et = true;


What the service does?
Does it happen the first time or after several events?
Are you handling all the exceptions ? using AppDomain.UnHan dledException

I have a similar environment and I haven't had any problem yet, the timer
(and a filesystemwatch er) works as expected all the time.


--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

Jan 31 '06 #6
Do you happen to call Stop on the server instance in your Elapsed event
handler?

Willy.

"Kevin Antel" <ke****@cqlcorp .com> wrote in message
news:O9******** ********@tk2msf tngp13.phx.gbl. ..
|I have read that this doesn't happen to everyone. I have also heard that
it
| works under Windows 2000, but not always under 2003.
|
| The service is simple. It waits 60 seconds, then logs into a mailbox to
| push files into a SQL DB.
|
| We can't physically recreate the problem. Instead, we encounter the
problem
| after about 20 - 30 days of running. We are working on a service that
will
| notify us if it is in a stopped state, so we can better narrow down the
| times that it runs.
|
| We ae running on Windows 2003 w/SP1. I'll look into the Exception.
|
| "Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us >
wrote
| in message news:Og******** ******@TK2MSFTN GP10.phx.gbl...
| > Hi,
| >
| >
| >
| > "Kevin Antel" <ke****@cqlcorp .com> wrote in message
| > news:eY******** ******@TK2MSFTN GP11.phx.gbl...
| >> We are using System.Timers.T imer and we do have AutoReset set to True.
| >> m_Timer.AutoRes et = true;
| >>
| >
| > What the service does?
| > Does it happen the first time or after several events?
| > Are you handling all the exceptions ? using AppDomain.UnHan dledException
| >
| > I have a similar environment and I haven't had any problem yet, the
timer
| > (and a filesystemwatch er) works as expected all the time.
| >
| >
| >
| >
| > --
| > Ignacio Machin,
| > ignacio.machin AT dot.state.fl.us
| > Florida Department Of Transportation
| >
| >
| >
|
|
Jan 31 '06 #7
why dont you instead of using a timer, simply put the current thread
asleep for a minute? I have many services that do similar things, and
I just have them in an infinite loop w/ a sleep. Then on service stop,
I kill the threads.

Jan 31 '06 #8
Hi,
"Kevin Antel" <ke****@cqlcorp .com> wrote in message
news:%2******** *******@TK2MSFT NGP12.phx.gbl.. .
We don't believe we are getting any type of exception, it seems to be more
of a disconnect between the timer and the worker thread.

I have a service that use a timer running in both 2003 and 2K , I have no
get an error until now.

Have you seen another posts like yours?

I would check for the exception, what you do in the handler? maybe is there
where it's failing

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Jan 31 '06 #9
Hi,

It may be of use to you to know that we have experienced serious problems
with System.Timers.T imer.
It would run for a while, and then for no reason we could fathom it would
stop.
To observe this we had to run a dozen or so instances of our app over the
weekend and usually just one of them would fail.

When we switched to a dedicated thread the problem was fixed.

My recommendation : don't use System.Timers.T imer

Hope this helps,

Cheers,

Adam.
"Kevin Antel" <ke****@cqlcorp .com> wrote in message
news:uv******** ******@TK2MSFTN GP09.phx.gbl...
We have written a service that uses a timer control to check for a process
every 60 seconds. This is installed on a Windows 2003 Server w/SP1.

The problem we are running into is that the service doesn't stop, but it
seems the timer process stops. Has anyone else run into this? What have
been solutions?

Feb 1 '06 #10

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

Similar topics

3
2518
by: ray | last post by:
Hi, I just wrote a windows service application to call a function of another object periodically. I used System.Server.Timer and I found that it works fine within the first 2 hours but the onTimer event wouldn't be raised again after few hours. I checked the msdn and Microsoft claims that it is a bug in their .net framework as follows: http://support.microsoft.com/default.aspx?scid=kb;en-us;842793
2
15695
by: andrewcw | last post by:
I am trying to do a windows service with C#. I am using as a base the VB.NET article in VS, but I thing the WITHEVENTS timer notation is a delegate. Can anyone provide sample code & anh hints. Thanks Andrew
2
1529
by: DaveF | last post by:
I am trying to write a service to fire an ftp object off. I want to wait 2 minutes and then download the files. Then repeat every 2 minutes. The files just seem to stop downloading. Does that timer go off every 2 minutes if the files are done or not? Here is the code: using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Diagnostics;
5
5091
by: Dhilip Kumar | last post by:
Hi all, I have developed a windows service using the windows service project template in VS.NET. I have used three controls in the service, a timer, performance counter and a message queue control. The service will "sleep" for 'n' seconds using the timer control and whenever the timer_elapsed event occurs, I use the performance counter object to determine availability of few resources. Based on the availability of resources, I use the...
2
4065
by: John David Thornton | last post by:
I've got a Windows Service class, and I put a System.Threading.Timer, and I've coded it as shown below. However, when I install the service and then start it in MMC, I get a peculiar message: The MyService service on Local Computer started and then stopped. Some services stop automatically if they ahve no work to do, for example, the Perforamnce Logs and Alert service. I tried switching to a System.Threading.Timer and that didn't work...
2
2483
by: r norman | last post by:
Please excuse the cross-posting. This question was raised in microsoft.public.dotnet.general but hasn't been answered so I am trying where I can. There are two of us who have the same problem in a service: the Timer::Tick event processor never gets called. We have set the timer interval, enabled it, and started it, but still nothing. In my case, I also have enabled an event handler to detect SessionSwitch, but that never gets...
4
1914
by: Lemune | last post by:
Hello everyone. I'm using vb 2005. I'm creating program that run as service on windows. And in my program I need to use timer, so I'm using timer object from component. I try my source code on another project that use windows form and it work. But when I implement my source code on my program that run as service on windows (I have change the code so it would work on service but I still use timer object from component), and it doesn't...
9
2645
by: archana | last post by:
Hi all, I want to know about interval of timer. I am using timer in windows service.I head somewhere that when i set interval property of timer while setting interval, restart time of Pc is consider. My question is if i am using timer in my windows service, is there any place where interval related information like interval set used by my
5
12247
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...
8
6863
by: KnighT | last post by:
I have a .net service that runs a System.Threading.Timer. The delegate points to the function that the service should execute when the timer elapses. Problem: The timer is not ticking. I have never used this timer. I used the documentation from Microsoft as a guide, but I cannot get this timer to work. Protected Overrides Sub OnStart(ByVal args() As String) Dim myTimer As New TimerState()
0
9456
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
9275
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
10034
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
9872
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
9843
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
9713
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
7248
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
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3358
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.