471,348 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 software developers and data experts.

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 1639
Hi,

"Kevin Antel" <ke****@cqlcorp.com> wrote in message
news:uv**************@TK2MSFTNGP09.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.Timer 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.Timer and we do have AutoReset set to True.
m_Timer.AutoReset = true;

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

"Kevin Antel" <ke****@cqlcorp.com> wrote in message
news:uv**************@TK2MSFTNGP09.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.Timer 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**************@TK2MSFTNGP11.phx.gbl...
We are using System.Timers.Timer and we do have AutoReset set to True.
m_Timer.AutoReset = true;


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

I have a similar environment and I haven't had any problem yet, the timer
(and a filesystemwatcher) 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.machin AT dot.state.fl.us> wrote
in message news:Og**************@TK2MSFTNGP10.phx.gbl...
Hi,

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


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

I have a similar environment and I haven't had any problem yet, the timer
(and a filesystemwatcher) 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.machin AT dot.state.fl.us> wrote
in message news:Og**************@TK2MSFTNGP10.phx.gbl...
Hi,

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


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

I have a similar environment and I haven't had any problem yet, the timer
(and a filesystemwatcher) 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****************@tk2msftngp13.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.machin AT dot.state.fl.us>
wrote
| in message news:Og**************@TK2MSFTNGP10.phx.gbl...
| > Hi,
| >
| >
| >
| > "Kevin Antel" <ke****@cqlcorp.com> wrote in message
| > news:eY**************@TK2MSFTNGP11.phx.gbl...
| >> We are using System.Timers.Timer and we do have AutoReset set to True.
| >> m_Timer.AutoReset = true;
| >>
| >
| > What the service does?
| > Does it happen the first time or after several events?
| > Are you handling all the exceptions ? using AppDomain.UnHandledException
| >
| > I have a similar environment and I haven't had any problem yet, the
timer
| > (and a filesystemwatcher) 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***************@TK2MSFTNGP12.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.Timer.
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.Timer

Hope this helps,

Cheers,

Adam.
"Kevin Antel" <ke****@cqlcorp.com> wrote in message
news:uv**************@TK2MSFTNGP09.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
Sorry should read: .... call Stop on the 'timer' instance in your Elapsed
event
handler?
Willy.

"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:uj*************@TK2MSFTNGP12.phx.gbl...
| 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****************@tk2msftngp13.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.machin AT dot.state.fl.us>
| wrote
|| in message news:Og**************@TK2MSFTNGP10.phx.gbl...
|| > Hi,
|| >
|| >
|| >
|| > "Kevin Antel" <ke****@cqlcorp.com> wrote in message
|| > news:eY**************@TK2MSFTNGP11.phx.gbl...
|| >> We are using System.Timers.Timer and we do have AutoReset set to True.
|| >> m_Timer.AutoReset = true;
|| >>
|| >
|| > What the service does?
|| > Does it happen the first time or after several events?
|| > Are you handling all the exceptions ? using
AppDomain.UnHandledException
|| >
|| > I have a similar environment and I haven't had any problem yet, the
| timer
|| > (and a filesystemwatcher) works as expected all the time.
|| >
|| >
|| >
|| >
|| > --
|| > Ignacio Machin,
|| > ignacio.machin AT dot.state.fl.us
|| > Florida Department Of Transportation
|| >
|| >
|| >
||
||
|
|
Feb 1 '06 #11
Hi Kevin,
Have you found a solution to this problem? I have same problem except that
my service is written in vb.net.
"Kevin Antel" wrote:
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?

Apr 3 '06 #12

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by andrewcw | last post: by
2 posts views Thread by DaveF | last post: by
2 posts views Thread by John David Thornton | last post: by
2 posts views Thread by r norman | last post: by

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.