[Zope-dev] Xron fragility

Steve Alexander steve@cat-box.net
Wed, 11 Oct 2000 13:41:47 +0100


Chris McDonough wrote:
> 
> Steve,
> 
> I am also interested in scheduling... though I haven't looked closely at
> Xron.
> 
> > The Xron product seems rather "fragile" in use.
> >
> > That is, if things go wrong when an Xron DTML Method is triggered, that
> > method doesn't get rescheduled.
> 
> Does Xron take an optimistic approach to repeating jobs?  In other words,
> does it assume every job is a one-time job and that the last duty that a
> repeating job performs is to reschedule itself?

It is the Xron DTML Method's responsibility to reschedule itself.
It could be its first duty, however. Then again, as all the work happens
inside a ZODB transaction, it doesn't matter when the reschedule
happens.

> What does the Dispatcher thread do?  Does it fire off worker threads?

Xron has a single dispatcher thread. This thread knows how long to sleep
for until the next job needs to run. It uses Client.py to run a job.
Jobs are Xron DTML Methods. They have a "trigger" method that gets
called through the web from localhost, by the Dispatcher thread.

> > Before I leap in and start patching Xron, I'd like to have a discussion
> > about how Xron should handle problems.
> >
> > My first thought is that on errors in the dispatcher thread, Xron should
> > enter an "error state" where it probes every so often to see whether it
> > can resume normal operation. The length of time between probes could
> > increase with each probe, to give good performance with transient
> > problems whilst preventing Xron from choking resources.
> 
> What are other threads in Xron doing while the Dispatcher thread is hosed?
> What are the other threads?

There are no other threads in Xron.
Xron creates a single thread to do all event dispatching. The work is
done in Zope ZODB threads (or whatever the correct terminology is). The
dispatcher thread communicates with a ZODB thread by using Client to
make a web request.

Xron usually makes requests as the anonymous user. However, I've patched
my Xron to make requests as XronUser by hardcoding (!) the username and
password for that in the RPC.py module of Xron. Then, I've manually
created a XronUser user in my root user folder. I give XronUser the
local roles needed to run methods I want to be scheduled via Xron.

This is not the ideal way to make Xron use authentication. I posted a
proposed design for that to zope-dev in August.

http://lists.zope.org/pipermail/zope-dev/2000-August/006548.html
http://lists.zope.org/pipermail/zope-dev/2000-August/006549.html
http://lists.zope.org/pipermail/zope-dev/2000-August/006550.html

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net