本文介绍了SBCL上的USocket:连接被拒绝(Drakma和Dex)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行简单的HTTP请求:




  • 使用 dexador drakma

  • 和SBCL 1.4.14

  • 和OS X 10.13.6

  • 带有(ql:client-version)等于 2017-03-06和(defvar qlqs-info: *版本* 2015-01-28 (我刚刚从通过)

  • 通过Emacs + SLIME或仅通过命令行使用SBCL



 (dex:get http:// localhost:8000 / wp-json / wp / v2 / posts)

失败,并显示错误( dex stacktrace)

 已发出条件USOCKET:CONNECTION-REFUSED-ERROR 
[类型USOCKET:CONNECTION-REFUSED-ERROR的条件]

回溯:
0:(USOCKET :: HANDLE-CONDITION#< SB-BSD-SOCKETS:CONNECTION-REFUSED-ERROR {1008622AF3}> #< USOCKET:STREAM-USOCKET {1008622583}>)
1:(SB-KERNEL ::%SIGNAL#< SB-BSD-SOCKETS:CONNECTION-REFUSED-ERROR {1008622AF3}>)
2:(错误SB-BSD-SOCKETS:CONNECTION-REFUSED-ERROR:ERRNO 61:SYSCALL连接)
3:(SB-BSD-SOCKETS:SOCKET-ERROR连接 61)
4:(SB-BSD-SOCKETS :: CALL-WITH-SOCKET-ADDR#< SB-BSD-SOCKETS:INET-SOCKET 127.0.0.1:59367,fd:17 {1008622473}>(#(127 0 0 1)8000)#<关闭(Flet SB-BSD-SOCKETS :: WITH-SOCKET-ADDR-THUNK:在SB-BSD-SOCKETS:..
5:((:METHOD SB-BSD-SOCKETS:插座连接(SB-BSD-SOCKETS:SOCKET))#< SB-BSD-SOCKETS:INET-SOCKET 127.0.0.1:59367,fd:17 {1008622473}&#;#(127 0 0 1)8000)[快速-方法]
6:((FLET WITHOUT-INTERRUPTS-BODY-22:在USOCKET:SOCKET-CONNECT中))
7:(USOCKET:SOCKET-CONNECT localhost 8000:协议:STREAM :元素类型(未签名字节8):超时10:最后期限N:延迟DE:本地主机NIL:本地端口NIL)
8:(((标签DEXADOR.BACKEND.USOCKET :: MAKE-NEW-连接方式:在DEXA中DOR.BACKEND.USOCKET:REQUEST)#< QURI.URI.HTTP:URI-HTTP http:// localhost:8000 / wp-json / wp / v2 / posts
9:(DEXADOR.BACKEND.USOCKET:请求#<不可用的参数> :METHOD:GET)
10:(SB-INT:SIMPLE-EVAL-IN-LEXENV(DEXADOR:GET http:// localhost:8000 / wp-json / wp / v2 / posts)#< NULL-LEXEN ..
11 :(评估(DEXADOR:GET http:// localhost:8000 / wp-json / wp / v2 / posts))

或( drakma stacktrace)

 已发出条件USOCKET:CONNECTION-REFUSED-ERROR 
[类型为USOCKET:CONNECTION-REFUSED-ERROR的条件]

重新启动:
0:[重试]重试SLIME REPL评估请求。
1:[* ABORT]返回SLIME的最高级别。
2:[ABORT]中止线程(#< THREAD repl-thread RUNNING { 1003CE8413}>)

回溯:
0:(USOCKET :: HANDLE-CONDITION#< SB-BSD-SOCKETS:CONNECTION-REFUSED-ERROR {1005657693}>#< USOCKET:STREAM-USOCKET {1005657123}>)
1:(SB-KERNEL ::%SIGNAL#< SB-BSD-SOCKETS:CONNECTION-REFUSED-ERROR {1005657693}>)
2 :(错误SB-BSD-SOCKETS:CONNECTION-REFUSED-ERROR:ERRNO 61:SYSCALL connect)
3:(SB-BSD-SOCKETS:S OCKET-ERROR连接 61)
4:(SB-BSD-SOCKETS :: CALL-WITH-SOCKET-ADDR#< SB-BSD-SOCKETS:INET-SOCKET 127.0.0.1:59799,fd:12 {1005657013}> (#(127 0 0 1)8000)#<关闭(Flet SB-BSD-SOCKETS :: WITH-SOCKET-ADDR-THUNK:IN SB-BSD-SOCKETS:..
5:((:METHOD SB-BSD-SOCKETS:SOCKET-CONNECT(SB-BSD-SOCKETS:SOCKET))#< SB-BSD-SOCKETS:INET-SOCKET 127.0.0.1:59799,fd:12 {1005657013}>#(127 0 0 1)8000)[快速方法]
6:((FLET WITHOUT-INTERRUPTS-BODY-22:在USOCKET:SOCKET-CONNECT))
7:((USOCKET:SOCKET-CONNECT localhost 8000:协议:STREAM:元素类型的FLEXI-STREAMS:OCTET:TIMEOUT 20:DEADLINE NIL:NODELAY:IF-SUPPORTED:LOCAL-HOST NIL:LOCAL-PORT NIL)
8:(DRAKMA:HTTP-REQUEST #< PURI:URI http:// localhost:8000 / wp-json / wp / v2 / posts>)
9:(SB-INT:SIMPLE-EVAL-IN-LEXENV(DRAKMA:HTTP-REQUEST http:// localhost:8000 / wp-json / wp / v2 / posts)#< NULL-LEXENV>)
10:(EVAL(DRAKMA:HTTP-REQUEST http:// localhost:8000 / wp-json / wp / v2 / posts))
11:(SWANK :: EVAL-REGION(drakma:http-request \ http:// localhost:8000 / wp-json / wp / v2 / posts\)..)
12:((LAMBDA NIL:IN SWANK-REPL :: REPL-EVAL))
13:(SWANK-REPL :: TRACK-PACKAGE#< CLOSURE(LAMBDA NIL:IN SWANK-REPL :: REPL-EVAL){10056566CB}>)
14:(SWANK :: CALL -WITH-RETRY-RESTART重试SLIME REPL评估请求。#<关闭(LAMBDA NIL:在SWANK-REPL :: REPL-EVAL){100565666B}>)
15:(SWANK :: CALL- WITH-BUFFER-SYNTAX NIL#< CLOSURE(LAMBDA NIL:IN SWANK-REPL :: REPL-EVAL){100565664B}>)
16:(SWANK-REPL :: REPL-EVAL(drakma:http -request \ http:// localhost:8000 / wp-json / wp / v2 / posts\)..)
17:(SB-INT:SIMPLE-EVAL-IN-LEXENV(SWANK- REPL:LISTENER-EVAL(drakma:http-request \ http:// localhost:8000 / wp-json / wp / v2 / posts\)..)
18:(EVAL(SWANK- REPL:LISTENER-EVAL(drakma:http-request \ http:// localhost:8000 / wp-json / wp / v2 / posts\)..)
19:(SWANK:EVAL- FOR-EMACS(SWANK-REPL:LISTENER-EVAL(drakma:http-request \ http:// localhost:8000 / wp-json / wp / v2 / posts\)..)
20 :(SWANK :: PROCESS-REQUESTS NIL)
21:(((LAMBDA NIL:IN SWANK :: HANDLE-REQUESTS))
22:(((LAMBDA NIL:IN SWANK :: H ANDLE-REQUESTS))
23:(SWANK / SBCL :: CALL-WITH-BREAK-HOOK#<功能SWANK:SWANK-DEBUGGER-HOOK> #< CLOSURE(LAMBDA NIL:IN SWANK :: HANDLE-REQUESTS){1003CF008B}>)
24:((FLET SWANK / BACKEND:CALL-WITH-DEBUGGER-HOOK:IN / Users / ihar / quicklisp / dists / quicklisp / software / slime-v2.22 / swank / sbcl.lisp)#<功能SWANK:SWANK-DEBUGGER-HOOK>#<关闭(LAMBDA NIL:在SWANK :: HA ..
25:(SWANK :: CALL-WITH-BINDINGS((* STANDARD-INPUT *。#1 =#< SWANK / GRAY :: SLIME-INPUT-STREAM {1003BEA693}>))(* STANDARD-OUTPUT *。 #2 =#< SWANK / GRAY :: SLIME-OUTPUT-STREAM {1003CC8CF3}>)(* TRACE-OUTPUT *。#2#)(* ERR ..
26:(SWANK :: HANDLE-请求#< SWANK :: MULTITHREADED-CONNECTION {10032427F3}> NIL)
27:((Flet SB-UNIX :: BODY:IN SB-THREAD :: INITIAL-THREAD-FUNCTION-TRAMPOLINE))
28:((FLET WITHOUT-INTERRUPTS-BODY-4:在SB-螺纹::初始螺纹功能-蹦床))
29:(((SF-SB-螺纹:: WITH-MUTEX-扑通:在SB-螺纹::初始螺纹功能-蹦床))
30:((删除 WITHOUT-INTERRUPTS-BODY-1:在SB-螺纹:: CALL-WITH-MUTEX))
31:(SB-螺纹:: CALL-WITH-MU TEX#<关闭(完整的SB-螺纹:: WITH-MUTEX-THUNK:在SB-螺纹:: INITIAL-THREAD-FUNCTION-TRAMPOLINE){3A67D6B}> #< SB-THREAD:MUTEX线程结果锁定所有者:#< SB-THREAD:THREAD ..
32:(SB-THREAD :: INITIAL-THREAD-FUNCTION-TRAMPOLINE#< SB-线程:线程 REPL-线程正在运行{1003CE8413}> NIL#<关闭(LAMBDA NIL:在SWANK-REPL :: SPAWN-REPL-THREAD){1003CE83BB}> NIL)
33:(外部函数:call_into_lisp)
34:(外部函数:new_thread_trampoline)
35:(外部函数:_pthread_body)
36:(外部函数:_pthread_body)
37 :(外部函数:thread_start)

Clozure上运行相同的请求通用Lisp版本1.11.5(DarwinX8664)效果很好。



有人知道原因吗?


Running simple HTTP-request:

(dex:get "http://localhost:8000/wp-json/wp/v2/posts")

fails with the error (dex stacktrace)

Condition USOCKET:CONNECTION-REFUSED-ERROR was signalled.
   [Condition of type USOCKET:CONNECTION-REFUSED-ERROR]

Backtrace:
  0: (USOCKET::HANDLE-CONDITION #<SB-BSD-SOCKETS:CONNECTION-REFUSED-ERROR {1008622AF3}> #<USOCKET:STREAM-USOCKET {1008622583}>)
  1: (SB-KERNEL::%SIGNAL #<SB-BSD-SOCKETS:CONNECTION-REFUSED-ERROR {1008622AF3}>)
  2: (ERROR SB-BSD-SOCKETS:CONNECTION-REFUSED-ERROR :ERRNO 61 :SYSCALL "connect")
  3: (SB-BSD-SOCKETS:SOCKET-ERROR "connect" 61)
  4: (SB-BSD-SOCKETS::CALL-WITH-SOCKET-ADDR #<SB-BSD-SOCKETS:INET-SOCKET 127.0.0.1:59367, fd: 17 {1008622473}> (#(127 0 0 1) 8000) #<CLOSURE (FLET SB-BSD-SOCKETS::WITH-SOCKET-ADDR-THUNK :IN SB-BSD-SOCKETS:..
  5: ((:METHOD SB-BSD-SOCKETS:SOCKET-CONNECT (SB-BSD-SOCKETS:SOCKET)) #<SB-BSD-SOCKETS:INET-SOCKET 127.0.0.1:59367, fd: 17 {1008622473}> #(127 0 0 1) 8000) [fast-method]
  6: ((FLET "WITHOUT-INTERRUPTS-BODY-22" :IN USOCKET:SOCKET-CONNECT))
  7: (USOCKET:SOCKET-CONNECT "localhost" 8000 :PROTOCOL :STREAM :ELEMENT-TYPE (UNSIGNED-BYTE 8) :TIMEOUT 10 :DEADLINE NIL :NODELAY T :LOCAL-HOST NIL :LOCAL-PORT NIL)
  8: ((LABELS DEXADOR.BACKEND.USOCKET::MAKE-NEW-CONNECTION :IN DEXADOR.BACKEND.USOCKET:REQUEST) #<QURI.URI.HTTP:URI-HTTP http://localhost:8000/wp-json/wp/v2/posts
  9: (DEXADOR.BACKEND.USOCKET:REQUEST #<unavailable argument> :METHOD :GET)
 10: (SB-INT:SIMPLE-EVAL-IN-LEXENV (DEXADOR:GET "http://localhost:8000/wp-json/wp/v2/posts") #<NULL-LEXEN..
 11: (EVAL (DEXADOR:GET "http://localhost:8000/wp-json/wp/v2/posts"))

or (drakma stacktrace)

Condition USOCKET:CONNECTION-REFUSED-ERROR was signalled.
   [Condition of type USOCKET:CONNECTION-REFUSED-ERROR]

Restarts:
 0: [RETRY] Retry SLIME REPL evaluation request.
 1: [*ABORT] Return to SLIME's top level.
 2: [ABORT] abort thread (#<THREAD "repl-thread" RUNNING {1003CE8413}>)

Backtrace:
  0: (USOCKET::HANDLE-CONDITION #<SB-BSD-SOCKETS:CONNECTION-REFUSED-ERROR {1005657693}> #<USOCKET:STREAM-USOCKET {1005657123}>)
  1: (SB-KERNEL::%SIGNAL #<SB-BSD-SOCKETS:CONNECTION-REFUSED-ERROR {1005657693}>)
  2: (ERROR SB-BSD-SOCKETS:CONNECTION-REFUSED-ERROR :ERRNO 61 :SYSCALL "connect")
  3: (SB-BSD-SOCKETS:SOCKET-ERROR "connect" 61)
  4: (SB-BSD-SOCKETS::CALL-WITH-SOCKET-ADDR #<SB-BSD-SOCKETS:INET-SOCKET 127.0.0.1:59799, fd: 12 {1005657013}> (#(127 0 0 1) 8000) #<CLOSURE (FLET SB-BSD-SOCKETS::WITH-SOCKET-ADDR-THUNK :IN SB-BSD-SOCKETS:..
  5: ((:METHOD SB-BSD-SOCKETS:SOCKET-CONNECT (SB-BSD-SOCKETS:SOCKET)) #<SB-BSD-SOCKETS:INET-SOCKET 127.0.0.1:59799, fd: 12 {1005657013}> #(127 0 0 1) 8000) [fast-method]
  6: ((FLET "WITHOUT-INTERRUPTS-BODY-22" :IN USOCKET:SOCKET-CONNECT))
  7: (USOCKET:SOCKET-CONNECT "localhost" 8000 :PROTOCOL :STREAM :ELEMENT-TYPE FLEXI-STREAMS:OCTET :TIMEOUT 20 :DEADLINE NIL :NODELAY :IF-SUPPORTED :LOCAL-HOST NIL :LOCAL-PORT NIL)
  8: (DRAKMA:HTTP-REQUEST #<PURI:URI http://localhost:8000/wp-json/wp/v2/posts>)
  9: (SB-INT:SIMPLE-EVAL-IN-LEXENV (DRAKMA:HTTP-REQUEST "http://localhost:8000/wp-json/wp/v2/posts") #<NULL-LEXENV>)
 10: (EVAL (DRAKMA:HTTP-REQUEST "http://localhost:8000/wp-json/wp/v2/posts"))
 11: (SWANK::EVAL-REGION "(drakma:http-request \"http://localhost:8000/wp-json/wp/v2/posts\") ..)
 12: ((LAMBDA NIL :IN SWANK-REPL::REPL-EVAL))
 13: (SWANK-REPL::TRACK-PACKAGE #<CLOSURE (LAMBDA NIL :IN SWANK-REPL::REPL-EVAL) {10056566CB}>)
 14: (SWANK::CALL-WITH-RETRY-RESTART "Retry SLIME REPL evaluation request." #<CLOSURE (LAMBDA NIL :IN SWANK-REPL::REPL-EVAL) {100565666B}>)
 15: (SWANK::CALL-WITH-BUFFER-SYNTAX NIL #<CLOSURE (LAMBDA NIL :IN SWANK-REPL::REPL-EVAL) {100565664B}>)
 16: (SWANK-REPL::REPL-EVAL "(drakma:http-request \"http://localhost:8000/wp-json/wp/v2/posts\") ..)
 17: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SWANK-REPL:LISTENER-EVAL "(drakma:http-request \"http://localhost:8000/wp-json/wp/v2/posts\") ..)
 18: (EVAL (SWANK-REPL:LISTENER-EVAL "(drakma:http-request \"http://localhost:8000/wp-json/wp/v2/posts\") ..)
 19: (SWANK:EVAL-FOR-EMACS (SWANK-REPL:LISTENER-EVAL "(drakma:http-request \"http://localhost:8000/wp-json/wp/v2/posts\") ..)
 20: (SWANK::PROCESS-REQUESTS NIL)
 21: ((LAMBDA NIL :IN SWANK::HANDLE-REQUESTS))
 22: ((LAMBDA NIL :IN SWANK::HANDLE-REQUESTS))
 23: (SWANK/SBCL::CALL-WITH-BREAK-HOOK #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE (LAMBDA NIL :IN SWANK::HANDLE-REQUESTS) {1003CF008B}>)
 24: ((FLET SWANK/BACKEND:CALL-WITH-DEBUGGER-HOOK :IN "/Users/ihar/quicklisp/dists/quicklisp/software/slime-v2.22/swank/sbcl.lisp") #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE (LAMBDA NIL :IN SWANK::HA..
 25: (SWANK::CALL-WITH-BINDINGS ((*STANDARD-INPUT* . #1=#<SWANK/GRAY::SLIME-INPUT-STREAM {1003BEA693}>) (*STANDARD-OUTPUT* . #2=#<SWANK/GRAY::SLIME-OUTPUT-STREAM {1003CC8CF3}>) (*TRACE-OUTPUT* . #2#) (*ERR..
 26: (SWANK::HANDLE-REQUESTS #<SWANK::MULTITHREADED-CONNECTION {10032427F3}> NIL)
 27: ((FLET SB-UNIX::BODY :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
 28: ((FLET "WITHOUT-INTERRUPTS-BODY-4" :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
 29: ((FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
 30: ((FLET "WITHOUT-INTERRUPTS-BODY-1" :IN SB-THREAD::CALL-WITH-MUTEX))
 31: (SB-THREAD::CALL-WITH-MUTEX #<CLOSURE (FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE) {3A67D6B}> #<SB-THREAD:MUTEX "thread result lock" owner: #<SB-THREAD:THREAD "..
 32: (SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE #<SB-THREAD:THREAD "repl-thread" RUNNING {1003CE8413}> NIL #<CLOSURE (LAMBDA NIL :IN SWANK-REPL::SPAWN-REPL-THREAD) {1003CE83BB}> NIL)
 33: ("foreign function: call_into_lisp")
 34: ("foreign function: new_thread_trampoline")
 35: ("foreign function: _pthread_body")
 36: ("foreign function: _pthread_body")
 37: ("foreign function: thread_start")

Running the same request on Clozure Common Lisp Version 1.11.5 (DarwinX8664) works good.

Does somebody know the reason?

解决方案

I had the same situation and I noticed my local services which Drakma tried to reach were ipv6 based, so they listened at ::1, when I set those service to listen at 127.0.0.1:xxxx explicitly instead of localhost:xxxx they became ipv4 and Drakma didn't complain any more.

这篇关于SBCL上的USocket:连接被拒绝(Drakma和Dex)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-22 01:09