[zeromq-dev] cl-zmq + sbcl threads

Sölvi Páll Ásgeirsson solvip at gmail.com
Thu Jun 24 20:14:09 CEST 2010


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


-------------- 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/b1b3d8d2/attachment.sig>


More information about the zeromq-dev mailing list