sionescu / iolib

Common Lisp I/O library
http://common-lisp.net/project/iolib/
MIT License
141 stars 31 forks source link

Wrapping with-open-socket in handler-case causes SBCL to exhaust control stack when a condition in thrown #30

Closed fouric closed 9 years ago

fouric commented 9 years ago

When with-open-socket is wrapped in a handler-case, if it throws a socket-connection-refused-error, SBCL will drop to its low-level debugger with the following output:

INFO: Control stack guard page unprotected
Control stack guard page temporarily disabled: proceed with caution
fatal error encountered in SBCL pid 21550(tid 140737353967360):
Control stack exhausted

Welcome to LDB, a low-level debugger for the Lisp runtime environment.
ldb> 

This also has the side-effect of completely disconnecting SLIME sessions.

Code:

(defun run-client (&key (host "localhost") (port 9999))
  (handler-case
      (iolib:with-open-socket
      (socket :connect :active
          :address-family :internet
          :type :stream
          :external-format '(:utf-8 :eol-style :crlf)
          :ipv6 nil)
    (iolib:connect socket (iolib:lookup-hostname host) :port port :wait t)
    (let ((line (read-line socket)))
      (format t "~A" line)
      t))
    (socket-connection-refused-error ()
      (format t "Connection refused.~%"))))

Tested on Ubuntu Linux x86-64 with SBCL 1.2.4.debian and iolib master.

sionescu commented 9 years ago

It works fine on my computer, both on SBCL and CCL. This is a problem with your SBCL.

fouric commented 9 years ago

What versions of SBCL and CCL are you using?

sionescu commented 9 years ago

SBCL 1.2.15.77-be2d517f2671 and CCL 1.10-r16606M