[kpax-devel] Error stopping server with mod-lisp and SBCL
Tom Weissmann
tom.weissmann at gmail.com
Fri Jun 26 09:52:59 UTC 2009
Hi,
Whilst experimenting with the KPAX examples and sbcl I experienced
errors trying to stop the server:
(stop-kpax) produces the error:
The value
(("mod-lisp server port 2001"
#<SB-BSD-SOCKETS:INET-SOCKET descriptor 5 {BDE4661}>
#<SB-IMPL::HANDLER INPUT on descriptor 5: #>))
is not of type
SB-THREAD:THREAD.
Looking into it can't understand how would ever work:
- The server's applicable startup method sets it server-process slot
to the result of calling s-sysdeps:start-standard-server.
- With sbcl, s-sysdeps:start-standard-server returns the result of
(push (list name
socket
(sb-sys:add-fd-handler
(sb-bsd-sockets:socket-file-descriptor socket)
:input handler-fn))
*server-processes*)
... this looks highly suspect
- The server's applicable shutdown method tries to call
s-sysdeps:kill-process on this.
- With sbcl, s-sysdeps:kill-process uses sb-thread:terminate-thread,
which doesn't expect a list of lists.
---
The following ugly hack in mod-lisp.lisp fixes the immediate problem
but not much else:
(defmethod shutdown ((web-app-server mod-lisp-server) &optional options)
(destructuring-bind (&key (graceful t) &allow-other-keys)
options
(declare (ignore graceful))
(with-slots (server-process client-processes)
web-app-server
(dolist (process client-processes) ;; these should be removed
when unwinding
(s-sysdeps:kill-process process))
(setf client-processes nil)
(when server-process
#+sb-thread (dolist (proc-info server-process)
(s-sysdeps::stop-server (first proc-info)))
#-sb-thread (s-sysdeps:kill-process server-process)
(setf server-process nil)))
(call-next-method))
web-app-server)
Regards,
Tom SW
More information about the kpax-devel
mailing list