I have finally tried to replicate this problem, but it never failed for me. I'm running Win 7 RC. (not sure if the problem is OS specific)
Maybe Cesar Sanz (the new project leader) wants to review that TODO that you found in the source code. John On May 28, 6:05 am, jsmorris <[email protected]> wrote: > I am exploring the use of Component.Scheduler to execute a few, short > duration jobs within my monorail web app. I have read people's > concern about asp.net killing your threads before the job is complete. > Let's ignore that for the time being, unless using the > Component.Scheduler in a monorail web app is impossible. > > I am running locally on the ASP.NET Development Server (not IIS) > running castle nightly build 1126. > > I have written my Global.cs as such to start and stop the scheduler, > plus adding a very basic job. > > public class Global : HttpApplication, IContainerAccessor > { > private static IWindsorContainer _container; > > public IWindsorContainer Container { get { return _container; } } > > protected void Application_Start(Object sender, EventArgs e) > { > _container = new IoCContainer("Web.config"); > > var jobSpec = new JobSpec("NoOp job.", "A test job.", > "NoOpJob", new PeriodicTrigger(new DateTime(1900, 1, 1), new > DateTime(2900, 1, 1), new TimeSpan(0, 0, 10), 1000)); > > _container.Resolve<IScheduler>().CreateJob(jobSpec, > CreateJobConflictAction.Ignore); > _container.Resolve<IScheduler>().Start(); > } > > protected void Application_End(Object sender, EventArgs e) > { > _container.Resolve<IScheduler>().Stop(); > _container.Dispose(); > } > } > > My job is > > public class NoOpJob : IJob > { > public Boolean Execute(JobExecutionContext context) > { > context.Logger.DebugFormat("Hello World - {0}", > DateTime.Now.ToShortTimeString()); > return true; > } > } > > After starting my web app, I am seeing jobs fail sporadically. I am > not seeing any pattern. A sample of my log is > > 2009-05-27 12:45:10,006 [Job Watcher for > 'JMORRIS2-MOBL1/WebDev.WebServer, Scheduler #1'.] [INFO > ]Castle.Components.Scheduler.DefaultScheduler.BeginExecuteJob - Job > 'NoOp job.' started at 5/27/2009 7:45:10 PM. > 2009-05-27 12:45:10,006 [4] [INFO > ]Castle.Components.Scheduler.DefaultScheduler.EndExecuteJob - Job > 'NoOp job.' completed successfully at 5/27/2009 7:45:10 PM. > 2009-05-27 12:45:20,007 [Job Watcher for > 'JMORRIS2-MOBL1/WebDev.WebServer, Scheduler #1'.] [INFO > ]Castle.Components.Scheduler.DefaultScheduler.BeginExecuteJob - Job > 'NoOp job.' started at 5/27/2009 7:45:20 PM. > 2009-05-27 12:45:20,007 [4] > [ERROR]Castle.Components.Scheduler.DefaultScheduler.EndExecuteJob - > Job 'NoOp job.' completed with an error at 5/27/2009 7:45:20 PM. > 2009-05-27 12:45:30,007 [Job Watcher for > 'JMORRIS2-MOBL1/WebDev.WebServer, Scheduler #1'.] [INFO > ]Castle.Components.Scheduler.DefaultScheduler.BeginExecuteJob - Job > 'NoOp job.' started at 5/27/2009 7:45:30 PM. > 2009-05-27 12:45:30,007 [4] [INFO > ]Castle.Components.Scheduler.DefaultScheduler.EndExecuteJob - Job > 'NoOp job.' completed successfully at 5/27/2009 7:45:30 PM. > 2009-05-27 12:45:40,008 [Job Watcher for > 'JMORRIS2-MOBL1/WebDev.WebServer, Scheduler #1'.] [INFO > ]Castle.Components.Scheduler.DefaultScheduler.BeginExecuteJob - Job > 'NoOp job.' started at 5/27/2009 7:45:40 PM. > 2009-05-27 12:45:40,008 [9] [INFO > ]Castle.Components.Scheduler.DefaultScheduler.EndExecuteJob - Job > 'NoOp job.' completed successfully at 5/27/2009 7:45:40 PM. > 2009-05-27 12:45:50,008 [Job Watcher for > 'JMORRIS2-MOBL1/WebDev.WebServer, Scheduler #1'.] [INFO > ]Castle.Components.Scheduler.DefaultScheduler.BeginExecuteJob - Job > 'NoOp job.' started at 5/27/2009 7:45:50 PM. > 2009-05-27 12:45:50,008 [9] [INFO > ]Castle.Components.Scheduler.DefaultScheduler.EndExecuteJob - Job > 'NoOp job.' completed successfully at 5/27/2009 7:45:50 PM. > 2009-05-27 12:46:00,009 [Job Watcher for > 'JMORRIS2-MOBL1/WebDev.WebServer, Scheduler #1'.] [INFO > ]Castle.Components.Scheduler.DefaultScheduler.BeginExecuteJob - Job > 'NoOp job.' started at 5/27/2009 7:46:00 PM. > 2009-05-27 12:46:00,009 [4] > [ERROR]Castle.Components.Scheduler.DefaultScheduler.EndExecuteJob - > Job 'NoOp job.' completed with an error at 5/27/2009 7:46:00 PM. > 2009-05-27 12:46:10,009 [Job Watcher for > 'JMORRIS2-MOBL1/WebDev.WebServer, Scheduler #1'.] [INFO > ]Castle.Components.Scheduler.DefaultScheduler.BeginExecuteJob - Job > 'NoOp job.' started at 5/27/2009 7:46:10 PM. > 2009-05-27 12:46:10,009 [9] [INFO > ]Castle.Components.Scheduler.DefaultScheduler.EndExecuteJob - Job > 'NoOp job.' completed successfully at 5/27/2009 7:46:10 PM. > 2009-05-27 12:46:20,010 [Job Watcher for > 'JMORRIS2-MOBL1/WebDev.WebServer, Scheduler #1'.] [INFO > ]Castle.Components.Scheduler.DefaultScheduler.BeginExecuteJob - Job > 'NoOp job.' started at 5/27/2009 7:46:20 PM. > 2009-05-27 12:46:20,010 [4] [INFO > ]Castle.Components.Scheduler.DefaultScheduler.EndExecuteJob - Job > 'NoOp job.' completed successfully at 5/27/2009 7:46:20 PM. > > Before continuing on with this experiment (or debugging into the > castle code), I had a few questions that maybe others have already > answered. > > 1) Why is the (rather simple) job sporadically failing? Is there a > way to see why the job is failing? > > 2) Can I catch the exception and expose it to my code so I can do > something with it? > > 2) Is there a better way to configure the scheduler to start in a web app? > > Thanks, > Jason --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en -~----------~----~----~----~------~----~------~--~---
