[gambit-list] heartbeat frequency problem in make check

Marc Feeley feeley at iro.umontreal.ca
Thu Oct 23 13:47:12 EDT 2008


On 23-Oct-08, at 1:17 PM, Claude Marinier wrote:

>
> On Thu, 23 Oct 2008, Marc Feeley wrote:
>> To everyone on the list, if you have a non-Linux flavor of Unix (or  
>> an unusual Linux distribution or hardware), could you please try it  
>> out on your system and report any anomalies.
>
> Looks good on Solaris 10 with recent Recommended patches and gcc  
> (GCC) 3.4.6 on UltraSPARC (sun4u).
>
> ...

Thank you.

> While we are on this topic, while working on a catalogue system  
> (reads CSV, builds indexes, etc.), I was getting a deadlock error  
> related to threads and was puzzled because I am not using threads.  
> Is the heartbeat thread always running? Would it be related to this  
> error? In the end, I re-wrote without using read-all and the error  
> went away. Yes, it's not the best way to resolve problems but I am  
> new to scheme and still feeling my way around.
>

The program's execution is under the control of the "primordial  
thread" and this is the only thread running by default.  So, to be  
pedantic, all Gambit programs use threads, i.e. at least one.   
Gambit's scheduler detects deadlocks and reports them.  A deadlock is  
when no thread can possibly make any progress in the future.  For  
example:

% gsi -e "(define m (make-mutex)) (mutex-lock! m) (mutex-lock! m)"
*** ERROR IN ##thread-deadlock-action! -- Deadlock detected

and also

% gsi -e (receive (i o) (open-string-pipe) (display "x" o) (pp (read- 
char i)) (pp (read-char i)))
#\x
*** ERROR IN ##thread-deadlock-action! -- Deadlock detected

In both cases the primordial thread blocks (in the first case trying  
to lock a locked mutex, in the second case trying to read from a pipe  
whose other end is still open), and there is no other thread that  
might unblock it (by unlocking the mutex or writing something to the  
pipe).

I'd have to look at your faulty code to see what situation caused the  
deadlock.


> By the way, I plan to build a command line interface for the  
> catalogue and later use Tcl/Tk for the GUI and Expect to manage the  
> application. Do you know of open source Scheme code for command line  
> processing?

No.  But what exactly do you need as a command line interface?  I  
think tcl/tk already provides basic editing commands for input  
fields.  If you look at the code for my Javascript Scheme system (JSS)  
on the dumping grounds, you will see how to do basic line editing  
within a web page (which might be an interesting alternative to tcl/tk).

> Thanks for a really good tool.

I'm glad you like it.

Marc




More information about the Gambit-list mailing list