[slime-devel] SLIME and SBCL complaints about closed file descriptors

Daniel Barlow dan at telent.net
Wed Nov 26 23:41:09 UTC 2003


There is a long-standing bug in SBCL with sockets and finalisers that
probably affects SLIME users more than anyone else.  If you get errors
about closed file descriptors while trying to do compilations, this is
probably why.

The fix is in SBCL CVS now (may be tomorrow by the time it gets into
anoncvs) or you can patch an older SBCL by adding the following code
to .sbclrc or somewhere suitable

(in-package :sb-bsd-sockets)
(defmethod socket-close ((socket socket))
  (let ((fd (socket-file-descriptor socket)))
    (cond ((eql fd -1) ; already closed
           nil)
          ((slot-boundp socket 'stream)
           (close (slot-value socket 'stream)) ;; closes fd
           (setf (slot-value socket 'file-descriptor) -1)
           (slot-makunbound socket 'stream))
          (t
           (sb-ext:cancel-finalization socket)
           (handler-case
               (if (= (sockint::close fd) -1)
                   (socket-error "close"))
             (bad-file-descriptor-error (c) (declare (ignore c)) nil)
             (:no-error (c)  (declare (ignore c)) nil))))))


-dan

-- 
   http://web.metacircles.com/ - CL custom development and SBCL support
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/slime-devel/attachments/20031126/fbbeab4c/attachment.sig>


More information about the slime-devel mailing list