[Sbcl-help] error with cl-modlisp

4 views
Skip to first unread message

Joe Corneli

unread,
Mar 17, 2013, 11:12:25 PM3/17/13
to sbcl...@lists.sourceforge.net, ke...@rosenberg.net
Hello:

I'm just getting started using cl-modlisp (http://cl-modlisp.b9.com/)
under SBCL, but I see an error like the following whenever I load a
web page:

;; Error There is no applicable method for the generic function
#<STANDARD-GENERIC-FUNCTION SB-BSD-SOCKETS:SOCKET-CLOSE (1)>
when called with arguments
(#<SB-SYS:FD-STREAM
for "socket 127.0.0.1:20123, peer: 127.0.0.1:58955"
{B53CAE9}>). [1-modlisp-worker]

The relevant function is actually close-active-socket in the kmrcl
package, which is implemented like this:

(defun close-active-socket (socket)
#+sbcl (sb-bsd-sockets:socket-close socket)
#-sbcl (close socket))

This error message or a related one seems to have been discussed in
IRC before (http://ircarchive.info/lisp/2007/3/15/6.html) and also in
the TBNL mailing list
(http://comments.gmane.org/gmane.lisp.lib.tbnl.general/532), but I'm
not clear on the current fix.

Thanks for any help or advice!

Joe

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Sbcl-help mailing list
Sbcl...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-help

Joe Corneli

unread,
Mar 18, 2013, 2:51:08 AM3/18/13
to sbcl...@lists.sourceforge.net, ke...@rosenberg.net
After some further work with the system, I now have an interesting "test case"

- http://arxana.net/decipher loads without producing that error
- http://arxana.net/decipher/model/1 produces the error and doesn't load

Throwing in a break reveals that the version without the error doesn't
call the `close-active-socket' function at all, but the version with
the error seems to try twice, yielding two slightly different
backtraces:

Backtrace:
0: (BREAK "break")
1: (KMRCL:CLOSE-ACTIVE-SOCKET #<SB-SYS:FD-STREAM for "socket
127.0.0.1:20123, peer: 127.0.0.1:48912" {C46F4C1}>)
2: ((FLET #:CLEANUP-FUN-34 :IN MODLISP::MODLISP-COMMAND-ISSUER))[:CLEANUP]
3: (MODLISP::MODLISP-COMMAND-ISSUER #<SB-SYS:FD-STREAM for "socket
127.0.0.1:20123, peer: 127.0.0.1:48912" {C46F4C1}>
#<MODLISP::ML-SERVER {E28F049}>)
4: ((LAMBDA () :IN INITIALIZE-INSTANCE))
5: ((FLET #:WITHOUT-INTERRUPTS-BODY-223578 :IN SB-THREAD:MAKE-THREAD))
6: ((FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD:MAKE-THREAD))
7: ((FLET #:WITHOUT-INTERRUPTS-BODY-88894 :IN SB-THREAD::CALL-WITH-MUTEX))
8: (SB-THREAD::CALL-WITH-MUTEX ..)
9: (SB-THREAD::INITIAL-THREAD-FUNCTION)
10: ("foreign function: call_into_lisp")
11: ("foreign function: funcall0")
12: ("foreign function: new_thread_trampoline")
13: ("foreign function: #xB7FB4D4C")

Backtrace:
0: (BREAK "break")
1: (KMRCL:CLOSE-ACTIVE-SOCKET #<SB-BSD-SOCKETS:INET-SOCKET
127.0.0.1:20123, peer: 127.0.0.1:49159, fd: 21 {C680BD1}>)
2: ((FLET #:CLEANUP-FUN-298 :IN INITIALIZE-INSTANCE))[:CLEANUP]
3: ((LAMBDA () :IN INITIALIZE-INSTANCE))
4: ((FLET #:WITHOUT-INTERRUPTS-BODY-223578 :IN SB-THREAD:MAKE-THREAD))
5: ((FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD:MAKE-THREAD))
6: ((FLET #:WITHOUT-INTERRUPTS-BODY-88894 :IN SB-THREAD::CALL-WITH-MUTEX))
7: (SB-THREAD::CALL-WITH-MUTEX ..)
8: (SB-THREAD::INITIAL-THREAD-FUNCTION)
9: ("foreign function: call_into_lisp")
10: ("foreign function: funcall0")
11: ("foreign function: new_thread_trampoline")
12: ("foreign function: #xB7FB4D4C")

Nikodemus Siivola

unread,
Mar 18, 2013, 6:00:31 AM3/18/13
to Joe Corneli, ke...@rosenberg.net, sbcl...@lists.sourceforge.net
On 18 March 2013 05:12, Joe Corneli <holtze...@gmail.com> wrote:

> ;; Error There is no applicable method for the generic function
> #<STANDARD-GENERIC-FUNCTION SB-BSD-SOCKETS:SOCKET-CLOSE (1)>
> when called with arguments
> (#<SB-SYS:FD-STREAM
> for "socket 127.0.0.1:20123, peer: 127.0.0.1:58955"

> (defun close-active-socket (socket)
> #+sbcl (sb-bsd-sockets:socket-close socket)
> #-sbcl (close socket))

Just on the basis of the error message, that should read

(defun close-active-socket (socket)
(close socket))

instead.

It is however possible that there is some confusion elsewhere in the
code, mixing up socket objects and socket streams -- if that's what's
going on, then the confusion needs to be sorted out first.

Cheers,

-- Nikodemus

Joe Corneli

unread,
Mar 18, 2013, 6:33:46 AM3/18/13
to Nikodemus Siivola, ke...@rosenberg.net, sbcl...@lists.sourceforge.net
On Mon, Mar 18, 2013 at 10:00 AM, Nikodemus Siivola
<niko...@random-state.net> wrote:

>> (defun close-active-socket (socket)
>> #+sbcl (sb-bsd-sockets:socket-close socket)
>> #-sbcl (close socket))
>
> Just on the basis of the error message, that should read
>
> (defun close-active-socket (socket)
> (close socket))
>
> instead.
>
> It is however possible that there is some confusion elsewhere in the
> code, mixing up socket objects and socket streams -- if that's what's
> going on, then the confusion needs to be sorted out first.

Hi Nikodemus:

I saw this idea in the IRC post I mentioned -- and I tried the change,
but this led to another similar error:

;; Error The function COMMON-LISP-USER::PREM is undefined. [11-modlisp-worker]
Error: There is no applicable method for the generic function
#<STANDARD-GENERIC-FUNCTION SB-GRAY::PCL-CLOSE (2)>
when called with arguments
(#<SB-BSD-SOCKETS:INET-SOCKET fd: 7 {ACFABF1}>).

Joe

Joe Corneli

unread,
Mar 18, 2013, 2:58:12 PM3/18/13
to Nikodemus Siivola, ke...@rosenberg.net, sbcl...@lists.sourceforge.net
Given the second error message, one related issue I find online is this:

https://bugs.launchpad.net/sbcl/+bug/839937

Maybe I just need to implement the equivalent of

(defmethod close ((stream my-stream) &key abort)
(close stream :abort abort))

??

Joe Corneli

unread,
Mar 18, 2013, 3:25:04 PM3/18/13
to Stelian Ionescu, sbcl...@lists.sourceforge.net
On Mon, Mar 18, 2013 at 7:23 PM, Stelian Ionescu <sion...@cddr.org> wrote:
> The biggest issue here is why you are trying to use cl-modlisp. That
> used to be popular 10 years ago, but in the meanwhile better
> alternatives in web programming have appeared.

Trying to make legacy code work for my job. Modernizing the web
server does seem like a good idea but I'd prefer to start renovations
from a working system if possible!

Stelian Ionescu

unread,
Mar 18, 2013, 3:23:39 PM3/18/13
to Joe Corneli, sbcl...@lists.sourceforge.net
On Mon, 2013-03-18 at 18:58 +0000, Joe Corneli wrote:
> Given the second error message, one related issue I find online is this:
>
> https://bugs.launchpad.net/sbcl/+bug/839937
>
> Maybe I just need to implement the equivalent of
>
> (defmethod close ((stream my-stream) &key abort)
> (close stream :abort abort))
>
> ??

The biggest issue here is why you are trying to use cl-modlisp. That
used to be popular 10 years ago, but in the meanwhile better
alternatives in web programming have appeared.

--
Stelian Ionescu a.k.a. fe[nl]ix
Quidquid latine dictum sit, altum videtur.
http://common-lisp.net/project/iolib

signature.asc

Joe Corneli

unread,
Mar 18, 2013, 4:20:57 PM3/18/13
to Nikodemus Siivola, ke...@rosenberg.net, sbcl...@lists.sourceforge.net
This seems to have worked.

;; Add this method to avoid getting an error
(defmethod close ((stream sb-bsd-sockets:socket) &key abort)
(close stream :abort abort))

; (defun close-active-socket (socket)
; #+sbcl (sb-bsd-sockets:socket-close socket)
; #-sbcl (close socket))

(defun close-active-socket (socket)
(close socket))

Reply all
Reply to author
Forward
0 new messages