[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] (thread-sleep!) failure?

From: felix winkelmann
Subject: Re: [Chicken-users] (thread-sleep!) failure?
Date: Tue, 6 Feb 2007 08:43:21 +0100

On 2/5/07, Graham Fawcett <address@hidden> wrote:
Hi folks,

I've had a very strange experience with the following piece of code,
which is supposed to run a scheduled-task every twelve hours, and
clean up stale sessions from a session-table:

(define *stale-session-monitor* #f)

(define (start-stale-session-monitor)
  (when (not *stale-session-monitor*)
    (set! *stale-session-monitor*
           (make-thread (lambda ()
                          (log-info "*stale-session-monitor* : starting")
                          (let loop ()
                            (thread-sleep! (* 3600 12))
                            (log-info "*stale-session-monitor* :
cleaning up session table...")
                            (clean-up-old-sessions 12)


The code has been running fine for days --- and then suddenly, in the
middle of the night, it just *snapped* --- the loop was running more
than 2000 (clean-up-old-sessions) calls per minute. It ran this way
from 2:55am until about 4:22am --- at which time it stopped, and
returned to its normal 12 hour cycle. The two times are meaningless in
the context of the app, and neither occurs near any user activity or
other external trigger that I can find.

It looks like (thread-sleep!) stopped working for a while --- it just
didn't sleep at all, for ~200,000 iterations --- and then went back to
normal, all by itself.

Naturally, I don't have a clue what's going on here. This could be a
scheduler bug. Oh boy... I will try to figure out some test program.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]