-
1. Re: Events started with Events.raiseTimedEvent(String, TimerSchedule) silently dying!
mikkus70 Apr 30, 2012 4:31 PM (in response to jakec)I don't think scheduled events just disappear like that without errors, most likely they are firing alright, it is the observer that is not being called.
One way of telling is raising the log level for "org.jboss.seam.core.Events" to "TRACE". This will log a line "Processing event:...." for every event. This will probably make a rather verbose log so remember to lower the log level again once the problem is diagnosed. You'll probably see that the event is being fired at the expected time. If this is the case, then it is the observer component that is no longer registered in the observers list or the component was destroyed either manually or at the end of its lifecycle and the observer method is not marked "autoCreate".
If you don't see the "Processing event:..." line, then you can presume there's a problem in the scheduling part of the process, but is much less likely.
Finally, there could be an exception while executing the job and before the event is risen, this should be handled by the AsynchronousExceptionHandler class, which just logs the error (so you should notice the error in the logs).
Hope this helps.
-
2. Re: Events started with Events.raiseTimedEvent(String, TimerSchedule) silently dying!
jakec Apr 30, 2012 5:40 PM (in response to mikkus70)Well, this code has been running for years without this ever happening before, and three completely different services all stop firing at the same time.
All three of them have the following annotations (different Names, of course).
@Startup @Scope(ScopeType.APPLICATION) @Name("utils.FileMonitor") @Install(precedence = Install.BUILT_IN)
They all have an @Create method to start the scheduled job with a line like this:
Events.instance().raiseTimedEvent("utils.FileMonitor.checkFiles", new TimerSchedule(5000L, 5000L));
And they all have an @Observer like this:
@Observer("utils.FileMonitor.checkFiles") public void checkFiles() {}
They have run for months before without stopping, but now they stop firing (all at the same time) a couple of times a day.
Now, our site HAS been getting a lot more traffic, but none of these are dependant on traffic, and we just upgraded to monster hardware a couple months ago. As I stated in my first message, we had just switched to running on a Server 2008 VM, but it still has 4 processors and 12G of ram, FAR better than the 5 year old 32-bit platform with 3.5G we had previously been running on.
I WILL turn on the logging the next time it dies. I raised the thread count to 50 (sounds like really bad bed sheets, doesn't it), so there is a chance that if threading was the issue that it won't die again.
I have also implemented Quartz with a JobStoreTX in the database. That is running on a test machine just fine. I had to inspect the current JobDetails to make sure I don't start a job a second time, but that is working fine. However, I can't reproduce the failure on test, so I don't know if it will make a difference. If there really is an issue with the timing system failing, then Quartz may not be able to poll the database for jobs. :-/