Cl-stomp:start loop may crash with a type error
Not sure, whether this is a recent development with usocket, but cl-stomp:start
will crash in
(let ((sock #| ===> #| (car #| <=== |# (usocket:wait-for-input socket :timeout 1))))
(when sock
(let ((newbuf (append recvbuf (receive conn))))
(setf recvbuf (process-receive-buffer conn newbuf) ...
since wait-for-input
returns the value passed as first argument under certain circumstances. The problem can be solved by either passing (list socket)
as first argument (instead of just socket
), or adding the keyword argument :ready-only t
to the call. Given the behaviour of usocket:wait-for-input
it might even be feasible to just get rid of the car
, but I didn't look into that carefully enough, so I'd go with one of the other options.
Let me know, if you want me to cook up a pull request. I was able to reproduce this with the example program ("example.lisp") by just calling the start
function.
The value
#<USOCKET:STREAM-USOCKET {1004B5D743}>
is not of type
LIST
[Condition of type TYPE-ERROR]
Backtrace:
0: ((:METHOD CL-STOMP:START (CL-STOMP::CONNECTION)) #<CL-STOMP::CONNECTION {10042407D3}> :USERNAME NIL :PASSCODE
NIL) [fast-method]
1: ((FLET "WITHOUT-INTERRUPTS-BODY-4" :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
2: ((FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
3: ((FLET "WITHOUT-INTERRUPTS-BODY-1" :IN SB-THREAD::CALL-WITH-MUTEX))
4: (SB-THREAD::CALL-WITH-MUTEX #<CLOSURE (FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE) {6A41CFB}> #<SB-THREAD:MUTEX "thread result lock" owner: #<SB-THREAD:THREAD "..
5: (SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE #<SB-THREAD:THREAD "stomp-subscribe" RUNNING {1003E57D63}> NIL #
<FUNCTION (LAMBDA NIL :IN START) {100350D5AB}> (#<SB-THREAD:THREAD "stomp-subscribe" RUNN..