[racket] distributed places - throwing dcgm-type contract violation on *channel-get

From: Matthew Eric Bassett (mebassett at gegn.net)
Date: Fri Dec 14 17:31:06 EST 2012

Hey folks,

I was playing around with distributed places and I ran into a some 
problems.  I'm using racket v5.3 and am following the docs from the 
racket reference 
(http://docs.racket-lang.org/reference/distributed-places.html)

Let's say we have an example just like the one in the reference.

hello-world-place.rkt
----------------------
(define (hello-world)
     (place ch (printf "hello-world received: ~a\n" (place-channel-get ch))
     (place-channel-put ch "Hello World\n")
     (printf "hello-world sent: Hello World\n")))

Then from the racket xrepl we do

 >> (define-values (node pl)
             (spawn-node-supervise-dynamic-place-at remote-node 
"hello-world-place.rkt" 'hello-world))
; there's now a racket process running on my remote-node
 >> (*channel-put pl "hi")
; the remote node shuts down as we expect, giving the place-channel-get 
should have locked it until this point.
 >> (*channel-get pl)
; dcgm-type: contract violation
;   expected: dcgm?
;   given: #<eof>
;   context...:
; /usr/local/lib/racket/collects/racket/place/distributed.rkt:442:8: loop
;    /usr/local/lib/racket/collects/xrepl/xrepl.rkt:1341:0
;    /usr/local/lib/racket/collects/racket/private/misc.rkt:87:7

I've tried [naively] using place-channel-put/get instead of 
*channel-put/get, same result.  Wrapping it in a message-router makes no 
difference.

 >> (message-router node (after-seconds 2 (*channel-put pl "hi!") 
(*channel-get pl)))
; gives same result as above.

Any ideas what I'm doing wrong or what I'm missing?

Many thanks,


-- 
Matthew Eric Bassett | http://mebassett.info


Posted on the users mailing list.