Hello Christian,
I will apply your patches to see if that makes a difference. The problems I ran into were (pulling from memory about 1 month ago...):
1. Attempt to spawn a thread as per Web examples, in the same running Gambit image -- works fine.
2. Bring up two independent terminal sessions running Gambit with Termite and attempt to remote spawn to LocalHost on the same machine. That worked about 1 time in 10, with the first one working well and encouraging me to persist, as per intermittent positive reinforcement (i.e., gambling). The errors were unidentified, but caused the Gambit images to abort. This was on Mac OS X 10.4.? (one month ago). I did not try on PC / Windows.
Being under time pressure, I found the sources to Termite very helpful in granting an initial understanding of how such things work. Between than and my understanding of Erlang, I was able to sit down and do a clean-sheet development of something very similar (and beyond) using Lispworks over the course of about 4-6 days. I already had an ML Pattern Matcher from prior projects, and that helped save a lot of time.
I like Scheme, but knowing what I do about it and what I now know about the needs of a Termite-like program, I expect that there have been many special additions to the Gambit core to handle exception trapping, socket I/O, and the REPL reader - not to mention macros and the ML Pattern Matching. These things will take more time to delve into and gain familiarity with them. And at the time, after browsing the mail threads on Gambit, it wasn't at all clear that Termite would be supported going forward. It appeared to be a graduate thesis project and that person has since moved on.
Dr. David McClain Sr. VP, Embedded Systems Asyrmatos Inc. Boston & Tucson phone: 520-529-2437 cell: 520-390-3995 web: www.asyrmatos.com email: dbm@asyrmatos.com
On Apr 29, 2008, at 8:34 PM, Christian Jaeger wrote:
David McClain wrote:
Hi,
While not a production use of Termite, my recent reading of the sources led me to write our Butterfly system in Common Lisp. My initial attempts at using Termite let to this, as its performance seemed sporadic (more often failing than succeeding -- can't be sure why). But it became increasingly clear that in order to track down the difficulty, I would have to delve deeper into the threading mechanism of Gambit. I'd love to do that someday, but not now.
It would probably be helpful if you could tell more about the kind of failures you have seen. The currently released version has a problem with generation of uuid's making you run out of memory (they've been interned symbols and Gambit doesn't GC those). Guillaume told me that he fixed that for the next release.
Other possible problems coming to mind are:
- FFI calls blocking other threads
- the Gambit keyword argument GC bug which has been mentioned on the
list a few times
BTW I've attached a patch to Termite to make it run on the current Gambit release; note that (to be sure it's compiled in safe mode and for not having to modify Gambit itself) I'm compiling it like this:
- unpack Termite somewhere else, not inside Gambit tree
- cd termite; patch -p1 < thepatchfile
- cd ..; gsc termite/termite.scm
then run Termite user code with
gsi /path/to/termite/termite path/to/usercode -
Christian.
diff -rN -u old-termite/termite.scm new-termite/termite.scm --- old-termite/termite.scm 2008-04-30 03:31:41.000000000 +0200 +++ new-termite/termite.scm 2008-04-30 03:31:41.000000000 +0200 @@ -4,7 +4,7 @@
;; this is the main file for the Termite system
-(declare (block)) +(declare (block) (standard-bindings) (extended-bindings))
;;
@@ -154,7 +154,7 @@ (make-upid service-name node))
(define (base-exception-handler e)
- (##continuation-capture
- (continuation-capture (lambda (k) (let ((log-crash (lambda (e)
@@ -163,11 +163,11 @@ (call-with-output-string "" (lambda (port) (display "#|\n" port)
(##display-exception-in-context
(display-exception-in-context e k port)
(##cmd-b 0 k port)
(##cmd-b k port 0) ;; todo offer safe access? (display "|#\n" port))))))) (cond ;; Propagated Termite exception?
@@ -934,7 +934,7 @@ (define (init-from-shell-script) (with-exception-catcher (lambda (e)
(##display-exception e (current-error-port))
(error (string-append "usage: " (car (command-line)) " [ip-address [tcp port#]]")))(display-exception e (current-error-port))