在用 ecl
加載 swank
服務端時返回錯誤:linux
pi@rpi ~ $ ecl -load ~/.vim/bundle/slimv/slime/start-swank.lisp ;;; Loading "/home/pi/.vim/bundle/slimv/slime/start-swank.lisp" ;;; Loading "/opt/github/slimv/slime/swank-loader.lisp" ;;; Warning: No architecture feature found in (POWERPC PPC X86 X86-64 X86_64 AMD64 I686 I586 I486 PC386 IAPX386 SPARC64 SPARC HPPA64 HPPA ARM PENTIUM3 PENTIUM4 JAVA-1.4 JAVA-1.5 JAVA-1.6 JAVA-1.7). ;;; Loading #P"/usr/local/lib/ecl-16.1.2/cmp.fas" ;;; Loading "/home/pi/.slime/fasl/2014-10-10/ecl-16.1.2-linux-unknown/backend.fas" ;;; Loading "/home/pi/.slime/fasl/2014-10-10/ecl-16.1.2-linux-unknown/ecl.fas" ;;; Loading #P"/usr/local/lib/ecl-16.1.2/sockets.fas" ;;; Loading #P"/usr/local/lib/ecl-16.1.2/profile.fas" ;;; Loading #P"/usr/local/lib/ecl-16.1.2/serve-event.fas" ;;; Loading "/home/pi/.slime/fasl/2014-10-10/ecl-16.1.2-linux-unknown/gray.fas" ;;; Loading "/home/pi/.slime/fasl/2014-10-10/ecl-16.1.2-linux-unknown/match.fas" ;;; Loading "/home/pi/.slime/fasl/2014-10-10/ecl-16.1.2-linux-unknown/rpc.fas" ;;; Loading "/home/pi/.slime/fasl/2014-10-10/ecl-16.1.2-linux-unknown/swank.fas" An error occurred during initialization: Socket error in "bind": 99 (Cannot assign requested address). pi@rpi ~ $
先以 Cannot assign requested address
做爲關鍵字在網上查了半天, 絕大多數的都說是鏈接太多端口不夠, 要及時釋放, 解決辦法以下:nginx
pi@rpi /usr/share/nginx $ sudo sysctl -w net.ipv4.tcp_timestamps=1 pi@rpi /usr/share/nginx $ sudo sysctl -w net.ipv4.tcp_tw_recycle=1 pi@rpi /usr/share/nginx $ cat /proc/sys/net/ipv4/tcp_timestamps 1 pi@rpi /usr/share/nginx $ cat /proc/sys/net/ipv4/tcp_tw_recycle 1 pi@rpi /usr/share/nginx $
有的人說前面的說法不正確, 是端口範圍要擴大(針對 ubuntu 12.04版本 ), 解決辦法是:git
pi@rpi /usr/share/nginx $ echo 32768 61000 > /proc/sys/net/ipv4/ip_local_port_range pi@rpi /usr/share/nginx $ cat /proc/sys/net/ipv4/ip_local_port_range 32768 61000
但是貌似在個人樹莓派上都沒起做用.github
個人初步判斷是由於啓動了相似 nginx
這樣的服務程序, 因此在地址分配方面發生了莫名其妙的衝突, 一個解決辦法就是把這些服務全給停掉redis
pi@rpi ~ $ sudo service docker status Docker is running. pi@rpi ~ $ sudo service docker stop Stopping Docker: docker. pi@rpi ~ $ sudo service docker status Docker is not running ... failed! pi@rpi ~ $ sudo service redis-server status redis-server is running pi@rpi ~ $ sudo service redis-server stop Stopping redis-server: redis-server. pi@rpi ~ $ sudo service redis-server status redis-server is not running pi@rpi ~ $
服務所有停掉, 但是問題依舊.docker
我繼續猜想也有多是網絡配置引發的, 看看這個網絡配置, 總感受有些不太對勁, 但是具體哪裏有問題, 也說不出來:ubuntu
pi@rpi ~ $ ifconfig docker0 Link encap:Ethernet HWaddr 02:42:ec:c9:aa:72 inet addr:172.17.0.1 Bcast:0.0.0.0 Mask:255.255.0.0 inet6 addr: fe80::cb3e:8ad4:3a00:2a07/64 Scope:Link UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) eth0 Link encap:Ethernet HWaddr b8:27:eb:48:8f:ee inet addr:192.168.0.100 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::ba27:ebff:fe48:8fee/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:2074 errors:0 dropped:0 overruns:0 frame:0 TX packets:1615 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:151891 (148.3 KiB) TX bytes:441121 (430.7 KiB) pi@rpi ~ $
突然想到我是在用 ecl
啓動 swank
的過程當中報錯的, 那麼試着換換關鍵字搜索一下, 這回用 "swank
Cannot assign requested address
" 當關鍵字放狗來搜, 很幸運的第一個就搜到了一條貌似很是接近個人狀況的Swank socket problemvim
他的問題跟我差很少,也是想經過 SBCL
加載 swank
時出錯, 錯誤信息:網絡
* (load "swank-loader.lisp") ... * (swank:create-server :port 12345) debugger invoked on a SB-BSD-SOCKETS:SOCKET-ERROR in thread #<THREAD "initial thread" RUNNING {AA1B639}>: Socket error in "bind": 99 (Cannot assign requested address)
回覆提到要檢查 loopback
接口socket
That usualy means you are trying to bind socket on the address not on this machine. I think slime determines your address by localhost or hostname, are they right? And does loopback 127.0.0.1 exist?
而後樓主的反饋證明他的 loopback
接口沒起來, 起來就行了:
Thanks for the hint, the loopback interface was not started. Now it works :) Cornelius
我上面的網絡情況好像也沒看到 loopback
接口, 先備份原來的配置文件, 再試着改改配置把它跑起來, 修改後的網絡配置文件以下:
pi@rpi ~ $ sudo vi /etc/network/interfaces 1 auto lo 2 iface lo inet loopback 3 iface eth0 inet dhcp 4 5 allow-hotplug wlan0 6 auto wlan0 pi@rpi ~ $
修改後保存, 試着執行這個命令重啓下網絡配置:
sudo /etc/init.d/networking restart
結果沒效果, 仍是沒搞起 lo
來, 只好用 sudo reboot
重啓系統, 重啓後終於發現了久違的 lo
接口:
pi@rpi ~ $ ifconfig docker0 Link encap:Ethernet HWaddr 02:42:01:89:10:22 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) eth0 Link encap:Ethernet HWaddr b8:27:eb:48:8f:ee inet addr:192.168.0.100 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::ba27:ebff:fe48:8fee/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:125 errors:0 dropped:0 overruns:0 frame:0 TX packets:146 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:15662 (15.2 KiB) TX bytes:20296 (19.8 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:8 errors:0 dropped:0 overruns:0 frame:0 TX packets:8 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1104 (1.0 KiB) TX bytes:1104 (1.0 KiB) pi@rpi ~ $
淚流滿面啊, 這回再試試, 哈哈, 終於成功:
pi@rpi ~ $ ecl -load ~/.vim/bundle/slimv/slime/start-swank.lisp ;;; Loading "/home/pi/.vim/bundle/slimv/slime/start-swank.lisp" ;;; Loading "/opt/github/slimv/slime/swank-loader.lisp" ;;; Warning: No architecture feature found in (POWERPC PPC X86 X86-64 X86_64 AMD64 I686 I586 I486 PC386 IAPX386 SPARC64 SPARC HPPA64 HPPA ARM PENTIUM3 PENTIUM4 JAVA-1.4 JAVA-1.5 JAVA-1.6 JAVA-1.7). ;;; Loading #P"/usr/local/lib/ecl-16.1.2/cmp.fas" ;;; Loading "/home/pi/.slime/fasl/2014-10-10/ecl-16.1.2-linux-unknown/backend.fas" ;;; Loading "/home/pi/.slime/fasl/2014-10-10/ecl-16.1.2-linux-unknown/ecl.fas" ;;; Loading #P"/usr/local/lib/ecl-16.1.2/sockets.fas" ;;; Loading #P"/usr/local/lib/ecl-16.1.2/profile.fas" ;;; Loading #P"/usr/local/lib/ecl-16.1.2/serve-event.fas" ;;; Loading "/home/pi/.slime/fasl/2014-10-10/ecl-16.1.2-linux-unknown/gray.fas" ;;; Loading "/home/pi/.slime/fasl/2014-10-10/ecl-16.1.2-linux-unknown/match.fas" ;;; Loading "/home/pi/.slime/fasl/2014-10-10/ecl-16.1.2-linux-unknown/rpc.fas" ;;; Loading "/home/pi/.slime/fasl/2014-10-10/ecl-16.1.2-linux-unknown/swank.fas" ;; Swank started at port: 4005.
再在 tmux
上開個窗口用 telnet
試着連一下:
pi@rpi ~ $ telnet 127.0.0.1 4005 Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'.
很好, 終於看到 CL-USER>
這個提示符了:
CL-USER> (+ 1 2) 3 CL-USER>
至此, 問題完美解決, 教訓就是:
不能光憑經驗下結論, 必定要查看最基本的網絡狀況( ifconfig )
另外, 又瞭解到一個知識點: loopback
接口沒起來的話, 也會致使 Socket error in "bind": 99 (Cannot assign requested address) 錯誤的出現.