[zeromq-dev] cl-zmq + sbcl threads

Sölvi Páll Ásgeirsson solvip at gmail.com
Thu Jun 24 21:33:42 CEST 2010


Hi again,

Looks like I solved my own issue, I'm still not sure weather this is a
bug in zmq or sbcl or both.
unwind-protect doesn't seem to like stunts like these.
A workaround is to call zmq:init and manage it yourself.

Thanks,
Solvi

On 06/24/2010 06:14 PM, Sölvi Páll Ásgeirsson wrote:
> Hi zeromq-dev,
> 
> I might be barking up the wrong tree, please correct me if I am.
> 
> I'm trying to get the CL bindings for ZeroMQ to play nice with SBCL
> threads, when running the following snippet:
> ------------
> (zmq:with-context (ctx 1)
>   (defun start-server ()
>     (zmq:with-socket (s ctx zmq:rep)
>       (zmq:bind s "tcp://127.0.0.1:5555")
>       (let ((message (make-instance 'zmq:msg)))
>         (zmq:recv s message)
>         (format t "~s~%" (zmq:msg-data-as-string message)))))
> 
>   (defun start-client ()
>     (zmq:with-socket (s ctx zmq:req)
>       (zmq:connect s "tcp://127.0.0.1:5555")
>       (let ((message (make-instance 'zmq:msg :data "Hello there!")))
>         (zmq:send s message)))))
> 
> (defvar *server* (sb-thread:make-thread #'start-server))
> (start-client)
> ------------
> 
> SBCL goes down with:
> ------------
> Unhandled memory fault at #x11.
>    [Condition of type SB-SYS:MEMORY-FAULT-ERROR]
> 
> Restarts:
>  0: [TERMINATE-THREAD] Terminate this thread (#<THREAD RUNNING
> {1004441171}>)
> 
> Backtrace:
>   0: (SB-SYS:MEMORY-FAULT-ERROR)
>   1: ("foreign function: #x421130")
>   2: ("foreign function: #x421210")
>   3: ("foreign function: #x801A98C038")
>   4: (IS.BITBUCKET.SHA1SUM::START-SERVER)
>   5: ((FLET #:WITHOUT-INTERRUPTS-BODY-[BLOCK369]374))
>   6: ((FLET SB-THREAD::WITH-MUTEX-THUNK))
>   7: ((FLET #:WITHOUT-INTERRUPTS-BODY-[CALL-WITH-MUTEX]300))
>   8: (SB-THREAD::CALL-WITH-MUTEX ..)
>   9: (SB-THREAD::INITIAL-THREAD-FUNCTION)
>  10: ("foreign function: #x421130")
>  11: ("foreign function: #x417E97")
> -----------
> 
> Am I doing something horribly wrong?  Is the SBCL threading support
> broken in this regard?
> How are you guys handling CL + multithreading, start up several
> instances of SBCL?
> 
> Thanks in advance!
> Solvi
> 
> 
> 
> 
> 
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 899 bytes
Desc: OpenPGP digital signature
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100624/7ef22e55/attachment.sig>


More information about the zeromq-dev mailing list