You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by David kerber <dc...@verizon.net> on 2007/06/29 16:41:13 UTC

Trouble with java.util.Timer in Tomcat 5.5

I have an app running in Tomcat 5.5.12, with jre  1.5.0_12 (explicitly 
specified in the service configuration), on windows 2000 server.

I have one class that is initialized by a servletContextListener, in the 
contextInitialized event.  This class uses java.util.Timer and 
java.util.TimerTask to check every few minutes for new files on an ftp 
site, and if it finds any, it downloads and processes them.  This all 
works fine for anywhere from 2 or 3 days to a week or so, then the timer 
just stops firing, and indicated by a sudden lack of entries in the log 
file (I log every time the timer fires to help track down this problem).

Over the last couple of weeks, I've found some things that can cause 
this, but I believe I've fixed them, but my timer still stops firing 
after a few days.  The things I've already fixed were updating the jre 
to 1.5.12, because of problems with automatic time correction on the 
server, and I found that unhandled exceptions in the timer task can also 
cause this, so early last week I modified my code to trap all exceptions 
before they can trickle up to the timer, and log them, and I don't see 
any exceptions being logged.

It doesn't seem to be related to the number of executions, because the 
latest time it stopped on me, it had fired around 1200 times, and the 
time before that was around 4500 times.  It can also be any time of day, 
and sometimes the server is busy and other times it hasn't had a 
connection for several hours.

Any other suggestions as to what I should look for to find this? 

Thanks!
D



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Trouble with java.util.Timer in Tomcat 5.5 - solved

Posted by David Kerber <dc...@verizon.net>.
Just a late note to tell you all that this is fixed, and the trouble was 
as you suggested:  my ftp.connect method was hanging.  Once I figured 
out what timeouts to set for it, I let it go, and it went several days 
just like it has before, until I was perusing my logs tonight and found 
a Timeout Exception logged and trapped appropriately, and it then 
returned and continued along its merry way, firing the timer again at 
the next correct interval, importing files properly the next time they 
showed. 

So everything looks great now.  Thanks for the suggestions; it would 
have taken me a long time to figure that one out on my own!

D


Ronald Klop wrote:
> Could it be the Timer is waiting for a previous action to finish? 
> Maybe the FTP connect 'hangs'.
>
> Ronald.
>
>
>
> On Fri Jun 29 16:41:13 CEST 2007 Tomcat Users List 
> <us...@tomcat.apache.org> wrote:
>> I have an app running in Tomcat 5.5.12, with jre 1.5.0_12 (explicitly 
>> specified in the service configuration), on windows 2000 server.
>>
>> I have one class that is initialized by a servletContextListener, in 
>> the contextInitialized event. This class uses java.util.Timer and 
>> java.util.TimerTask to check every few minutes for new files on an 
>> ftp site, and if it finds any, it downloads and processes them. This 
>> all works fine for anywhere from 2 or 3 days to a week or so, then 
>> the timer just stops firing, and indicated by a sudden lack of 
>> entries in the log file (I log every time the timer fires to help 
>> track down this problem).
>>
>> Over the last couple of weeks, I've found some things that can cause 
>> this, but I believe I've fixed them, but my timer still stops firing 
>> after a few days. The things I've already fixed were updating the jre 
>> to 1.5.12, because of problems with automatic time correction on the 
>> server, and I found that unhandled exceptions in the timer task can 
>> also cause this, so early last week I modified my code to trap all 
>> exceptions before they can trickle up to the timer, and log them, and 
>> I don't see any exceptions being logged.
>>
>> It doesn't seem to be related to the number of executions, because 
>> the latest time it stopped on me, it had fired around 1200 times, and 
>> the time before that was around 4500 times. It can also be any time 
>> of day, and sometimes the server is busy and other times it hasn't 
>> had a connection for several hours.
>>
>> Any other suggestions as to what I should look for to find this?
>> Thanks!
>> D
>>
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Trouble with java.util.Timer in Tomcat 5.5

Posted by Ronald Klop <ro...@base.nl>.
Could it be the Timer is waiting for a previous action to finish? Maybe the FTP connect 'hangs'.

Ronald.



On Fri Jun 29 16:41:13 CEST 2007 Tomcat Users List <us...@tomcat.apache.org> wrote:
> I have an app running in Tomcat 5.5.12, with jre 1.5.0_12 (explicitly 
> specified in the service configuration), on windows 2000 server.
> 
> I have one class that is initialized by a servletContextListener, in the 
> contextInitialized event. This class uses java.util.Timer and 
> java.util.TimerTask to check every few minutes for new files on an ftp 
> site, and if it finds any, it downloads and processes them. This all 
> works fine for anywhere from 2 or 3 days to a week or so, then the timer 
> just stops firing, and indicated by a sudden lack of entries in the log 
> file (I log every time the timer fires to help track down this problem).
> 
> Over the last couple of weeks, I've found some things that can cause 
> this, but I believe I've fixed them, but my timer still stops firing 
> after a few days. The things I've already fixed were updating the jre 
> to 1.5.12, because of problems with automatic time correction on the 
> server, and I found that unhandled exceptions in the timer task can also 
> cause this, so early last week I modified my code to trap all exceptions 
> before they can trickle up to the timer, and log them, and I don't see 
> any exceptions being logged.
> 
> It doesn't seem to be related to the number of executions, because the 
> latest time it stopped on me, it had fired around 1200 times, and the 
> time before that was around 4500 times. It can also be any time of day, 
> and sometimes the server is busy and other times it hasn't had a 
> connection for several hours.
> 
> Any other suggestions as to what I should look for to find this? 
> 
> Thanks!
> D
> 
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>