[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-janitors] #285: termite hangs and doesn't return values when it
From: |
Chicken Trac |
Subject: |
[Chicken-janitors] #285: termite hangs and doesn't return values when it should |
Date: |
Fri, 16 Jul 2010 19:26:36 -0000 |
#285: termite hangs and doesn't return values when it should
-------------------------+--------------------------------------------------
Reporter: jeronimo | Owner:
Type: defect | Status: new
Priority: major | Milestone:
Component: extensions | Version: 4.5.x
Keywords: termite egg |
-------------------------+--------------------------------------------------
Hello,
It seems that the termite egg -- it looks like processes
don't react to messages immediately -- "?" seems to hang
and wait forever.
Below I compare the termite egg with Chicken from git/master
(0cc55fe1d91af124b64644ea7fd9a82cd4712e52) to Gambit C 4.6.0 with the
termite code from googlecode/svn.
{{{
> (define pid (spawn (lambda () (write (?)))))
> (! pid "hello world")
> "hello world"
}}}
In Chicken:
{{{
#;2> (define pid (spawn (lambda () (write (?)))))
#;3> (! pid "hello world")
}}}
Seems like the message got stuck in some buffer...
Something to do with current-output-port, perhaps?
Sometimes I can get an answer:
{{{
#;4> (! pid 'a)
"hello world"
#;5>
}}}
But several times not:
{{{
(...)
#;19> (! pid "aaaaaaaaaaaaaaaaaaaaaaaaaaa")
#;20> (! pid "aaaaaaaaaaaaaaaaaaaaaaaaaaa")
#;21> (! pid "aaaaaaaaaaaaaaaaaaaaaaaaaaa")
#;22> (! pid "aaaaaaaaaaaaaaaaaaaaaaaaaaa")
#;23> (! pid "aaaaaaaaaaaaaaaaaaaaaaaaaaa")
#;24> (! pid "aaaaaaaaaaaaaaaaaaaaaaaaaaa")
#;25> (! pid "aaaaaaaaaaaaaaaaaaaaaaaaaaa")
#;26> (! pid "aaaaaaaaaaaaaaaaaaaaaaaaaaa")
}}}
In Gambit, if I set a timeout for receiving a message and
it actually times out, an exception is raised:
{{{
(? 1)
*** ERROR IN (console)@4.1 -- mailbox receive timed out
(thread-receive 0)
1>
}}}
In Chicken it gets blocked forever:
{{{
#;2> (? 1)
}}}
Hitting ^C gives me a stack trace:
{{{
Call history:
termite.scm:103: log-crash
termite.scm:88: call-with-output-string
termite.scm:81: continuation-capture
termite.scm:94: termite-exception?
termite.scm:103: log-crash
termite.scm:88: call-with-output-string
termite.scm:81: continuation-capture
print-call-chain <--
}}}
Defining a value to be returned when "?" doesn't get
anything after n seconds also doesn't work:
In Gambit, it returns the value:
{{{
> (? 1 'ok)
ok
>
}}}
In Chicken, it doesn't hang, but no value is returned:
{{{
#;2> (? 1 'ok)
#;3>
}}}
Also, "on" seems to hang. On Gambit, I can do this:
Start two gsi interpreters with termite loaded. These
are gambit-A and gambit-B:
{{{
gambit-A> (node-init (make-node "127.0.0.1" 3000))
ok
gambit-B> (node-init (make-node "127.0.0.1" 3001))
ok
gambit-B> (define A (make-node "127.0.0.1" 3000))
gambit-B> (on A (lambda () (print 'x)))
gambit-B>
}}}
B doesn't hang, and "x" is written on A's REPL.
On Chicken,
A runs:
{{{
(use termite)
(define a (make-node "127.0.0.1" 10000))
(node-init a)
}}}
On B:
{{{
#;2> (node-init (make-node "127.0.0.1" 10001))
ok
#;3> (define A (make-node "127.0.0.1" 10000))
#;4> (on A (lambda () (print 'x)))
}}}
Nothing is printed on A's REPL, and B hangs.
Again, hitting ^C shows this stach trace:
{{{
Call history:
termite.scm:94: termite-exception?
termite.scm:103: log-crash
termite.scm:88: call-with-output-string
termite.scm:81: continuation-capture
termite.scm:94: termite-exception?
termite.scm:103: log-crash
termite.scm:88: call-with-output-string
print-call-chain <--
}}}
It doesn't seem to actually have to do with I/O, because this also
makes B hang:
{{{
#;4> (on A (lambda () (set! x 20) (values)))
}}}
I hope this is just some small issue in the way termite interacts with
Chicken's threading code...
Thanks,
J.
--
Ticket URL: <http://www.irp.oist.jp/trac/chicken/ticket/285>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.
- [Chicken-janitors] #285: termite hangs and doesn't return values when it should,
Chicken Trac <=